mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 22:36:43 +00:00
# Conflicts: # apps/openmw-mp/Networking.cpp # apps/openmw-mp/Script/Functions/Objects.cpp # apps/openmw-mp/Script/Functions/Objects.hpp # apps/openmw-mp/processors/ObjectProcessor.cpp # apps/openmw-mp/processors/object/ProcessorContainer.hpp # apps/openmw-mp/processors/object/ProcessorDoorState.hpp # apps/openmw-mp/processors/object/ProcessorMusicPlay.hpp # apps/openmw-mp/processors/object/ProcessorObjectAnimPlay.hpp # apps/openmw-mp/processors/object/ProcessorObjectDelete.hpp # apps/openmw-mp/processors/object/ProcessorObjectLock.hpp # apps/openmw-mp/processors/object/ProcessorObjectMove.hpp # apps/openmw-mp/processors/object/ProcessorObjectPlace.hpp # apps/openmw-mp/processors/object/ProcessorObjectRotate.hpp # apps/openmw-mp/processors/object/ProcessorObjectScale.hpp # apps/openmw-mp/processors/object/ProcessorObjectSpawn.hpp # apps/openmw-mp/processors/object/ProcessorObjectState.hpp # apps/openmw-mp/processors/object/ProcessorObjectTrap.hpp # apps/openmw-mp/processors/object/ProcessorScriptGlobalFloat.hpp # apps/openmw-mp/processors/object/ProcessorScriptGlobalShort.hpp # apps/openmw-mp/processors/object/ProcessorScriptLocalFloat.hpp # apps/openmw-mp/processors/object/ProcessorScriptLocalShort.hpp # apps/openmw-mp/processors/object/ProcessorScriptMemberFloat.hpp # apps/openmw-mp/processors/object/ProcessorScriptMemberShort.hpp # apps/openmw-mp/processors/object/ProcessorVideoPlay.hpp # apps/openmw/mwmp/Networking.cpp # apps/openmw/mwmp/processors/object/BaseObjectProcessor.hpp # apps/openmw/mwmp/processors/object/ProcessorMusicPlay.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptGlobalFloat.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptGlobalShort.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptMemberFloat.hpp # apps/openmw/mwmp/processors/object/ProcessorScriptMemberShort.hpp # apps/openmw/mwmp/processors/object/ProcessorVideoPlay.hpp
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#ifndef OPENMW_PROCESSOROBJECTPLACE_HPP
|
|
#define OPENMW_PROCESSOROBJECTPLACE_HPP
|
|
|
|
#include "../ObjectProcessor.hpp"
|
|
#include <apps/openmw-mp/Networking.hpp>
|
|
|
|
namespace mwmp
|
|
{
|
|
class ProcessorObjectPlace final: public ObjectProcessor
|
|
{
|
|
public:
|
|
ProcessorObjectPlace()
|
|
{
|
|
BPP_INIT(ID_OBJECT_PLACE)
|
|
}
|
|
|
|
void Do(ObjectPacket &packet, const std::shared_ptr<Player> &player, BaseObjectList &objectList) override
|
|
{
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player->npc.mName.c_str());
|
|
|
|
for (auto & object : objectList.baseObjects)
|
|
object.mpNum = mwmp::Networking::getPtr()->incrementMpNum();
|
|
|
|
// Send this packet back to the original sender with the mpNum generation from above,
|
|
// then send it to the other players
|
|
packet.Send(false);
|
|
packet.Send(true);
|
|
|
|
auto objCtrl = Networking::get().getState().getObjectCtrl();
|
|
auto objects = objCtrl.copyObjects(objectList);
|
|
|
|
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_OBJECT_PLACE>(player.get(), objects);
|
|
|
|
objCtrl.sendObjects(player, objects, objectList.cell);
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif //OPENMW_PROCESSOROBJECTPLACE_HPP
|