[Server] Add script functions for setting actor cells and positions

0.6.1
David Cernat 8 years ago
parent 9c5eb47e90
commit a71dbc7d09

@ -95,6 +95,11 @@ void ActorFunctions::SetScriptActorListAction(unsigned char action) noexcept
scriptActorList.action = action;
}
void ActorFunctions::SetActorCell(const char* cellDescription) noexcept
{
tempActor.cell = Utils::getCellFromDescription(cellDescription);
}
void ActorFunctions::SetActorRefId(const char* refId) noexcept
{
tempActor.refId = refId;
@ -110,6 +115,20 @@ void ActorFunctions::SetActorMpNum(int mpNum) noexcept
tempActor.mpNum = mpNum;
}
void ActorFunctions::SetActorPosition(double x, double y, double z) noexcept
{
tempActor.position.pos[0] = x;
tempActor.position.pos[1] = y;
tempActor.position.pos[2] = z;
}
void ActorFunctions::SetActorRotation(double x, double y, double z) noexcept
{
tempActor.position.rot[0] = x;
tempActor.position.rot[1] = y;
tempActor.position.rot[2] = z;
}
void ActorFunctions::AddActor() noexcept
{
scriptActorList.baseActors.push_back(tempActor);
@ -129,3 +148,9 @@ void ActorFunctions::SendActorAuthority() noexcept
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->Send(scriptActorList.guid);
}
void ActorFunctions::SendActorCellChange() noexcept
{
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_CELL_CHANGE)->setActorList(&scriptActorList);
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_CELL_CHANGE)->Send(scriptActorList.guid);
}

@ -21,14 +21,18 @@
{"SetScriptActorListCell", ActorFunctions::SetScriptActorListCell},\
{"SetScriptActorListAction", ActorFunctions::SetScriptActorListAction},\
\
{"SetActorCell", ActorFunctions::SetActorCell},\
{"SetActorRefId", ActorFunctions::SetActorRefId},\
{"SetActorRefNumIndex", ActorFunctions::SetActorRefNumIndex},\
{"SetActorMpNum", ActorFunctions::SetActorMpNum},\
{"SetActorPosition", ActorFunctions::SetActorPosition},\
{"SetActorRotation", ActorFunctions::SetActorRotation},\
\
{"AddActor", ActorFunctions::AddActor},\
\
{"SendActorList", ActorFunctions::SendActorList},\
{"SendActorAuthority", ActorFunctions::SendActorAuthority}
{"SendActorAuthority", ActorFunctions::SendActorAuthority},\
{"SendActorCellChange", ActorFunctions::SendActorCellChange}
class ActorFunctions
{
@ -53,14 +57,18 @@ public:
static void SetScriptActorListCell(const char* cellDescription) noexcept;
static void SetScriptActorListAction(unsigned char action) noexcept;
static void SetActorCell(const char* cellDescription) noexcept;
static void SetActorRefId(const char* refId) noexcept;
static void SetActorRefNumIndex(int refNumIndex) noexcept;
static void SetActorMpNum(int mpNum) noexcept;
static void SetActorPosition(double x, double y, double z) noexcept;
static void SetActorRotation(double x, double y, double z) noexcept;
static void AddActor() noexcept;
static void SendActorList() noexcept;
static void SendActorAuthority() noexcept;
static void SendActorCellChange() noexcept;
};

Loading…
Cancel
Save