[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.
pull/556/head
David Cernat 5 years ago
parent ed7fe859dd
commit 64c94346b6

@ -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

@ -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);

@ -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);

Loading…
Cancel
Save