From 8247258b1b942dfbc068532ee72333d141737916 Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Sat, 4 Jan 2025 10:53:31 +0000 Subject: [PATCH 1/2] Core: Make isFollowingPath usable on all entity types --- src/map/lua/lua_baseentity.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/map/lua/lua_baseentity.cpp b/src/map/lua/lua_baseentity.cpp index 8c092713878..b84625e5192 100644 --- a/src/map/lua/lua_baseentity.cpp +++ b/src/map/lua/lua_baseentity.cpp @@ -1896,12 +1896,11 @@ bool CLuaBaseEntity::pathThrough(sol::table const& pointsTable, sol::object cons bool CLuaBaseEntity::isFollowingPath() { - if (auto* PBattle = dynamic_cast(m_PBaseEntity)) + if (m_PBaseEntity->PAI && m_PBaseEntity->PAI->PathFind) { - return PBattle->PAI->PathFind != nullptr && PBattle->PAI->PathFind->IsFollowingPath(); + return m_PBaseEntity->PAI->PathFind->IsFollowingPath(); } - ShowError("Invalid entity type passed to function."); return false; } From 6f9741263449348af1df51291a6c63fac1f9e370 Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Sat, 4 Jan 2025 10:53:58 +0000 Subject: [PATCH 2/2] Lua: Aw'Zdei: Floor ID after division --- scripts/zones/The_Garden_of_RuHmet/mobs/Qnzdei.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/zones/The_Garden_of_RuHmet/mobs/Qnzdei.lua b/scripts/zones/The_Garden_of_RuHmet/mobs/Qnzdei.lua index 26a41839231..f67b38d396e 100644 --- a/scripts/zones/The_Garden_of_RuHmet/mobs/Qnzdei.lua +++ b/scripts/zones/The_Garden_of_RuHmet/mobs/Qnzdei.lua @@ -13,8 +13,8 @@ local changeState = function(mob, idle) mob:setLocalVar('idle', idle) -- Calculate door id based off of mob id and door offset - local doorID = ID.npc.QNZDEI_DOOR_OFFSET + (mob:getID() - ID.mob.QNZDEI_OFFSET) / 4 - local door = GetNPCByID(doorID) + local doorID = math.floor(ID.npc.QNZDEI_DOOR_OFFSET + (mob:getID() - ID.mob.QNZDEI_OFFSET) / 4) + local door = GetNPCByID(doorID) if door then local doorIdle = door:getLocalVar('idle')