mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 11:09:40 +00:00
[Server] Bring Actor functions in line with Object functions, part 2
The ActorPacket-sending functions now have sendToOtherVisitors and skipAttachedPlayer arguments, except for the ones for ActorList and ActorAuthority (because such arguments don't make sense for those).
This commit is contained in:
parent
837c5369c0
commit
aeb2e57444
2 changed files with 97 additions and 35 deletions
|
@ -402,32 +402,13 @@ void ActorFunctions::SendActorAuthority() noexcept
|
|||
}
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorPosition() noexcept
|
||||
void ActorFunctions::SendActorPosition(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_POSITION);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorStatsDynamic() noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_STATS_DYNAMIC);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorEquipment() noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_EQUIPMENT);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorAI(bool sendToOtherVisitors) noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AI);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
if (!skipAttachedPlayer)
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
|
||||
if (sendToOtherVisitors)
|
||||
{
|
||||
|
@ -435,17 +416,85 @@ void ActorFunctions::SendActorAI(bool sendToOtherVisitors) noexcept
|
|||
|
||||
if (serverCell != nullptr)
|
||||
{
|
||||
// Also send this to everyone else who has the cell loaded
|
||||
serverCell->sendToLoaded(actorPacket, &writeActorList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorCellChange() noexcept
|
||||
void ActorFunctions::SendActorStatsDynamic(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_STATS_DYNAMIC);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
|
||||
if (sendToOtherVisitors)
|
||||
{
|
||||
Cell *serverCell = CellController::get()->getCell(&writeActorList.cell);
|
||||
|
||||
if (serverCell != nullptr)
|
||||
{
|
||||
serverCell->sendToLoaded(actorPacket, &writeActorList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorEquipment(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_EQUIPMENT);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
|
||||
if (sendToOtherVisitors)
|
||||
{
|
||||
Cell *serverCell = CellController::get()->getCell(&writeActorList.cell);
|
||||
|
||||
if (serverCell != nullptr)
|
||||
{
|
||||
serverCell->sendToLoaded(actorPacket, &writeActorList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorAI(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AI);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
|
||||
if (sendToOtherVisitors)
|
||||
{
|
||||
Cell *serverCell = CellController::get()->getCell(&writeActorList.cell);
|
||||
|
||||
if (serverCell != nullptr)
|
||||
{
|
||||
serverCell->sendToLoaded(actorPacket, &writeActorList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorFunctions::SendActorCellChange(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_CELL_CHANGE);
|
||||
actorPacket->setActorList(&writeActorList);
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
actorPacket->Send(writeActorList.guid);
|
||||
|
||||
if (sendToOtherVisitors)
|
||||
{
|
||||
Cell *serverCell = CellController::get()->getCell(&writeActorList.cell);
|
||||
|
||||
if (serverCell != nullptr)
|
||||
{
|
||||
serverCell->sendToLoaded(actorPacket, &writeActorList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All methods below are deprecated versions of methods from above
|
||||
|
|
|
@ -682,48 +682,61 @@ public:
|
|||
/**
|
||||
* \brief Send an ActorPosition packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current actor list was initialized.
|
||||
* \param sendToOtherVisitors Whether this packet should be sent to cell visitors 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 SendActorPosition() noexcept;
|
||||
static void SendActorPosition(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ActorStatsDynamic packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current actor list was initialized.
|
||||
* \param sendToOtherVisitors Whether this packet should be sent to cell visitors 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 SendActorStatsDynamic() noexcept;
|
||||
static void SendActorStatsDynamic(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ActorEquipment packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current actor list was initialized.
|
||||
* \param sendToOtherVisitors Whether this packet should be sent to cell visitors 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 SendActorEquipment() noexcept;
|
||||
static void SendActorEquipment(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ActorAI packet.
|
||||
*
|
||||
* \param sendToOtherVisitors Whether this packet should be sent to cell visitors 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 SendActorAI(bool sendToOtherVisitors) noexcept;
|
||||
static void SendActorAI(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ActorCellChange packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current actor list was initialized.
|
||||
* \param sendToOtherVisitors Whether this packet should be sent to cell visitors 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 SendActorCellChange() noexcept;
|
||||
static void SendActorCellChange(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
|
||||
// All methods below are deprecated versions of methods from above
|
||||
|
|
Loading…
Reference in a new issue