From 837c5369c0728b939972ce6303038e246bb540a3 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 13 Jul 2018 01:05:27 +0300 Subject: [PATCH] [Server] Add OnActorAI event and remove autosync for ActorAI packets --- apps/openmw-mp/CMakeLists.txt | 13 +++++++------ apps/openmw-mp/Script/ScriptFunctions.hpp | 1 + .../openmw-mp/processors/actor/ProcessorActorAI.hpp | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index d75f6abbb..84875de98 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -85,12 +85,13 @@ set(SERVER_HEADER source_group(tes3mp-server FILES ${SERVER} ${SERVER_HEADER}) set(PROCESSORS_ACTOR - processors/actor/ProcessorActorAnimFlags.hpp processors/actor/ProcessorActorAnimPlay.hpp - processors/actor/ProcessorActorAttack.hpp processors/actor/ProcessorActorCellChange.hpp - processors/actor/ProcessorActorDeath.hpp processors/actor/ProcessorActorEquipment.hpp - processors/actor/ProcessorActorInteraction.hpp processors/actor/ProcessorActorList.hpp - processors/actor/ProcessorActorPosition.hpp processors/actor/ProcessorActorSpeech.hpp - processors/actor/ProcessorActorStatsDynamic.hpp processors/actor/ProcessorActorTest.hpp + processors/actor/ProcessorActorAI.hpp processors/actor/ProcessorActorAnimFlags.hpp + processors/actor/ProcessorActorAnimPlay.hpp processors/actor/ProcessorActorAttack.hpp + processors/actor/ProcessorActorCellChange.hpp processors/actor/ProcessorActorDeath.hpp + processors/actor/ProcessorActorEquipment.hpp processors/actor/ProcessorActorInteraction.hpp + processors/actor/ProcessorActorList.hpp processors/actor/ProcessorActorPosition.hpp + processors/actor/ProcessorActorSpeech.hpp processors/actor/ProcessorActorStatsDynamic.hpp + processors/actor/ProcessorActorTest.hpp ) source_group(tes3mp-server\\processors\\actor FILES ${PROCESSORS_ACTOR}) diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index 5a1da5a44..b32fd5201 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -192,6 +192,7 @@ public: {"OnVideoPlay", Function()}, {"OnActorList", Function()}, {"OnActorEquipment", Function()}, + {"OnActorAI", Function()}, {"OnActorDeath", Function()}, {"OnActorCellChange", Function()}, {"OnActorTest", Function()}, diff --git a/apps/openmw-mp/processors/actor/ProcessorActorAI.hpp b/apps/openmw-mp/processors/actor/ProcessorActorAI.hpp index 3fd5861f6..fee88768a 100644 --- a/apps/openmw-mp/processors/actor/ProcessorActorAI.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorAI.hpp @@ -15,11 +15,12 @@ namespace mwmp void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override { - // Send only to players who have the cell loaded Cell *serverCell = CellController::get()->getCell(&actorList.cell); - if (serverCell != nullptr && *serverCell->getAuthority() == actorList.guid) - serverCell->sendToLoaded(&packet, &actorList); + if (serverCell != nullptr) + { + Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } } }; }