Send ID_OBJECT_ANIM_PLAY from ingame scripts

This commit is contained in:
David Cernat 2016-10-27 16:46:47 +03:00
parent 46397a7dac
commit e414261121

View file

@ -3,6 +3,10 @@
#include <stdexcept>
#include <limits>
#include <components/openmw-mp/Base/WorldEvent.hpp>
#include "../mwmp/Main.hpp"
#include "../mwworld/cellstore.hpp"
#include <components/compiler/extensions.hpp>
#include <components/compiler/opcodes.hpp>
@ -56,6 +60,15 @@ namespace MWScript
throw std::runtime_error ("animation mode out of range");
}
// Added by tes3mp
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
event->cell = *ptr.getCell()->getCell();
event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->animGroup = group;
event->animMode = mode;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_ANIM_PLAY)->Send(event);
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, std::numeric_limits<int>::max(), true);
}
};