mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 18:06:43 +00:00
[Server] Add script functions for getting player draw & sneak states
This commit is contained in:
parent
8c40010c87
commit
6498bcb22b
2 changed files with 37 additions and 0 deletions
|
@ -129,6 +129,23 @@ const char *MechanicsFunctions::GetSelectedSpellId(unsigned short pid) noexcept
|
||||||
return player->selectedSpellId.c_str();
|
return player->selectedSpellId.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int MechanicsFunctions::GetDrawState(unsigned short pid) noexcept
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, false);
|
||||||
|
|
||||||
|
return player->drawState;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MechanicsFunctions::GetSneakState(unsigned short pid) noexcept
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, false);
|
||||||
|
|
||||||
|
// TODO: Avoid having to use a magic number here
|
||||||
|
return (player->movementFlags & 8) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void MechanicsFunctions::SetMarkCell(unsigned short pid, const char *cellDescription) noexcept
|
void MechanicsFunctions::SetMarkCell(unsigned short pid, const char *cellDescription) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
{"GetPlayerKillerMpNum", MechanicsFunctions::GetPlayerKillerMpNum},\
|
{"GetPlayerKillerMpNum", MechanicsFunctions::GetPlayerKillerMpNum},\
|
||||||
{"GetPlayerKillerName", MechanicsFunctions::GetPlayerKillerName},\
|
{"GetPlayerKillerName", MechanicsFunctions::GetPlayerKillerName},\
|
||||||
\
|
\
|
||||||
|
{"GetDrawState", MechanicsFunctions::GetDrawState},\
|
||||||
|
{"GetSneakState", MechanicsFunctions::GetSneakState},\
|
||||||
|
\
|
||||||
{"SetMarkCell", MechanicsFunctions::SetMarkCell},\
|
{"SetMarkCell", MechanicsFunctions::SetMarkCell},\
|
||||||
{"SetMarkPos", MechanicsFunctions::SetMarkPos},\
|
{"SetMarkPos", MechanicsFunctions::SetMarkPos},\
|
||||||
{"SetMarkRot", MechanicsFunctions::SetMarkRot},\
|
{"SetMarkRot", MechanicsFunctions::SetMarkRot},\
|
||||||
|
@ -151,6 +154,23 @@ public:
|
||||||
*/
|
*/
|
||||||
static const char *GetPlayerKillerName(unsigned short pid) noexcept;
|
static const char *GetPlayerKillerName(unsigned short pid) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the draw state of a player (0 for nothing, 1 for drawn weapon,
|
||||||
|
* 2 for drawn spell).
|
||||||
|
*
|
||||||
|
* \param pid The player ID.
|
||||||
|
* \return The draw state.
|
||||||
|
*/
|
||||||
|
static unsigned int GetDrawState(unsigned short pid) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the sneak state of a player.
|
||||||
|
*
|
||||||
|
* \param pid The player ID.
|
||||||
|
* \return Whether the player is sneaking.
|
||||||
|
*/
|
||||||
|
static bool GetSneakState(unsigned short pid) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the Mark cell of a player.
|
* \brief Set the Mark cell of a player.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue