1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-07-13 02:21:42 +00:00

[Client] Always send attack starts by actors immediately

Previously, creatures with fast attack animations would have their attack updated right after being started, which happened so quickly that it prevented the attack start from actually being sent by the client.
This commit is contained in:
David Cernat 2019-11-30 15:50:05 +02:00
parent ed7fe859dd
commit 64c94346b6
3 changed files with 18 additions and 1 deletions

View file

@ -11,6 +11,8 @@
*/
#include <components/openmw-mp/TimedLog.hpp>
#include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp"
#include "../mwmp/ActorList.hpp"
#include "../mwmp/MechanicsHelper.hpp"
#include "../mwgui/windowmanagerimp.hpp"
/*
@ -625,7 +627,12 @@ namespace MWMechanics
localAttack->type = distantCombat ? mwmp::Attack::RANGED : mwmp::Attack::MELEE;
localAttack->attackAnimation = characterController.getAttackType();
localAttack->pressed = true;
localAttack->shouldSend = true;
mwmp::ActorList *actorList = mwmp::Main::get().getNetworking()->getActorList();
actorList->reset();
actorList->cell = *actor.getCell()->getCell();
actorList->addAttackActor(actor, *localAttack);
actorList->sendAttackActors();
}
/*
End of tes3mp addition

View file

@ -119,6 +119,15 @@ void ActorList::addAttackActor(BaseActor baseActor)
attackActors.push_back(baseActor);
}
void ActorList::addAttackActor(const MWWorld::Ptr& actorPtr, const mwmp::Attack &attack)
{
mwmp::BaseActor baseActor;
baseActor.refNum = actorPtr.getCellRef().getRefNum().mIndex;
baseActor.mpNum = actorPtr.getCellRef().getMpNum();
baseActor.attack = attack;
attackActors.push_back(baseActor);
}
void ActorList::addCastActor(BaseActor baseActor)
{
castActors.push_back(baseActor);

View file

@ -30,6 +30,7 @@ namespace mwmp
void addAiActor(BaseActor baseActor);
void addAiActor(const MWWorld::Ptr& actorPtr, const MWWorld::Ptr& targetPtr, unsigned int aiAction);
void addAttackActor(BaseActor baseActor);
void addAttackActor(const MWWorld::Ptr& actorPtr, const mwmp::Attack &attack);
void addCastActor(BaseActor baseActor);
void addCellChangeActor(BaseActor baseActor);