From 50584792fc4b348d755f5725b29d2f763068e703 Mon Sep 17 00:00:00 2001 From: Aldori Date: Sun, 1 Mar 2026 07:31:36 -0500 Subject: [PATCH] feat(PlayerMethods): Add IsBot() method (#360) --- src/LuaEngine/LuaFunctions.cpp | 1 + src/LuaEngine/methods/PlayerMethods.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index c029fd3..dd305fc 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -708,6 +708,7 @@ ALERegister PlayerMethods[] = { "CanTeleport", &LuaPlayer::CanTeleport }, { "IsSpectator", &LuaPlayer::IsSpectator }, { "HasKnownTaxiNode", &LuaPlayer::HasKnownTaxiNode }, + { "IsBot", &LuaPlayer::IsBot }, // { "HasSpellMod", &LuaPlayer::HasSpellMod }, // Gossip diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 1e94d19..b3bb308 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -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