[Server] Add script functions that send ObjectMove/ObjectRotate packets

pull/593/head
David Cernat 4 years ago
parent 3222afc8b7
commit d4f2686556

@ -844,6 +844,28 @@ void ObjectFunctions::SendObjectState(bool sendToOtherPlayers, bool skipAttached
packet->Send(true);
}
void ObjectFunctions::SendObjectMove(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
{
mwmp::ObjectPacket* packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_MOVE);
packet->setObjectList(&writeObjectList);
if (!skipAttachedPlayer)
packet->Send(false);
if (sendToOtherPlayers)
packet->Send(true);
}
void ObjectFunctions::SendObjectRotate(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
{
mwmp::ObjectPacket* packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_ROTATE);
packet->setObjectList(&writeObjectList);
if (!skipAttachedPlayer)
packet->Send(false);
if (sendToOtherPlayers)
packet->Send(true);
}
void ObjectFunctions::SendDoorState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
{
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_STATE);

@ -161,6 +161,8 @@
{"SendObjectScale", ObjectFunctions::SendObjectScale},\
{"SendObjectSound", ObjectFunctions::SendObjectSound},\
{"SendObjectState", ObjectFunctions::SendObjectState},\
{"SendObjectMove", ObjectFunctions::SendObjectMove},\
{"SendObjectRotate", ObjectFunctions::SendObjectRotate},\
{"SendDoorState", ObjectFunctions::SendDoorState},\
{"SendDoorDestination", ObjectFunctions::SendDoorDestination},\
{"SendContainer", ObjectFunctions::SendContainer},\
@ -1445,6 +1447,28 @@ public:
*/
static void SendObjectState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
/**
* \brief Send an ObjectMove packet.
*
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
* player attached to the packet (false by default).
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
* to the packet (false by default).
* \return void
*/
static void SendObjectMove(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
/**
* \brief Send an ObjectRotate packet.
*
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
* player attached to the packet (false by default).
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
* to the packet (false by default).
* \return void
*/
static void SendObjectRotate(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
/**
* \brief Send a DoorState packet.
*

Loading…
Cancel
Save