Browse Source

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

AzaezelX 7 months ago
parent
commit
a529e3ecc0
2 changed files with 12 additions and 14 deletions
  1. 1 4
      Engine/source/T3D/Scene.cpp
  2. 11 10
      Engine/source/T3D/SubScene.cpp

+ 1 - 4
Engine/source/T3D/Scene.cpp

@@ -202,15 +202,12 @@ void Scene::processTick()
                controlObj = gc->getCameraObject();
                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
                   //we have a client controlling object in the bounds, so we ensure the contents are loaded
                   hasClients = true;
                   hasClients = true;
                   break;
                   break;
                }
                }
-            }
          }
          }
       }
       }
 
 

+ 11 - 10
Engine/source/T3D/SubScene.cpp

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