From 012f20deec35dcf559e4bf7d422c0fd647cf58f6 Mon Sep 17 00:00:00 2001 From: iThorgrim <125808072+iThorgrim@users.noreply.github.com> Date: Wed, 13 May 2026 09:00:10 +0200 Subject: [PATCH] Add IsPet and ToPet methods for Unit class --- src/LuaEngine/methods/UnitMethods.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/LuaEngine/methods/UnitMethods.h b/src/LuaEngine/methods/UnitMethods.h index 1ded5af..c23ed33 100644 --- a/src/LuaEngine/methods/UnitMethods.h +++ b/src/LuaEngine/methods/UnitMethods.h @@ -2750,5 +2750,27 @@ namespace LuaUnit ALE::Push(L, unit->GetThreatMgr().GetThreat(target)); return 1; } + + /** + * Return `true` if the [Unit] is [Pet] + * + * @return bool isPet + */ + int IsPet(lua_State* L, Unit* unit) + { + ALE::Push(L, creature->IsPet()); + return 1; + } + + /** + * Attempts to convert the [Unit] to a [Pet]. + * + * @return [Pet] pet : the [Unit] as a [Pet], or `nil` + */ + int ToPet(lua_State* L, Unit* unit) + { + ALE::Push(L, creature->ToPet()); + return 1; + } }; #endif