Merge pull request #1384 from Azaezel/alpha41/subsceneCleanups

clean up subscene load evaluators so that it doesn't require a client if it's set to global
This commit is contained in:
Brian Roberts 2025-02-20 12:08:12 -06:00 committed by GitHub
commit f99b2874d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 14 deletions

View file

@ -202,15 +202,12 @@ void Scene::processTick()
controlObj = gc->getCameraObject();
}
if (controlObj != nullptr)
{
if (mSubScenes[i]->testBox(controlObj->getWorldBox()))
if (mSubScenes[i]->testBox(controlObj != nullptr ? controlObj->getWorldBox() : Box3F::Zero))
{
//we have a client controlling object in the bounds, so we ensure the contents are loaded
hasClients = true;
break;
}
}
}
}

View file

@ -214,10 +214,11 @@ bool SubScene::evaluateCondition()
bool SubScene::testBox(const Box3F& testBox)
{
if (mGlobalLayer)
return true;
bool passes = mGlobalLayer;
if (!passes)
passes = getWorldBox().isOverlapped(testBox);
bool passes = getWorldBox().isOverlapped(testBox);
if (passes)
passes = evaluateCondition();
return passes;
@ -346,22 +347,22 @@ void SubScene::load()
if (mSaving)
return;
GameMode::findGameModes(mGameModesNames, &mGameModesList);
if ((String(mGameModesNames).isNotEmpty() && mGameModesList.size() == 0) || !evaluateCondition())
{
mLoaded = false;
return;
}
_loadFile(true);
mLoaded = true;
GameMode::findGameModes(mGameModesNames, &mGameModesList);
onLoaded_callback();
for (U32 i = 0; i < mGameModesList.size(); i++)
{
mGameModesList[i]->onSubsceneLoaded_callback(this);
}
if (!mOnLoadCommand.isEmpty())
{
String command = "%this = " + String(getIdString()) + "; " + mLoadIf + ";";
Con::evaluatef(command.c_str());
}
}
void SubScene::unload()