mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
[Client] Initialize Actors based on the guid of an ActorAuthority packet
This commit is contained in:
parent
e01cadad23
commit
34e77c5dae
1 changed files with 20 additions and 3 deletions
|
@ -22,13 +22,30 @@ namespace mwmp
|
|||
|
||||
virtual void Do(ActorPacket &packet, ActorList &actorList)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str());
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str());
|
||||
|
||||
// Never initialize LocalActors in a cell that is no longer loaded, if the server's packet arrived too late
|
||||
if (mwmp::Main::get().getCellController()->isActiveWorldCell(actorList.cell))
|
||||
{
|
||||
Main::get().getCellController()->initializeLocalActors(actorList.cell);
|
||||
Main::get().getCellController()->getCell(actorList.cell)->updateLocal(true);
|
||||
if (isLocal())
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- The new authority is me");
|
||||
Main::get().getCellController()->initializeLocalActors(actorList.cell);
|
||||
Main::get().getCellController()->getCell(actorList.cell)->updateLocal(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
BasePlayer *player = PlayerList::getPlayer(guid);
|
||||
|
||||
if (player != 0)
|
||||
LOG_APPEND(Log::LOG_INFO, "- The new authority is %s", player->npc.mName.c_str());
|
||||
|
||||
Main::get().getCellController()->getCell(actorList.cell)->uninitializeLocalActors();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Ignoring it because that cell isn't loaded");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue