From 442909f4af15d351ec9f37dec25d8872119a73ee Mon Sep 17 00:00:00 2001 From: MowFord <131182600+MowFord@users.noreply.github.com> Date: Sat, 13 Apr 2024 11:30:08 -0500 Subject: [PATCH] Set model slot on non-pc entities --- src/map/lua/lua_baseentity.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/map/lua/lua_baseentity.cpp b/src/map/lua/lua_baseentity.cpp index 4b82dfe89bf..1ee50ac76e7 100644 --- a/src/map/lua/lua_baseentity.cpp +++ b/src/map/lua/lua_baseentity.cpp @@ -5145,12 +5145,13 @@ uint16 CLuaBaseEntity::getModelId() * Function: setModelId() * Purpose : Updates the Model ID of the entity * Example : mob:setModelId(1168) - * Notes : + * Notes : Humanoid entities can be passed a slot to change the modelid of that equipment + * npc:setModelId(47, 5) -- Vermillion cloak ************************************************************************/ void CLuaBaseEntity::setModelId(uint16 modelId, sol::object const& slotObj) { - if (m_PBaseEntity->objtype == TYPE_PC) + if (m_PBaseEntity->objtype == TYPE_PC || slotObj.is()) { SLOTTYPE slot = slotObj.is() ? slotObj.as() : SLOT_MAIN; @@ -5184,8 +5185,11 @@ void CLuaBaseEntity::setModelId(uint16 modelId, sol::object const& slotObj) break; } - auto* PChar = static_cast(m_PBaseEntity); - PChar->pushPacket(new CCharAppearancePacket(PChar)); + if (m_PBaseEntity->objtype == TYPE_PC) + { + auto* PChar = static_cast(m_PBaseEntity); + PChar->pushPacket(new CCharAppearancePacket(PChar)); + } } else {