Reorganized the exec's for datablocks in module template file to be within the start/stop blocks

Tweaked example module script file to comply
Moved ExampleGameMode script file to scripts/shared since client and server need access to the gamemode for logic to work
This commit is contained in:
Areloch 2024-09-01 23:26:10 -05:00
parent d7335a73e4
commit 4bb26bf96c
3 changed files with 4 additions and 5 deletions

View file

@ -9,7 +9,7 @@ function ExampleModule::onDestroy(%this)
//This is called when the server is initially set up by the game application
function ExampleModule::initServer(%this)
{
%this.queueExec("./scripts/server/ExampleGameMode");
%this.queueExec("./scripts/shared/ExampleGameMode");
}
//This is called when the server is created for an actual game/map to be played
@ -25,7 +25,7 @@ function ExampleModule::onDestroyGameServer(%this)
//This is called when the client is initially set up by the game application
function ExampleModule::initClient(%this)
{
%this.queueExec("./scripts/client/inputCommands");
%this.queueExec("./scripts/client/inputCommands");
//client scripts
exec("./scripts/client/defaultkeybinds");
@ -34,7 +34,7 @@ function ExampleModule::initClient(%this)
if(isScriptFile(%prefPath @ "/keybinds"))
exec(%prefPath @ "/keybinds");
%this.queueExec("./scripts/server/ExampleGameMode");
%this.queueExec("./scripts/shared/ExampleGameMode");
}
//This is called when a client connects to a server

View file

@ -16,6 +16,7 @@ function @@::initServer(%this)
//This is called when the server is created for an actual game/map to be played
function @@::onCreateGameServer(%this)
{
//--DATABLOCK EXEC BEGIN--
//These are common managed data files. For any datablock-based stuff that gets generated by the editors
//(that doesn't have a specific associated file, like data for a player class) will go into these.
//So we'll register them now if they exist.
@ -24,8 +25,6 @@ function @@::onCreateGameServer(%this)
%this.registerDatablock("./scripts/managedData/managedForestBrushData");
%this.registerDatablock("./scripts/managedData/managedParticleEmitterData");
%this.registerDatablock("./scripts/managedData/managedParticleData");
//--DATABLOCK EXEC BEGIN--
//--DATABLOCK EXEC END--
}