feat(PlayerMethods): Add IsBot() method (#360)

This commit is contained in:
Aldori
2026-03-01 07:31:36 -05:00
committed by GitHub
parent fe47a5d9c3
commit 50584792fc
2 changed files with 17 additions and 0 deletions

View File

@@ -708,6 +708,7 @@ ALERegister<Player> PlayerMethods[] =
{ "CanTeleport", &LuaPlayer::CanTeleport },
{ "IsSpectator", &LuaPlayer::IsSpectator },
{ "HasKnownTaxiNode", &LuaPlayer::HasKnownTaxiNode },
{ "IsBot", &LuaPlayer::IsBot },
// { "HasSpellMod", &LuaPlayer::HasSpellMod },
// Gossip

View File

@@ -5009,6 +5009,22 @@ namespace LuaPlayer
ALE::Push(L, player->m_taxi.IsTaximaskNodeKnown(nodeId));
return 1;
}
/**
* Returns `true` if the [Player] is a Playerbot/RNDBot, `false` otherwise.
*
* @return bool isBot
*/
int IsBot(lua_State* L, Player* player)
{
#if defined(MOD_PLAYERBOTS)
ALE::Push(L, player->GetSession()->IsBot());
#else
(void)player;
ALE::Push(L, false);
#endif
return 1;
}
};
#endif