mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 23:54:35 +00:00
callonmodules perf tweaks
callonmodules skips out on file execution tracking new moduleExec method retains the old functionality for module file execution filtering
This commit is contained in:
parent
6c8dfdbe4c
commit
992a610d9f
4 changed files with 34 additions and 12 deletions
|
|
@ -20,7 +20,7 @@ function initClient()
|
||||||
if ( isFile( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension ) )
|
if ( isFile( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension ) )
|
||||||
exec( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension );
|
exec( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension );
|
||||||
|
|
||||||
callOnModules("initClient");
|
moduleExec("initClient");
|
||||||
|
|
||||||
// Copy saved script prefs into C++ code.
|
// Copy saved script prefs into C++ code.
|
||||||
setDefaultFov( $pref::Player::defaultFov );
|
setDefaultFov( $pref::Player::defaultFov );
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ function GameConnection::onConnectionAccepted(%this)
|
||||||
// datablocks and objects are ghosted over.
|
// datablocks and objects are ghosted over.
|
||||||
physicsInitWorld( "client" );
|
physicsInitWorld( "client" );
|
||||||
|
|
||||||
callOnModules("onCreateClientConnection", "Game");
|
moduleExec("onCreateClientConnection", "Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
function GameConnection::initialControlSet(%this)
|
function GameConnection::initialControlSet(%this)
|
||||||
|
|
@ -156,5 +156,5 @@ function disconnectedCleanup()
|
||||||
// We can now delete the client physics simulation.
|
// We can now delete the client physics simulation.
|
||||||
physicsDestroyWorld( "client" );
|
physicsDestroyWorld( "client" );
|
||||||
|
|
||||||
callOnModules("onDestroyClientConnection", "Game");
|
moduleExec("onDestroyClientConnection", "Game");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ function initServer()
|
||||||
// Specify where the mission files are.
|
// Specify where the mission files are.
|
||||||
$Server::MissionFileSpec = "data/levels/*.mis";
|
$Server::MissionFileSpec = "data/levels/*.mis";
|
||||||
|
|
||||||
callOnModules("initServer");
|
moduleExec("initServer");
|
||||||
|
|
||||||
//Maybe this should be a pref for better per-project control
|
//Maybe this should be a pref for better per-project control
|
||||||
//But many physically based/gameplay things utilize materials being detected
|
//But many physically based/gameplay things utilize materials being detected
|
||||||
|
|
@ -169,8 +169,8 @@ function createServer(%serverType, %levelAsset)
|
||||||
schedule(0,0,startHeartbeat);
|
schedule(0,0,startHeartbeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
callOnModules("onCreateGameServer", "Core");
|
moduleExec("onCreateGameServer", "Core");
|
||||||
callOnModules("onCreateGameServer", "Game");
|
moduleExec("onCreateGameServer", "Game");
|
||||||
|
|
||||||
// Let the game initialize some things now that the
|
// Let the game initialize some things now that the
|
||||||
// the server has been created
|
// the server has been created
|
||||||
|
|
@ -204,8 +204,8 @@ function onServerCreated()
|
||||||
physicsStartSimulation("server");
|
physicsStartSimulation("server");
|
||||||
loadDatablockFiles( DatablockFilesList, true );
|
loadDatablockFiles( DatablockFilesList, true );
|
||||||
|
|
||||||
callOnModules("onServerScriptExec", "Core");
|
moduleExec("onServerScriptExec", "Core");
|
||||||
callOnModules("onServerScriptExec", "Game");
|
moduleExec("onServerScriptExec", "Game");
|
||||||
|
|
||||||
// Keep track of when the game started
|
// Keep track of when the game started
|
||||||
$Game::StartTime = $Sim::Time;
|
$Game::StartTime = $Sim::Time;
|
||||||
|
|
@ -244,8 +244,8 @@ function destroyServer()
|
||||||
deleteDataBlocks();
|
deleteDataBlocks();
|
||||||
|
|
||||||
//Get our modules so we can exec any specific server-side loading/handling
|
//Get our modules so we can exec any specific server-side loading/handling
|
||||||
callOnModules("onDestroyGameServer", "Game");
|
moduleExec("onDestroyGameServer", "Game");
|
||||||
callOnModules("onDestroyGameServer", "Core");
|
moduleExec("onDestroyGameServer", "Core");
|
||||||
|
|
||||||
// Save any server settings
|
// Save any server settings
|
||||||
%prefPath = getPrefpath();
|
%prefPath = getPrefpath();
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ $traceModuleCalls=false;
|
||||||
$reportModuleFileConflicts=true;
|
$reportModuleFileConflicts=true;
|
||||||
if (!isObject(ExecFilesList))
|
if (!isObject(ExecFilesList))
|
||||||
new ArrayObject(ExecFilesList);
|
new ArrayObject(ExecFilesList);
|
||||||
|
|
||||||
function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
|
function moduleExec(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
|
||||||
{
|
{
|
||||||
//clear per module group file execution chain
|
//clear per module group file execution chain
|
||||||
%execArray = new ArrayObject("callOn" @ %functionName @ "_" @ %moduleGroup);
|
%execArray = new ArrayObject("callOn" @ %functionName @ "_" @ %moduleGroup);
|
||||||
|
|
@ -46,6 +46,28 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3,
|
||||||
%execArray.delete();
|
%execArray.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
|
||||||
|
{
|
||||||
|
//Get our modules so we can exec any specific client-side loading/handling
|
||||||
|
%modulesList = ModuleDatabase.findModules();
|
||||||
|
%modlist = "modlist:";
|
||||||
|
for(%i=0; %i < getWordCount(%modulesList); %i++)
|
||||||
|
{
|
||||||
|
%module = getWord(%modulesList, %i);
|
||||||
|
%modlist = %modlist SPC %module.ModuleId;
|
||||||
|
if(%moduleGroup !$= "")
|
||||||
|
{
|
||||||
|
if(%module.group !$= %moduleGroup)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// match this to i/o signature
|
||||||
|
if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName))
|
||||||
|
%module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6);
|
||||||
|
}
|
||||||
|
if ($reportModuleOrder)
|
||||||
|
warn(%modlist);
|
||||||
|
}
|
||||||
|
|
||||||
function loadModuleMaterials(%moduleGroup)
|
function loadModuleMaterials(%moduleGroup)
|
||||||
{
|
{
|
||||||
//Get our modules so we can exec any specific client-side loading/handling
|
//Get our modules so we can exec any specific client-side loading/handling
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue