mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Implemented proper ScriptAsset execution on load
Implemented script dependency handling Added test-case of script dependency handling in ExampleModule Cleanup of redundant getSceneCount calls Properly get scene count in callGamemodeFunction Remove unneeded TODO comment in shaders Converted onMissionEnded gamemode func call to use callGameModeFunction function Convert ExampleGameMode to be container-object based, and updated callGamemodeFunction to handle that Correct import settings typoe so image suffixes are read correctly Largely fixed companion image scanning when importing images and streamlined image-material interop during import preprocessing Added handling for reading in PBR maps and creating a composite image + asset Added WIP of Cubemap asset, and editing integration with a standalone cubemap editor Added ability to create new Cubemap asset in Asset Browser
This commit is contained in:
parent
7c3bd49615
commit
9db95f4fb2
28 changed files with 1325 additions and 746 deletions
|
|
@ -19,72 +19,78 @@
|
|||
//triggers for a CTF mode. The subscene would then have it's GameModeName defined to run the CTF gamemode logic
|
||||
//and the levelLoad code will execute it.
|
||||
|
||||
function ExampleGameMode::onCreateGame()
|
||||
{
|
||||
// Note: The Game object will be cleaned up by MissionCleanup. Therefore its lifetime is
|
||||
// limited to that of the mission.
|
||||
new ScriptObject(ExampleGameMode){};
|
||||
|
||||
return ExampleGameMode;
|
||||
}
|
||||
|
||||
//This function is called when the level finishes loading. It sets up the initial configuration, variables and
|
||||
//spawning and dynamic objects, timers or rules needed for the gamemode to run
|
||||
function ExampleGameMode::onMissionStart()
|
||||
function ExampleGameMode::onMissionStart(%this)
|
||||
{
|
||||
//set up the game and game variables
|
||||
ExampleGameMode::initGameVars();
|
||||
%this.initGameVars();
|
||||
|
||||
if ($Game::Running)
|
||||
if (%this.running)
|
||||
{
|
||||
error("onMissionStart: End the game first!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the game timer
|
||||
if ($Game::Duration)
|
||||
$Game::Schedule = schedule($Game::Duration * 1000, "onGameDurationEnd");
|
||||
if (%this.duration)
|
||||
%this.gameSchedule = schedule(%this.duration * 1000, "onGameDurationEnd");
|
||||
|
||||
$Game::Running = true;
|
||||
|
||||
$Game = ExampleGameMode;
|
||||
%this.running = true;
|
||||
}
|
||||
|
||||
//This function is called when the level ends. It can be envoked due to the gamemode ending
|
||||
//but is also kicked off when the game server is shut down as a form of cleanup for anything the gamemode
|
||||
//created or is managing like the above mentioned dynamic objects or timers
|
||||
function ExampleGameMode::onMissionEnded()
|
||||
function ExampleGameMode::onMissionEnded(%this)
|
||||
{
|
||||
if (!$Game::Running)
|
||||
if (!%this.running)
|
||||
{
|
||||
error("onMissionEnded: No game running!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop any game timers
|
||||
cancel($Game::Schedule);
|
||||
cancel(%this.gameSchedule);
|
||||
|
||||
$Game::Running = false;
|
||||
$Game = "";
|
||||
%this.running = false;
|
||||
}
|
||||
|
||||
//This function is called in the event the server resets and is used to re-initialize the gamemode
|
||||
function ExampleGameMode::onMissionReset()
|
||||
function ExampleGameMode::onMissionReset(%this)
|
||||
{
|
||||
// Called by resetMission(), after all the temporary mission objects
|
||||
// have been deleted.
|
||||
ExampleGameMode::initGameVars();
|
||||
%this.initGameVars();
|
||||
}
|
||||
|
||||
//This sets up our gamemode's duration time
|
||||
function ExampleGameMode::initGameVars()
|
||||
function ExampleGameMode::initGameVars(%this)
|
||||
{
|
||||
// Set the gameplay parameters
|
||||
$Game::Duration = 30 * 60;
|
||||
%this.duration = 30 * 60;
|
||||
}
|
||||
|
||||
//This is called when the timer runs out, allowing the gamemode to end
|
||||
function ExampleGameMode::onGameDurationEnd()
|
||||
function ExampleGameMode::onGameDurationEnd(%this)
|
||||
{
|
||||
//we don't end if we're currently editing the level
|
||||
if ($Game::Duration && !(EditorIsActive() && GuiEditorIsActive()))
|
||||
ExampleGameMode::onMissionEnded();
|
||||
if (%this.duration && !(EditorIsActive() && GuiEditorIsActive()))
|
||||
%this.onMissionEnded();
|
||||
}
|
||||
|
||||
//This is called to actually spawn a control object for the player to utilize
|
||||
//A player character, spectator camera, etc.
|
||||
function ExampleGameMode::spawnControlObject(%client)
|
||||
function ExampleGameMode::spawnControlObject(%this, %client)
|
||||
{
|
||||
//In this example, we just spawn a camera
|
||||
if (!isObject(%client.camera))
|
||||
|
|
@ -116,25 +122,25 @@ function ExampleGameMode::spawnControlObject(%client)
|
|||
//It's used for setting up anything ahead of time for the client, such as loading in client-passed
|
||||
//config stuffs, saved data or the like that should be handled BEFORE the client has actually entered
|
||||
//the game itself
|
||||
function ExampleGameMode::onClientConnect(%client)
|
||||
function ExampleGameMode::onClientConnect(%this, %client)
|
||||
{
|
||||
}
|
||||
|
||||
//This is called when a client enters the game server. It's used to spawn a player object
|
||||
//set up any client-specific properties such as saved configs, values, their name, etc
|
||||
//These callbacks are activated in core/clientServer/scripts/server/levelDownload.cs
|
||||
function ExampleGameMode::onClientEnterGame(%client)
|
||||
function ExampleGameMode::onClientEnterGame(%this, %client)
|
||||
{
|
||||
//Set the player name based on the client's connection data
|
||||
%client.setPlayerName(%client.connectData);
|
||||
|
||||
ExampleGameMode::spawnControlObject(%client);
|
||||
%this.spawnControlObject(%client);
|
||||
}
|
||||
|
||||
//This is called when the player leaves the game server. It's used to clean up anything that
|
||||
//was spawned or setup for the client when it connected, in onClientEnterGame
|
||||
//These callbacks are activated in core/clientServer/scripts/server/levelDownload.cs
|
||||
function ExampleGameMode::onClientLeaveGame(%client)
|
||||
function ExampleGameMode::onClientLeaveGame(%this, %client)
|
||||
{
|
||||
// Cleanup the camera
|
||||
if (isObject(%client.camera))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue