[General] Add placeholder for ObjectActivate packet

This commit is contained in:
David Cernat 2018-07-15 01:08:31 +03:00
parent 61da0d2475
commit 81b160cae8
11 changed files with 108 additions and 14 deletions

View file

@ -120,15 +120,16 @@ source_group(tes3mp-server\\processors\\player FILES ${PROCESSORS_PLAYER})
set(PROCESSORS_OBJECT set(PROCESSORS_OBJECT
processors/object/ProcessorContainer.hpp processors/object/ProcessorDoorState.hpp processors/object/ProcessorContainer.hpp processors/object/ProcessorDoorState.hpp
processors/object/ProcessorMusicPlay.hpp processors/object/ProcessorObjectAnimPlay.hpp processors/object/ProcessorMusicPlay.hpp processors/object/ProcessorObjectActivate.hpp
processors/object/ProcessorObjectDelete.hpp processors/object/ProcessorObjectLock.hpp processors/object/ProcessorObjectAnimPlay.hpp processors/object/ProcessorObjectDelete.hpp
processors/object/ProcessorObjectMove.hpp processors/object/ProcessorObjectPlace.hpp processors/object/ProcessorObjectLock.hpp processors/object/ProcessorObjectMove.hpp
processors/object/ProcessorObjectRotate.hpp processors/object/ProcessorObjectScale.hpp processors/object/ProcessorObjectPlace.hpp processors/object/ProcessorObjectRotate.hpp
processors/object/ProcessorObjectSpawn.hpp processors/object/ProcessorObjectState.hpp processors/object/ProcessorObjectScale.hpp processors/object/ProcessorObjectSpawn.hpp
processors/object/ProcessorObjectTrap.hpp processors/object/ProcessorScriptLocalShort.hpp processors/object/ProcessorObjectState.hpp processors/object/ProcessorObjectTrap.hpp
processors/object/ProcessorScriptLocalFloat.hpp processors/object/ProcessorScriptMemberShort.hpp processors/object/ProcessorScriptLocalShort.hpp processors/object/ProcessorScriptLocalFloat.hpp
processors/object/ProcessorScriptMemberFloat.hpp processors/object/ProcessorScriptGlobalShort.hpp processors/object/ProcessorScriptMemberShort.hpp processors/object/ProcessorScriptMemberFloat.hpp
processors/object/ProcessorScriptGlobalFloat.hpp processors/object/ProcessorVideoPlay.hpp processors/object/ProcessorScriptGlobalShort.hpp processors/object/ProcessorScriptGlobalFloat.hpp
processors/object/ProcessorVideoPlay.hpp
) )
source_group(tes3mp-server\\processors\\object FILES ${PROCESSORS_OBJECT}) source_group(tes3mp-server\\processors\\object FILES ${PROCESSORS_OBJECT})

View file

@ -182,6 +182,7 @@ public:
{"OnCellDeletion", Function<void, const char*>()}, {"OnCellDeletion", Function<void, const char*>()},
{"OnContainer", Function<void, unsigned short, const char*>()}, {"OnContainer", Function<void, unsigned short, const char*>()},
{"OnDoorState", Function<void, unsigned short, const char*>()}, {"OnDoorState", Function<void, unsigned short, const char*>()},
{"OnObjectActivate", Function<void, unsigned short, const char*>()},
{"OnObjectPlace", Function<void, unsigned short, const char*>()}, {"OnObjectPlace", Function<void, unsigned short, const char*>()},
{"OnObjectState", Function<void, unsigned short, const char*>()}, {"OnObjectState", Function<void, unsigned short, const char*>()},
{"OnObjectSpawn", Function<void, unsigned short, const char*>()}, {"OnObjectSpawn", Function<void, unsigned short, const char*>()},

View file

@ -56,6 +56,7 @@
#include "object/ProcessorContainer.hpp" #include "object/ProcessorContainer.hpp"
#include "object/ProcessorDoorState.hpp" #include "object/ProcessorDoorState.hpp"
#include "object/ProcessorMusicPlay.hpp" #include "object/ProcessorMusicPlay.hpp"
#include "object/ProcessorObjectActivate.hpp"
#include "object/ProcessorObjectAnimPlay.hpp" #include "object/ProcessorObjectAnimPlay.hpp"
#include "object/ProcessorObjectDelete.hpp" #include "object/ProcessorObjectDelete.hpp"
#include "object/ProcessorObjectPlace.hpp" #include "object/ProcessorObjectPlace.hpp"
@ -133,6 +134,7 @@ void ProcessorInitializer()
ObjectProcessor::AddProcessor(new ProcessorContainer()); ObjectProcessor::AddProcessor(new ProcessorContainer());
ObjectProcessor::AddProcessor(new ProcessorDoorState()); ObjectProcessor::AddProcessor(new ProcessorDoorState());
ObjectProcessor::AddProcessor(new ProcessorMusicPlay()); ObjectProcessor::AddProcessor(new ProcessorMusicPlay());
ObjectProcessor::AddProcessor(new ProcessorObjectActivate());
ObjectProcessor::AddProcessor(new ProcessorObjectAnimPlay()); ObjectProcessor::AddProcessor(new ProcessorObjectAnimPlay());
ObjectProcessor::AddProcessor(new ProcessorObjectDelete()); ObjectProcessor::AddProcessor(new ProcessorObjectDelete());
ObjectProcessor::AddProcessor(new ProcessorObjectLock()); ObjectProcessor::AddProcessor(new ProcessorObjectLock());

View file

@ -0,0 +1,26 @@
#ifndef OPENMW_PROCESSOROBJECTACTIVATE_HPP
#define OPENMW_PROCESSOROBJECTACTIVATE_HPP
#include "../ObjectProcessor.hpp"
#include <apps/openmw-mp/Networking.hpp>
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<Script::CallbackIdentity("OnObjectActivate")>(player.getId(), objectList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSOROBJECTACTIVATE_HPP

View file

@ -50,6 +50,7 @@
#include "object/ProcessorDoorDestination.hpp" #include "object/ProcessorDoorDestination.hpp"
#include "object/ProcessorDoorState.hpp" #include "object/ProcessorDoorState.hpp"
#include "object/ProcessorMusicPlay.hpp" #include "object/ProcessorMusicPlay.hpp"
#include "object/ProcessorObjectActivate.hpp"
#include "object/ProcessorObjectAnimPlay.hpp" #include "object/ProcessorObjectAnimPlay.hpp"
#include "object/ProcessorObjectAttach.hpp" #include "object/ProcessorObjectAttach.hpp"
#include "object/ProcessorObjectCollision.hpp" #include "object/ProcessorObjectCollision.hpp"
@ -147,6 +148,7 @@ void ProcessorInitializer()
ObjectProcessor::AddProcessor(new ProcessorDoorDestination()); ObjectProcessor::AddProcessor(new ProcessorDoorDestination());
ObjectProcessor::AddProcessor(new ProcessorDoorState()); ObjectProcessor::AddProcessor(new ProcessorDoorState());
ObjectProcessor::AddProcessor(new ProcessorMusicPlay()); ObjectProcessor::AddProcessor(new ProcessorMusicPlay());
ObjectProcessor::AddProcessor(new ProcessorObjectActivate());
ObjectProcessor::AddProcessor(new ProcessorObjectAnimPlay()); ObjectProcessor::AddProcessor(new ProcessorObjectAnimPlay());
ObjectProcessor::AddProcessor(new ProcessorObjectAttach()); ObjectProcessor::AddProcessor(new ProcessorObjectAttach());
ObjectProcessor::AddProcessor(new ProcessorObjectCollision()); ObjectProcessor::AddProcessor(new ProcessorObjectCollision());

View file

@ -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

View file

@ -191,11 +191,12 @@ add_component_dir (openmw-mp/Packets/Player
add_component_dir (openmw-mp/Packets/Object add_component_dir (openmw-mp/Packets/Object
ObjectPacket ObjectPacket
PacketConsoleCommand PacketContainer PacketObjectAnimPlay PacketObjectAttach PacketObjectCollision PacketConsoleCommand PacketContainer PacketObjectActivate PacketObjectAnimPlay PacketObjectAttach
PacketObjectDelete PacketDoorDestination PacketDoorState PacketObjectLock PacketObjectMove PacketObjectPlace PacketObjectCollision PacketObjectDelete PacketDoorDestination PacketDoorState PacketObjectLock
PacketObjectReset PacketObjectRotate PacketObjectScale PacketObjectSpawn PacketObjectState PacketObjectTrap PacketObjectMove PacketObjectPlace PacketObjectReset PacketObjectRotate PacketObjectScale
PacketMusicPlay PacketVideoPlay PacketScriptLocalShort PacketScriptLocalFloat PacketScriptMemberShort PacketObjectSpawn PacketObjectState PacketObjectTrap PacketMusicPlay PacketVideoPlay PacketScriptLocalShort
PacketScriptMemberFloat PacketScriptGlobalShort PacketScriptGlobalFloat PacketScriptLocalFloat PacketScriptMemberShort PacketScriptMemberFloat PacketScriptGlobalShort
PacketScriptGlobalFloat
) )
add_component_dir (openmw-mp/Packets/Worldstate add_component_dir (openmw-mp/Packets/Worldstate

View file

@ -1,3 +1,4 @@
#include "../Packets/Object/PacketObjectActivate.hpp"
#include "../Packets/Object/PacketObjectAnimPlay.hpp" #include "../Packets/Object/PacketObjectAnimPlay.hpp"
#include "../Packets/Object/PacketObjectAttach.hpp" #include "../Packets/Object/PacketObjectAttach.hpp"
#include "../Packets/Object/PacketObjectCollision.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) mwmp::ObjectPacketController::ObjectPacketController(RakNet::RakPeerInterface *peer)
{ {
AddPacket<PacketObjectActivate>(&packets, peer);
AddPacket<PacketObjectAnimPlay>(&packets, peer); AddPacket<PacketObjectAnimPlay>(&packets, peer);
AddPacket<PacketObjectAttach>(&packets, peer); AddPacket<PacketObjectAttach>(&packets, peer);
AddPacket<PacketObjectCollision>(&packets, peer); AddPacket<PacketObjectCollision>(&packets, peer);

View file

@ -73,6 +73,7 @@ enum GameMessages
ID_ACTOR_SPEECH, ID_ACTOR_SPEECH,
ID_ACTOR_STATS_DYNAMIC, ID_ACTOR_STATS_DYNAMIC,
ID_OBJECT_ACTIVATE,
ID_OBJECT_ANIM_PLAY, ID_OBJECT_ANIM_PLAY,
ID_OBJECT_ATTACH, ID_OBJECT_ATTACH,
ID_OBJECT_COLLISION, ID_OBJECT_COLLISION,

View file

@ -0,0 +1,15 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#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);
}

View file

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETOBJECTACTIVATE_HPP
#define OPENMW_PACKETOBJECTACTIVATE_HPP
#include <components/openmw-mp/Packets/Object/ObjectPacket.hpp>
namespace mwmp
{
class PacketObjectActivate : public ObjectPacket
{
public:
PacketObjectActivate(RakNet::RakPeerInterface *peer);
virtual void Object(BaseObject &baseObject, bool send);
};
}
#endif //OPENMW_PACKETOBJECTACTIVATE_HPP