Added new script functions for lua compatibility

GetPosX, GetPosY, GetPosZ
GetAngleX, GetAngleY, GetAngleZ
coverity_scan^2
Stanislav Zhukov 9 years ago
parent ce92f30022
commit 645a21af21

@ -24,6 +24,30 @@ void ScriptFunctions::GetPos(unsigned short pid, float *x, float *y, float *z) n
*z = player->Position()->pos[2];
}
double ScriptFunctions::GetPosX(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->pos[0];
}
double ScriptFunctions::GetPosY(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->pos[1];
}
double ScriptFunctions::GetPosZ(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->pos[2];
}
void ScriptFunctions::SetPos(unsigned short pid, float x, float y, float z) noexcept
{
Player *player;
@ -92,6 +116,30 @@ void ScriptFunctions::GetAngle(unsigned short pid, float *x, float *y, float *z)
*z = player->Position()->rot[2];
}
double ScriptFunctions::GetAngleX(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[0];
}
double ScriptFunctions::GetAngleY(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[1];
}
double ScriptFunctions::GetAngleZ(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[2];
}
void ScriptFunctions::SetAngle(unsigned short pid, float x, float y, float z) noexcept
{
Player *player;

@ -33,10 +33,16 @@ public:
static boost::any CallPublic(const char *name, ...) noexcept;
static void GetPos(unsigned short pid, float *x, float *y, float *z) noexcept;
static double GetPosX(unsigned short pid) noexcept;
static double GetPosY(unsigned short pid) noexcept;
static double GetPosZ(unsigned short pid) noexcept;
static void SetPos(unsigned short pid, float x, float y, float z) noexcept;
static void GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept;
static double GetAngleX(unsigned short pid) noexcept;
static double GetAngleY(unsigned short pid) noexcept;
static double GetAngleZ(unsigned short pid) noexcept;
static void SetAngle(unsigned short pid, float x, float y, float z) noexcept;
static void SetCell(unsigned short pid, const char *name) noexcept;
@ -139,9 +145,15 @@ public:
{"StopServer", ScriptFunctions::StopServer},
{"GetPos", ScriptFunctions::GetPos},
{"GetPosX", ScriptFunctions::GetPosX},
{"GetPosY", ScriptFunctions::GetPosY},
{"GetPosZ", ScriptFunctions::GetPosZ},
{"SetPos", ScriptFunctions::SetPos},
{"GetAngle", ScriptFunctions::GetAngle},
{"GetAngleX", ScriptFunctions::GetAngleX},
{"GetAngleY", ScriptFunctions::GetAngleY},
{"GetAngleZ", ScriptFunctions::GetAngleZ},
{"SetAngle", ScriptFunctions::SetAngle},
{"GetCell", ScriptFunctions::GetCell},

Loading…
Cancel
Save