mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
clean up spawn chain
ensure among other things that we're only subscribed to the completion or failed events for a given loading stage once all of them have checked in also for callonobjectlist, see what module::callback method in particular is being itterated through for that stages batch when debugging
This commit is contained in:
parent
07c67f2935
commit
2be21425df
|
|
@ -81,8 +81,8 @@ function GameConnection::onConnect( %this, %clientData )
|
|||
|
||||
%this.connectData = %clientData;
|
||||
|
||||
//Signal and listener logic for the spawn config/processing here
|
||||
%this.GetEventManager().registerEvent("setSpawnObjectTypeComplete");
|
||||
//Signal and listener logic for the spawn config/processing here
|
||||
%this.GetEventManager().registerEvent("setSpawnObjectTypeComplete");
|
||||
%this.GetEventManager().registerEvent("setSpawnObjectTypeFailed");
|
||||
%this.GetEventManager().registerEvent("setSpawnPointComplete");
|
||||
%this.GetEventManager().registerEvent("setSpawnPointFailed");
|
||||
|
|
@ -91,11 +91,6 @@ function GameConnection::onConnect( %this, %clientData )
|
|||
%this.listener = new ScriptMsgListener() {
|
||||
class = GameConnectionListener;
|
||||
};
|
||||
%this.GetEventManager().subscribe( %this.listener, "setSpawnObjectTypeComplete" );
|
||||
%this.GetEventManager().subscribe( %this.listener, "setSpawnObjectTypeFailed" );
|
||||
%this.GetEventManager().subscribe( %this.listener, "setSpawnPointComplete" );
|
||||
%this.GetEventManager().subscribe( %this.listener, "setSpawnPointFailed" );
|
||||
%this.GetEventManager().subscribe( %this.listener, "postSpawnComplete" );
|
||||
|
||||
callGamemodeFunction("onClientConnect", %this);
|
||||
|
||||
|
|
@ -124,9 +119,12 @@ function GameConnection::spawnControlObject( %this )
|
|||
%modulesIDList = getModulesAndGameModesList(true, "Game");
|
||||
|
||||
%this.numModsNeedingLoaded = getNumCanCallOnObjectList("setSpawnObjectType", %modulesIDList);
|
||||
|
||||
if (%this.numModsNeedingLoaded)
|
||||
{
|
||||
%this.GetEventManager().subscribe( %this.listener, "setSpawnObjectTypeComplete" );
|
||||
%this.GetEventManager().subscribe( %this.listener, "setSpawnObjectTypeFailed" );
|
||||
callOnObjectList("setSpawnObjectType", %modulesIdList, %this);
|
||||
}
|
||||
else
|
||||
%this.listener.onSetSpawnObjectTypeComplete(%this); //just jump to progress
|
||||
}
|
||||
|
|
@ -134,9 +132,12 @@ function GameConnection::spawnControlObject( %this )
|
|||
function GameConnectionListener::onSetSpawnObjectTypeComplete( %this, %client )
|
||||
{
|
||||
%client.moduleLoadedDone++;
|
||||
|
||||
if (%client.moduleLoadedDone < %client.numModsNeedingLoaded)
|
||||
return; //continue to wait
|
||||
%client.GetEventManager().remove( %client.listener, "setSpawnObjectTypeComplete" );
|
||||
%client.GetEventManager().remove( %client.listener, "setSpawnObjectTypeFailed" );
|
||||
%client.GetEventManager().subscribe( %client.listener, "setSpawnPointComplete" );
|
||||
%client.GetEventManager().subscribe( %client.listener, "setSpawnPointFailed" );
|
||||
|
||||
if (isObject(%client.player))
|
||||
{
|
||||
|
|
@ -187,6 +188,10 @@ function GameConnectionListener::onSetSpawnPointComplete( %this, %client )
|
|||
if (%client.moduleLoadedDone < %client.numModsNeedingLoaded)
|
||||
return; //continue to wait
|
||||
|
||||
%client.GetEventManager().remove( %client.listener, "setSpawnPointComplete" );
|
||||
%client.GetEventManager().remove( %client.listener, "setSpawnPointFailed" );
|
||||
%client.GetEventManager().subscribe( %client.listener, "postSpawnComplete" );
|
||||
|
||||
// Spawn with the engine's Sim::spawnObject() function
|
||||
%client.player = spawnObject(%client.spawnClass, %client.spawnDataBlock, %client.spawnProperties, %client.spawnScript);
|
||||
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ function getModulesAndGameModesList(%usePriority, %group)
|
|||
function callOnObjectList(%functionName, %objectsList, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
|
||||
{
|
||||
//Get our modules so we can exec any specific client-side loading/handling
|
||||
%echoList = "Called List:";
|
||||
%echoList = "Called List for "@ %functionName @":";
|
||||
for(%i=0; %i < getWordCount(%objectsList); %i++)
|
||||
{
|
||||
%obj = getWord(%objectsList, %i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue