mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[General] Remove ObjectUnlock packet, use ObjectLock with 0 lock instead
This commit is contained in:
parent
48ee8fd536
commit
870fd9a78b
18 changed files with 25 additions and 203 deletions
|
@ -134,9 +134,9 @@ set(PROCESSORS_WORLD
|
|||
processors/world/ProcessorObjectDelete.hpp processors/world/ProcessorObjectLock.hpp
|
||||
processors/world/ProcessorObjectMove.hpp processors/world/ProcessorObjectPlace.hpp
|
||||
processors/world/ProcessorObjectRotate.hpp processors/world/ProcessorObjectScale.hpp
|
||||
processors/world/ProcessorObjectUnlock.hpp processors/world/ProcessorScriptGlobalShort.hpp
|
||||
processors/world/ProcessorScriptLocalFloat.hpp processors/world/ProcessorScriptLocalShort.hpp
|
||||
processors/world/ProcessorScriptMemberShort.hpp processors/world/ProcessorVideoPlay.hpp
|
||||
processors/world/ProcessorScriptGlobalShort.hpp processors/world/ProcessorScriptLocalFloat.hpp
|
||||
processors/world/ProcessorScriptLocalShort.hpp processors/world/ProcessorScriptMemberShort.hpp
|
||||
processors/world/ProcessorVideoPlay.hpp
|
||||
)
|
||||
|
||||
source_group(tes3mp-server\\processors\\world FILES ${PROCESSORS_WORLD})
|
||||
|
|
|
@ -52,11 +52,10 @@
|
|||
#include "processors/world/ProcessorObjectMove.hpp"
|
||||
#include "processors/world/ProcessorObjectRotate.hpp"
|
||||
#include "processors/world/ProcessorObjectScale.hpp"
|
||||
#include "processors/world/ProcessorObjectUnlock.hpp"
|
||||
#include "processors/world/ProcessorScriptGlobalShort.hpp"
|
||||
#include "processors/world/ProcessorScriptLocalFloat.hpp"
|
||||
#include "processors/world/ProcessorScriptLocalShort.hpp"
|
||||
#include "processors/world/ProcessorScriptLocalFloat.hpp"
|
||||
#include "processors/world/ProcessorScriptMemberShort.hpp"
|
||||
#include "processors/world/ProcessorScriptGlobalShort.hpp"
|
||||
#include "processors/world/ProcessorVideoPlay.hpp"
|
||||
|
||||
|
||||
|
@ -108,10 +107,9 @@ void ProcessorInitializer()
|
|||
WorldProcessor::AddProcessor(new ProcessorObjectPlace());
|
||||
WorldProcessor::AddProcessor(new ProcessorObjectRotate());
|
||||
WorldProcessor::AddProcessor(new ProcessorObjectScale());
|
||||
WorldProcessor::AddProcessor(new ProcessorObjectUnlock());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptGlobalShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptLocalFloat());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptLocalShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptLocalFloat());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptMemberShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptGlobalShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorVideoPlay());
|
||||
}
|
||||
|
|
|
@ -275,12 +275,6 @@ void WorldFunctions::SendObjectLock() noexcept
|
|||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->Send(writeEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectUnlock() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_UNLOCK)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_UNLOCK)->Send(writeEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendDoorState() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->setEvent(&writeEvent);
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\
|
||||
{"SendObjectScale", WorldFunctions::SendObjectScale},\
|
||||
{"SendObjectLock", WorldFunctions::SendObjectLock},\
|
||||
{"SendObjectUnlock", WorldFunctions::SendObjectUnlock},\
|
||||
{"SendDoorState", WorldFunctions::SendDoorState},\
|
||||
{"SendContainer", WorldFunctions::SendContainer},\
|
||||
\
|
||||
|
@ -124,7 +123,6 @@ public:
|
|||
static void SendObjectPlace() noexcept;
|
||||
static void SendObjectScale() noexcept;
|
||||
static void SendObjectLock() noexcept;
|
||||
static void SendObjectUnlock() noexcept;
|
||||
static void SendDoorState() noexcept;
|
||||
static void SendContainer() noexcept;
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ public:
|
|||
{"OnObjectDelete", Function<void, unsigned short, const char*>()},
|
||||
{"OnObjectScale", Function<void, unsigned short, const char*>()},
|
||||
{"OnObjectLock", Function<void, unsigned short, const char*>()},
|
||||
{"OnObjectUnlock", Function<void, unsigned short, const char*>()},
|
||||
{"OnDoorState", Function<void, unsigned short, const char*>()},
|
||||
{"OnContainer", Function<void, unsigned short, const char*>()},
|
||||
{"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()},
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 03.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSOROBJECTUNLOCK_HPP
|
||||
#define OPENMW_PROCESSOROBJECTUNLOCK_HPP
|
||||
|
||||
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorObjectUnlock : public WorldProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorObjectUnlock()
|
||||
{
|
||||
BPP_INIT(ID_OBJECT_UNLOCK)
|
||||
}
|
||||
|
||||
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
||||
|
||||
packet.Send(true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnObjectUnlock")>(player.getId(), event.cell.getDescription().c_str());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSOROBJECTUNLOCK_HPP
|
|
@ -116,7 +116,7 @@ add_openmw_dir (mwmp\\processors\\player ProcessorChatMessage ProcessorGameConso
|
|||
|
||||
add_openmw_dir (mwmp\\processors\\world BaseObjectProcessor ProcessorContainer ProcessorDoorState ProcessorMusicPlay
|
||||
ProcessorObjectAnimPlay ProcessorObjectDelete ProcessorObjectLock ProcessorObjectMove ProcessorObjectPlace
|
||||
ProcessorObjectRotate ProcessorObjectScale ProcessorObjectUnlock ProcessorScriptGlobalShort ProcessorScriptLocalFloat
|
||||
ProcessorObjectRotate ProcessorObjectScale ProcessorScriptGlobalShort ProcessorScriptLocalFloat
|
||||
ProcessorScriptLocalShort ProcessorScriptMemberShort ProcessorVideoPlay
|
||||
)
|
||||
|
||||
|
|
|
@ -69,12 +69,12 @@ namespace MWMechanics
|
|||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_OBJECT_UNLOCK packet every time an object is unlocked
|
||||
Send an ID_OBJECT_LOCK packet every time an object is unlocked
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectUnlock(lock);
|
||||
worldEvent->sendObjectUnlock();
|
||||
worldEvent->addObjectLock(lock, 0);
|
||||
worldEvent->sendObjectLock();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -45,11 +45,10 @@
|
|||
#include "processors/world/ProcessorObjectPlace.hpp"
|
||||
#include "processors/world/ProcessorObjectRotate.hpp"
|
||||
#include "processors/world/ProcessorObjectScale.hpp"
|
||||
#include "processors/world/ProcessorObjectUnlock.hpp"
|
||||
#include "processors/world/ProcessorScriptGlobalShort.hpp"
|
||||
#include "processors/world/ProcessorScriptLocalFloat.hpp"
|
||||
#include "processors/world/ProcessorScriptLocalShort.hpp"
|
||||
#include "processors/world/ProcessorScriptLocalFloat.hpp"
|
||||
#include "processors/world/ProcessorScriptMemberShort.hpp"
|
||||
#include "processors/world/ProcessorScriptGlobalShort.hpp"
|
||||
#include "processors/world/ProcessorVideoPlay.hpp"
|
||||
|
||||
#include "processors/actor/ProcessorActorAnimFlags.hpp"
|
||||
|
@ -106,11 +105,10 @@ void ProcessorInitializer()
|
|||
WorldProcessor::AddProcessor(new ProcessorObjectPlace());
|
||||
WorldProcessor::AddProcessor(new ProcessorObjectRotate());
|
||||
WorldProcessor::AddProcessor(new ProcessorObjectScale());
|
||||
WorldProcessor::AddProcessor(new ProcessorObjectUnlock());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptGlobalShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptLocalFloat());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptLocalShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptLocalFloat());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptMemberShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorScriptGlobalShort());
|
||||
WorldProcessor::AddProcessor(new ProcessorVideoPlay());
|
||||
|
||||
ActorProcessor::AddProcessor(new ProcessorActorAnimFlags());
|
||||
|
|
|
@ -199,29 +199,10 @@ void WorldEvent::lockObjects(MWWorld::CellStore* cellStore)
|
|||
LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum());
|
||||
|
||||
ptrFound.getClass().lock(ptrFound, worldObject.lockLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WorldEvent::unlockObjects(MWWorld::CellStore* cellStore)
|
||||
{
|
||||
WorldObject worldObject;
|
||||
|
||||
for (unsigned int i = 0; i < worldObjectCount; i++)
|
||||
{
|
||||
worldObject = worldObjects.at(i);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
|
||||
|
||||
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||
|
||||
if (ptrFound)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum());
|
||||
|
||||
ptrFound.getClass().unlock(ptrFound);
|
||||
if (worldObject.lockLevel > 0)
|
||||
ptrFound.getClass().lock(ptrFound, worldObject.lockLevel);
|
||||
else
|
||||
ptrFound.getClass().unlock(ptrFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -509,17 +490,6 @@ void WorldEvent::addObjectLock(const MWWorld::Ptr& ptr, int lockLevel)
|
|||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectUnlock(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectScale(const MWWorld::Ptr& ptr, float scale)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
@ -643,12 +613,6 @@ void WorldEvent::sendObjectLock()
|
|||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectUnlock()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectScale()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->setEvent(this);
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace mwmp
|
|||
void placeObjects(MWWorld::CellStore* cellStore);
|
||||
void deleteObjects(MWWorld::CellStore* cellStore);
|
||||
void lockObjects(MWWorld::CellStore* cellStore);
|
||||
void unlockObjects(MWWorld::CellStore* cellStore);
|
||||
void scaleObjects(MWWorld::CellStore* cellStore);
|
||||
void moveObjects(MWWorld::CellStore* cellStore);
|
||||
void rotateObjects(MWWorld::CellStore* cellStore);
|
||||
|
@ -41,7 +40,6 @@ namespace mwmp
|
|||
void addObjectPlace(const MWWorld::Ptr& ptr);
|
||||
void addObjectDelete(const MWWorld::Ptr& ptr);
|
||||
void addObjectLock(const MWWorld::Ptr& ptr, int lockLevel);
|
||||
void addObjectUnlock(const MWWorld::Ptr& ptr);
|
||||
void addObjectScale(const MWWorld::Ptr& ptr, float scale);
|
||||
void addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode);
|
||||
void addDoorState(const MWWorld::Ptr& ptr, int state);
|
||||
|
@ -55,7 +53,6 @@ namespace mwmp
|
|||
void sendObjectPlace();
|
||||
void sendObjectDelete();
|
||||
void sendObjectLock();
|
||||
void sendObjectUnlock();
|
||||
void sendObjectScale();
|
||||
void sendObjectAnimPlay();
|
||||
void sendDoorState();
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 18.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSOROBJECTUNLOCK_HPP
|
||||
#define OPENMW_PROCESSOROBJECTUNLOCK_HPP
|
||||
|
||||
|
||||
#include "BaseObjectProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorObjectUnlock : public BaseObjectProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorObjectUnlock()
|
||||
{
|
||||
BPP_INIT(ID_OBJECT_UNLOCK)
|
||||
}
|
||||
|
||||
virtual void Do(WorldPacket &packet, WorldEvent &event)
|
||||
{
|
||||
BaseObjectProcessor::Do(packet, event);
|
||||
|
||||
event.unlockObjects(ptrCellStore);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSOROBJECTUNLOCK_HPP
|
|
@ -252,13 +252,13 @@ namespace MWScript
|
|||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_OBJECT_UNLOCK packet every time an object is unlocked
|
||||
Send an ID_OBJECT_LOCK packet every time an object is unlocked
|
||||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectUnlock(ptr);
|
||||
worldEvent->sendObjectUnlock();
|
||||
worldEvent->addObjectLock(ptr, 0);
|
||||
worldEvent->sendObjectLock();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -184,9 +184,9 @@ add_component_dir (openmw-mp\\Packets\\Player
|
|||
|
||||
add_component_dir (openmw-mp\\Packets\\World
|
||||
WorldPacket
|
||||
PacketObjectDelete PacketObjectPlace PacketObjectScale PacketObjectLock PacketObjectUnlock PacketObjectMove
|
||||
PacketObjectRotate PacketObjectAnimPlay PacketContainer PacketDoorState PacketMusicPlay PacketVideoPlay
|
||||
PacketScriptLocalShort PacketScriptLocalFloat PacketScriptMemberShort PacketScriptGlobalShort
|
||||
PacketObjectDelete PacketObjectPlace PacketObjectScale PacketObjectLock PacketObjectMove PacketObjectRotate
|
||||
PacketObjectAnimPlay PacketContainer PacketDoorState PacketMusicPlay PacketVideoPlay PacketScriptLocalShort
|
||||
PacketScriptLocalFloat PacketScriptMemberShort PacketScriptGlobalShort
|
||||
)
|
||||
|
||||
add_component_dir (fallback
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "../Packets/World/PacketObjectPlace.hpp"
|
||||
#include "../Packets/World/PacketObjectScale.hpp"
|
||||
#include "../Packets/World/PacketObjectLock.hpp"
|
||||
#include "../Packets/World/PacketObjectUnlock.hpp"
|
||||
#include "../Packets/World/PacketObjectMove.hpp"
|
||||
#include "../Packets/World/PacketObjectRotate.hpp"
|
||||
#include "../Packets/World/PacketObjectAnimPlay.hpp"
|
||||
|
@ -37,7 +36,6 @@ mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *pee
|
|||
AddPacket<PacketObjectPlace>(&packets, peer);
|
||||
AddPacket<PacketObjectScale>(&packets, peer);
|
||||
AddPacket<PacketObjectLock>(&packets, peer);
|
||||
AddPacket<PacketObjectUnlock>(&packets, peer);
|
||||
AddPacket<PacketObjectMove>(&packets, peer);
|
||||
AddPacket<PacketObjectRotate>(&packets, peer);
|
||||
AddPacket<PacketObjectAnimPlay>(&packets, peer);
|
||||
|
|
|
@ -57,7 +57,6 @@ enum GameMessages
|
|||
ID_OBJECT_DELETE,
|
||||
ID_OBJECT_SCALE,
|
||||
ID_OBJECT_LOCK,
|
||||
ID_OBJECT_UNLOCK,
|
||||
ID_OBJECT_MOVE,
|
||||
ID_OBJECT_ROTATE,
|
||||
ID_OBJECT_ANIM_PLAY,
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketObjectUnlock.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketObjectUnlock::PacketObjectUnlock(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||
{
|
||||
packetID = ID_OBJECT_UNLOCK;
|
||||
}
|
||||
|
||||
void PacketObjectUnlock::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, send);
|
||||
|
||||
if (!send)
|
||||
event->worldObjects.clear();
|
||||
else
|
||||
event->worldObjectCount = (unsigned int)(event->worldObjects.size());
|
||||
|
||||
RW(event->worldObjectCount, send);
|
||||
|
||||
RW(event->cell.mData.mFlags, send);
|
||||
RW(event->cell.mData.mX, send);
|
||||
RW(event->cell.mData.mY, send);
|
||||
RW(event->cell.mName, send);
|
||||
|
||||
WorldObject worldObject;
|
||||
|
||||
for (unsigned int i = 0; i < event->worldObjectCount; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
worldObject = event->worldObjects.at(i);
|
||||
}
|
||||
|
||||
RW(worldObject.refId, send);
|
||||
RW(worldObject.refNumIndex, send);
|
||||
RW(worldObject.mpNum, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
event->worldObjects.push_back(worldObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef OPENMW_PACKETOBJECTUNLOCK_HPP
|
||||
#define OPENMW_PACKETOBJECTUNLOCK_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketObjectUnlock : public WorldPacket
|
||||
{
|
||||
public:
|
||||
PacketObjectUnlock(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETOBJECTUNLOCK_HPP
|
Loading…
Reference in a new issue