1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 01:45:33 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Actor/PacketActorAI.cpp
David Cernat 77389538e8 [General] Implement ActorAI packet, part 1
The server can now make actors become followers of players or other actors.
2018-05-12 06:29:11 +03:00

32 lines
739 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#include "PacketActorAI.hpp"
using namespace mwmp;
PacketActorAI::PacketActorAI(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
{
packetID = ID_ACTOR_AI;
}
void PacketActorAI::Actor(BaseActor &actor, bool send)
{
RW(actor.aiAction, send);
RW(actor.hasAiTarget, send);
if (actor.hasAiTarget)
{
RW(actor.aiTarget.isPlayer, send);
if (actor.aiTarget.isPlayer)
{
RW(actor.aiTarget.guid, send);
}
else
{
RW(actor.aiTarget.refId, send, 1);
RW(actor.aiTarget.refNumIndex, send);
RW(actor.aiTarget.mpNum, send);
}
}
}