Torque3D/Templates/BaseGame/game/data/ExampleModule/ExampleModule.tscript
JeffR 27b20c14d7 Cleans up the ExampleModule to have up-to-date examples of module init'ing, game modes, levels and basic input logic
Cleans up prototyping module to trim unneeded extra scripts and files
Adds PlayerBot model to Prototyping module
Adds metalGray material to Prototyping module
Fixes issue where logic wasn't changed for forcing AB preview images to regenerate
Removes unneeded legacy lines from editor template level
Removes unneeded extra asset import config
Disables terrain material name field from editing in terrain material editor for now to prevent bad behavior
Adds mapTo line to newly created material asset definitions to ensure shapes doing mapTo lookups can properly utilize the materials
2022-05-31 00:26:20 -05:00

61 lines
2.2 KiB
Plaintext

function ExampleModule::onCreate(%this)
{
}
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 is called when the server is created for an actual game/map to be played
function ExampleModule::onCreateGameServer(%this)
{
//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.
if(isFile("./scripts/managedData/managedDatablocks." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedDatablocks");
if(isFile("./scripts/managedData/managedForestItemData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedForestItemData");
if(isFile("./scripts/managedData/managedForestBrushData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedForestBrushData");
if(isFile("./scripts/managedData/managedParticleEmitterData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleEmitterData");
if(isFile("./scripts/managedData/managedParticleData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleData");
}
//This is called when the server is shut down due to the game/map being exited
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");
//client scripts
exec("./scripts/client/defaultkeybinds");
%prefPath = getPrefpath();
if(isScriptFile(%prefPath @ "/keybinds"))
exec(%prefPath @ "/keybinds");
}
//This is called when a client connects to a server
function ExampleModule::onCreateClientConnection(%this)
{
ExampleMovemap.push();
}
//This is called when a client disconnects from a server
function ExampleModule::onDestroyClientConnection(%this)
{
}