Initial implementation of the Scene object for handling scenes/levels in a more consistent and deliberate way.

This commit is contained in:
Areloch 2019-02-23 15:55:28 -06:00
parent e0627973fb
commit 1c2f90a190
37 changed files with 509 additions and 140 deletions

View file

@ -18,7 +18,7 @@ function Core_ClientServer::create( %this )
exec( "./scripts/client/client.cs" );
exec( "./scripts/server/server.cs" );
$Game::MissionGroup = "MissionGroup";
$Game::MainScene = getScene(0);
initServer();

View file

@ -115,7 +115,7 @@ function sendLoadInfoToClient( %client )
function parseMissionGroup( %className, %childGroup )
{
if( getWordCount( %childGroup ) == 0)
%currentGroup = "MissionGroup";
%currentGroup = getScene(0);
else
%currentGroup = %childGroup;
@ -136,7 +136,7 @@ function parseMissionGroup( %className, %childGroup )
function parseMissionGroupForIds( %className, %childGroup )
{
if( getWordCount( %childGroup ) == 0)
%currentGroup = $Game::MissionGroup;
%currentGroup = getScene(0);
else
%currentGroup = %childGroup;

View file

@ -98,9 +98,9 @@ function loadMissionStage2()
// Exec the mission. The MissionGroup (loaded components) is added to the ServerGroup
exec(%file);
if( !isObject(MissionGroup) )
if( !isObject(getScene(0)) )
{
$Server::LoadFailMsg = "No 'MissionGroup' found in mission \"" @ %file @ "\".";
$Server::LoadFailMsg = "No Scene found in level \"" @ %file @ "\".";
}
}
@ -141,7 +141,7 @@ function loadMissionStage2()
function endMission()
{
if (!isObject( MissionGroup ))
if (!isObject( getScene(0) ))
return;
echo("*** ENDING MISSION");
@ -159,7 +159,7 @@ function endMission()
}
// Delete everything
MissionGroup.delete();
getScene(0).delete();
MissionCleanup.delete();
clearServerPaths();

View file

@ -243,7 +243,7 @@ function onServerDestroyed()
{
physicsStopSimulation("server");
if (!isObject( MissionGroup ))
if (!isObject( getScene(0) ))
return;
echo("*** ENDING MISSION");
@ -262,7 +262,7 @@ function onServerDestroyed()
}
// Delete everything
MissionGroup.delete();
getScene(0).delete();
MissionCleanup.delete();
clearServerPaths();