From a529e3ecc067a5f5d6b280788ef3b7099b3bceca Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 13 Feb 2025 14:32:23 -0600 Subject: [PATCH] clean up subscene load evaluators so that it doesn';t require a client if it's set to global (allows spawnpoints to fill out prior to connections) also try and apply filtering prior to actual loading --- Engine/source/T3D/Scene.cpp | 5 +---- Engine/source/T3D/SubScene.cpp | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Engine/source/T3D/Scene.cpp b/Engine/source/T3D/Scene.cpp index 7fb53273a..f58179196 100644 --- a/Engine/source/T3D/Scene.cpp +++ b/Engine/source/T3D/Scene.cpp @@ -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; } - } } } diff --git a/Engine/source/T3D/SubScene.cpp b/Engine/source/T3D/SubScene.cpp index 013837db7..cc05532a2 100644 --- a/Engine/source/T3D/SubScene.cpp +++ b/Engine/source/T3D/SubScene.cpp @@ -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()