From 5baef09f79cab24fc38ddc190e588ea85bbd7d75 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 10 Jul 2018 02:47:52 +0300 Subject: [PATCH] [General] Implement ActorAI packet, part 2 The server can now make actors start combat with players or other actors. --- apps/openmw/mwmp/DedicatedActor.cpp | 8 ++++++-- components/openmw-mp/Base/BaseActor.hpp | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmp/DedicatedActor.cpp b/apps/openmw/mwmp/DedicatedActor.cpp index 663baa21b..263ebadf1 100644 --- a/apps/openmw/mwmp/DedicatedActor.cpp +++ b/apps/openmw/mwmp/DedicatedActor.cpp @@ -6,6 +6,7 @@ #include "../mwdialogue/dialoguemanagerimp.hpp" +#include "../mwmechanics/aicombat.hpp" #include "../mwmechanics/aifollow.hpp" #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/mechanicsmanagerimp.hpp" @@ -240,14 +241,17 @@ void DedicatedActor::setAI() if (targetPtr) { - - if (aiAction == mwmp::BaseActorList::FOLLOW) { MWMechanics::AiFollow package(targetPtr); package.allowAnyDistance(true); ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(package, ptr, true); } + else if (aiAction == mwmp::BaseActorList::COMBAT) + { + MWMechanics::AiCombat package(targetPtr); + ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(package, ptr, true); + } } } } diff --git a/components/openmw-mp/Base/BaseActor.hpp b/components/openmw-mp/Base/BaseActor.hpp index d41cfbdb4..429ee6fed 100644 --- a/components/openmw-mp/Base/BaseActor.hpp +++ b/components/openmw-mp/Base/BaseActor.hpp @@ -70,7 +70,8 @@ namespace mwmp enum AI_ACTION { - FOLLOW = 0 + FOLLOW = 0, + COMBAT = 1 }; RakNet::RakNetGUID guid;