mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Added new script functions for lua compatibility
GetPosX, GetPosY, GetPosZ GetAngleX, GetAngleY, GetAngleZ
This commit is contained in:
parent
ce92f30022
commit
645a21af21
2 changed files with 60 additions and 0 deletions
|
@ -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…
Reference in a new issue