|
@@ -81,8 +81,8 @@ function GameConnection::onConnect( %this, %clientData )
|
|
|
|
|
|
%this.connectData = %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("setSpawnObjectTypeFailed");
|
|
%this.GetEventManager().registerEvent("setSpawnPointComplete");
|
|
%this.GetEventManager().registerEvent("setSpawnPointComplete");
|
|
%this.GetEventManager().registerEvent("setSpawnPointFailed");
|
|
%this.GetEventManager().registerEvent("setSpawnPointFailed");
|
|
@@ -91,11 +91,6 @@ function GameConnection::onConnect( %this, %clientData )
|
|
%this.listener = new ScriptMsgListener() {
|
|
%this.listener = new ScriptMsgListener() {
|
|
class = GameConnectionListener;
|
|
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);
|
|
callGamemodeFunction("onClientConnect", %this);
|
|
|
|
|
|
@@ -124,9 +119,12 @@ function GameConnection::spawnControlObject( %this )
|
|
%modulesIDList = getModulesAndGameModesList(true, "Game");
|
|
%modulesIDList = getModulesAndGameModesList(true, "Game");
|
|
|
|
|
|
%this.numModsNeedingLoaded = getNumCanCallOnObjectList("setSpawnObjectType", %modulesIDList);
|
|
%this.numModsNeedingLoaded = getNumCanCallOnObjectList("setSpawnObjectType", %modulesIDList);
|
|
-
|
|
|
|
if (%this.numModsNeedingLoaded)
|
|
if (%this.numModsNeedingLoaded)
|
|
|
|
+ {
|
|
|
|
+ %this.GetEventManager().subscribe( %this.listener, "setSpawnObjectTypeComplete" );
|
|
|
|
+ %this.GetEventManager().subscribe( %this.listener, "setSpawnObjectTypeFailed" );
|
|
callOnObjectList("setSpawnObjectType", %modulesIdList, %this);
|
|
callOnObjectList("setSpawnObjectType", %modulesIdList, %this);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
%this.listener.onSetSpawnObjectTypeComplete(%this); //just jump to progress
|
|
%this.listener.onSetSpawnObjectTypeComplete(%this); //just jump to progress
|
|
}
|
|
}
|
|
@@ -134,9 +132,12 @@ function GameConnection::spawnControlObject( %this )
|
|
function GameConnectionListener::onSetSpawnObjectTypeComplete( %this, %client )
|
|
function GameConnectionListener::onSetSpawnObjectTypeComplete( %this, %client )
|
|
{
|
|
{
|
|
%client.moduleLoadedDone++;
|
|
%client.moduleLoadedDone++;
|
|
-
|
|
|
|
if (%client.moduleLoadedDone < %client.numModsNeedingLoaded)
|
|
if (%client.moduleLoadedDone < %client.numModsNeedingLoaded)
|
|
return; //continue to wait
|
|
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))
|
|
if (isObject(%client.player))
|
|
{
|
|
{
|
|
@@ -187,6 +188,10 @@ function GameConnectionListener::onSetSpawnPointComplete( %this, %client )
|
|
if (%client.moduleLoadedDone < %client.numModsNeedingLoaded)
|
|
if (%client.moduleLoadedDone < %client.numModsNeedingLoaded)
|
|
return; //continue to wait
|
|
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
|
|
// Spawn with the engine's Sim::spawnObject() function
|
|
%client.player = spawnObject(%client.spawnClass, %client.spawnDataBlock, %client.spawnProperties, %client.spawnScript);
|
|
%client.player = spawnObject(%client.spawnClass, %client.spawnDataBlock, %client.spawnProperties, %client.spawnScript);
|
|
|
|
|