isobject and obj.delete safties

isobject isn't actually one if it's yet to be properlyAdded, or already marked with isRemoved
likewise don't try and delete a deleted thing
This commit is contained in:
AzaezelX 2025-04-29 16:45:25 -05:00
parent 2852b33cec
commit 62aadf9114
2 changed files with 12 additions and 1 deletions

View file

@ -102,7 +102,15 @@ DefineEngineFunction( isObject, bool, (const char * objectName), ,"isObject(obje
if (!String::compare(objectName, "0") || !String::compare(objectName, ""))
return false;
else
return (Sim::findObject(objectName) != NULL);
{
SimObject* obj= Sim::findObject(objectName);
if (obj)
{
if (!obj->isProperlyAdded() || obj->isRemoved())
obj = NULL;
}
return obj != NULL;
}
}
ConsoleDocFragment _spawnObject1(