Skip to content

Commit 498b063

Browse files
authored
fix for preventing use of openCont on NPCs
1 parent af9221a commit 498b063

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3423,6 +3423,21 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor
34233423
return;
34243424
}
34253425

3426+
//-- no opening NPCs
3427+
GameScriptObject * scriptObject = container->getScriptObject();
3428+
if(scriptObject)
3429+
{
3430+
// this is AI
3431+
if(scriptObject->hasScript("ai.ai"))
3432+
{
3433+
// and this is not a pet (droid) that has storage (so we might actually need to open it)
3434+
if(!scriptObject->hasScript("ai.pet"))
3435+
{
3436+
return;
3437+
}
3438+
}
3439+
}
3440+
34263441
//-- don't open factory crates or crafting tools
34273442
const int got = container->getGameObjectType();
34283443
if (got == SharedObjectTemplate::GOT_misc_factory_crate || got == SharedObjectTemplate::GOT_tool_crafting)

0 commit comments

Comments
 (0)