diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index 310694dac..c9eb075bf 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -120,15 +120,16 @@ source_group(tes3mp-server\\processors\\player FILES ${PROCESSORS_PLAYER}) set(PROCESSORS_OBJECT processors/object/ProcessorContainer.hpp processors/object/ProcessorDoorState.hpp - processors/object/ProcessorMusicPlay.hpp processors/object/ProcessorObjectAnimPlay.hpp - processors/object/ProcessorObjectDelete.hpp processors/object/ProcessorObjectLock.hpp - processors/object/ProcessorObjectMove.hpp processors/object/ProcessorObjectPlace.hpp - processors/object/ProcessorObjectRotate.hpp processors/object/ProcessorObjectScale.hpp - processors/object/ProcessorObjectSpawn.hpp processors/object/ProcessorObjectState.hpp - processors/object/ProcessorObjectTrap.hpp processors/object/ProcessorScriptLocalShort.hpp - processors/object/ProcessorScriptLocalFloat.hpp processors/object/ProcessorScriptMemberShort.hpp - processors/object/ProcessorScriptMemberFloat.hpp processors/object/ProcessorScriptGlobalShort.hpp - processors/object/ProcessorScriptGlobalFloat.hpp processors/object/ProcessorVideoPlay.hpp + processors/object/ProcessorMusicPlay.hpp processors/object/ProcessorObjectActivate.hpp + processors/object/ProcessorObjectAnimPlay.hpp processors/object/ProcessorObjectDelete.hpp + processors/object/ProcessorObjectLock.hpp processors/object/ProcessorObjectMove.hpp + processors/object/ProcessorObjectPlace.hpp processors/object/ProcessorObjectRotate.hpp + processors/object/ProcessorObjectScale.hpp processors/object/ProcessorObjectSpawn.hpp + processors/object/ProcessorObjectState.hpp processors/object/ProcessorObjectTrap.hpp + processors/object/ProcessorScriptLocalShort.hpp processors/object/ProcessorScriptLocalFloat.hpp + processors/object/ProcessorScriptMemberShort.hpp processors/object/ProcessorScriptMemberFloat.hpp + processors/object/ProcessorScriptGlobalShort.hpp processors/object/ProcessorScriptGlobalFloat.hpp + processors/object/ProcessorVideoPlay.hpp ) source_group(tes3mp-server\\processors\\object FILES ${PROCESSORS_OBJECT}) diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index c5e8abd8f..9d6d84de7 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -182,6 +182,7 @@ public: {"OnCellDeletion", Function()}, {"OnContainer", Function()}, {"OnDoorState", Function()}, + {"OnObjectActivate", Function()}, {"OnObjectPlace", Function()}, {"OnObjectState", Function()}, {"OnObjectSpawn", Function()}, diff --git a/apps/openmw-mp/processors/ProcessorInitializer.cpp b/apps/openmw-mp/processors/ProcessorInitializer.cpp index 97d7c0a24..f8e311f82 100644 --- a/apps/openmw-mp/processors/ProcessorInitializer.cpp +++ b/apps/openmw-mp/processors/ProcessorInitializer.cpp @@ -56,6 +56,7 @@ #include "object/ProcessorContainer.hpp" #include "object/ProcessorDoorState.hpp" #include "object/ProcessorMusicPlay.hpp" +#include "object/ProcessorObjectActivate.hpp" #include "object/ProcessorObjectAnimPlay.hpp" #include "object/ProcessorObjectDelete.hpp" #include "object/ProcessorObjectPlace.hpp" @@ -133,6 +134,7 @@ void ProcessorInitializer() ObjectProcessor::AddProcessor(new ProcessorContainer()); ObjectProcessor::AddProcessor(new ProcessorDoorState()); ObjectProcessor::AddProcessor(new ProcessorMusicPlay()); + ObjectProcessor::AddProcessor(new ProcessorObjectActivate()); ObjectProcessor::AddProcessor(new ProcessorObjectAnimPlay()); ObjectProcessor::AddProcessor(new ProcessorObjectDelete()); ObjectProcessor::AddProcessor(new ProcessorObjectLock()); diff --git a/apps/openmw-mp/processors/object/ProcessorObjectActivate.hpp b/apps/openmw-mp/processors/object/ProcessorObjectActivate.hpp new file mode 100644 index 000000000..060484d62 --- /dev/null +++ b/apps/openmw-mp/processors/object/ProcessorObjectActivate.hpp @@ -0,0 +1,26 @@ +#ifndef OPENMW_PROCESSOROBJECTACTIVATE_HPP +#define OPENMW_PROCESSOROBJECTACTIVATE_HPP + +#include "../ObjectProcessor.hpp" +#include + +namespace mwmp +{ + class ProcessorObjectActivate : public ObjectProcessor + { + public: + ProcessorObjectActivate() + { + BPP_INIT(ID_OBJECT_ACTIVATE) + } + + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override + { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); + + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSOROBJECTACTIVATE_HPP diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index ee999c87b..aa093fe7e 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -50,6 +50,7 @@ #include "object/ProcessorDoorDestination.hpp" #include "object/ProcessorDoorState.hpp" #include "object/ProcessorMusicPlay.hpp" +#include "object/ProcessorObjectActivate.hpp" #include "object/ProcessorObjectAnimPlay.hpp" #include "object/ProcessorObjectAttach.hpp" #include "object/ProcessorObjectCollision.hpp" @@ -147,6 +148,7 @@ void ProcessorInitializer() ObjectProcessor::AddProcessor(new ProcessorDoorDestination()); ObjectProcessor::AddProcessor(new ProcessorDoorState()); ObjectProcessor::AddProcessor(new ProcessorMusicPlay()); + ObjectProcessor::AddProcessor(new ProcessorObjectActivate()); ObjectProcessor::AddProcessor(new ProcessorObjectAnimPlay()); ObjectProcessor::AddProcessor(new ProcessorObjectAttach()); ObjectProcessor::AddProcessor(new ProcessorObjectCollision()); diff --git a/apps/openmw/mwmp/processors/object/ProcessorObjectActivate.hpp b/apps/openmw/mwmp/processors/object/ProcessorObjectActivate.hpp new file mode 100644 index 000000000..ba96702fc --- /dev/null +++ b/apps/openmw/mwmp/processors/object/ProcessorObjectActivate.hpp @@ -0,0 +1,26 @@ +#ifndef OPENMW_PROCESSOROBJECTACTIVATE_HPP +#define OPENMW_PROCESSOROBJECTACTIVATE_HPP + +#include "BaseObjectProcessor.hpp" + +namespace mwmp +{ + class ProcessorObjectActivate : public BaseObjectProcessor + { + public: + ProcessorObjectActivate() + { + BPP_INIT(ID_OBJECT_ACTIVATE) + } + + virtual void Do(ObjectPacket &packet, ObjectList &objectList) + { + BaseObjectProcessor::Do(packet, objectList); + + //objectList.activateObjects(ptrCellStore); + } + + }; +} + +#endif //OPENMW_PROCESSOROBJECTACTIVATE_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index db599683b..f60f0c1bb 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -191,11 +191,12 @@ add_component_dir (openmw-mp/Packets/Player add_component_dir (openmw-mp/Packets/Object ObjectPacket - PacketConsoleCommand PacketContainer PacketObjectAnimPlay PacketObjectAttach PacketObjectCollision - PacketObjectDelete PacketDoorDestination PacketDoorState PacketObjectLock PacketObjectMove PacketObjectPlace - PacketObjectReset PacketObjectRotate PacketObjectScale PacketObjectSpawn PacketObjectState PacketObjectTrap - PacketMusicPlay PacketVideoPlay PacketScriptLocalShort PacketScriptLocalFloat PacketScriptMemberShort - PacketScriptMemberFloat PacketScriptGlobalShort PacketScriptGlobalFloat + PacketConsoleCommand PacketContainer PacketObjectActivate PacketObjectAnimPlay PacketObjectAttach + PacketObjectCollision PacketObjectDelete PacketDoorDestination PacketDoorState PacketObjectLock + PacketObjectMove PacketObjectPlace PacketObjectReset PacketObjectRotate PacketObjectScale + PacketObjectSpawn PacketObjectState PacketObjectTrap PacketMusicPlay PacketVideoPlay PacketScriptLocalShort + PacketScriptLocalFloat PacketScriptMemberShort PacketScriptMemberFloat PacketScriptGlobalShort + PacketScriptGlobalFloat ) add_component_dir (openmw-mp/Packets/Worldstate diff --git a/components/openmw-mp/Controllers/ObjectPacketController.cpp b/components/openmw-mp/Controllers/ObjectPacketController.cpp index 60159b7bb..99ea4e1ea 100644 --- a/components/openmw-mp/Controllers/ObjectPacketController.cpp +++ b/components/openmw-mp/Controllers/ObjectPacketController.cpp @@ -1,3 +1,4 @@ +#include "../Packets/Object/PacketObjectActivate.hpp" #include "../Packets/Object/PacketObjectAnimPlay.hpp" #include "../Packets/Object/PacketObjectAttach.hpp" #include "../Packets/Object/PacketObjectCollision.hpp" @@ -38,6 +39,7 @@ inline void AddPacket(mwmp::ObjectPacketController::packets_t *packets, RakNet:: mwmp::ObjectPacketController::ObjectPacketController(RakNet::RakPeerInterface *peer) { + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 875a0f3c2..8c0f890f8 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -73,6 +73,7 @@ enum GameMessages ID_ACTOR_SPEECH, ID_ACTOR_STATS_DYNAMIC, + ID_OBJECT_ACTIVATE, ID_OBJECT_ANIM_PLAY, ID_OBJECT_ATTACH, ID_OBJECT_COLLISION, diff --git a/components/openmw-mp/Packets/Object/PacketObjectActivate.cpp b/components/openmw-mp/Packets/Object/PacketObjectActivate.cpp new file mode 100644 index 000000000..62f626169 --- /dev/null +++ b/components/openmw-mp/Packets/Object/PacketObjectActivate.cpp @@ -0,0 +1,15 @@ +#include +#include "PacketObjectActivate.hpp" + +using namespace mwmp; + +PacketObjectActivate::PacketObjectActivate(RakNet::RakPeerInterface *peer) : ObjectPacket(peer) +{ + packetID = ID_OBJECT_ACTIVATE; + hasCellData = true; +} + +void PacketObjectActivate::Object(BaseObject &baseObject, bool send) +{ + ObjectPacket::Object(baseObject, send); +} diff --git a/components/openmw-mp/Packets/Object/PacketObjectActivate.hpp b/components/openmw-mp/Packets/Object/PacketObjectActivate.hpp new file mode 100644 index 000000000..c2ad5fdbd --- /dev/null +++ b/components/openmw-mp/Packets/Object/PacketObjectActivate.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETOBJECTACTIVATE_HPP +#define OPENMW_PACKETOBJECTACTIVATE_HPP + +#include + +namespace mwmp +{ + class PacketObjectActivate : public ObjectPacket + { + public: + PacketObjectActivate(RakNet::RakPeerInterface *peer); + + virtual void Object(BaseObject &baseObject, bool send); + }; +} + +#endif //OPENMW_PACKETOBJECTACTIVATE_HPP