/// <summary> /// Echo the mission information to the console /// </summary> /// <param name="mission"></param> public static void dumpLoadInfo() { Torque3D.LevelInfo theLevelInfo = Sim.FindObject <Torque3D.LevelInfo>("theLevelInfo"); Global.echo("Level Name: " + theLevelInfo.Name); Global.echo("Level Description:"); for (int i = 0; !string.IsNullOrEmpty(theLevelInfo.getFieldValue($"desc[{i}]")); i++) { Global.echo(" " + theLevelInfo.getFieldValue($"desc[{i}]")); } }
/// <summary> /// Sends mission description to the client /// </summary> /// <param name="client"></param> public static void sendLoadInfoToClient(GameConnectionToClient client) { Torque3D.LevelInfo theLevelInfo = Sim.FindObject <Torque3D.LevelInfo>("theLevelInfo"); Message.messageClient(client, Global.addTaggedString("MsgLoadInfo"), "", theLevelInfo.getFieldValue("levelName")); for (int i = 0; !string.IsNullOrEmpty(theLevelInfo.getFieldValue($"desc[{i}]")); i++) { Message.messageClient(client, Global.addTaggedString("MsgLoadDescription"), "", theLevelInfo.getFieldValue( $"desc[{i}]")); } Message.messageClient(client, Global.addTaggedString("MsgLoadInfoDone"), ""); }
public static void loadMissionStage2() { Global.echo("*** Stage 2 load"); // Create the mission group off the ServerGroup Globals.SetString("instantGroup", "ServerGroup"); // Make sure the mission exists string file = Globals.GetString("Server::MissionFile"); if (!Global.isFile(file)) { Globals.SetString("Server::LoadFailMsg", "Could not find mission \"" + file + "\""); } else { // Calculate the mission CRC. The CRC is used by the clients // to caching mission lighting. Globals.SetInt("missionCRC", Global.getFileCRC(file)); // Exec the mission. The MissionGroup (loaded components) is added to the ServerGroup Global.exec(file); if (!Global.isObject("MissionGroup")) { Globals.SetString("Server::LoadFailMsg", "No 'MissionGroup' found in mission \"" + file + "\"."); } } SimSet ClientGroup = Sim.FindObject <SimSet>("ClientGroup"); if (Globals.GetString("Server::LoadFailMsg") != "") { // Inform clients that are already connected for (uint clientIndex = 0; clientIndex < ClientGroup.getCount(); clientIndex++) { Message.messageClient(ClientGroup.getObject(clientIndex).As <GameConnectionToClient>(), "MsgLoadFailed".Tag(), Globals.GetString("Server::LoadFailMsg")); } return; } Torque3D.LevelInfo TheLevelInfo = Sim.FindObject <Torque3D.LevelInfo>("TheLevelInfo"); // Set mission name. if (Global.isObject("TheLevelInfo")) { Globals.SetString("Server::MissionName", TheLevelInfo.getFieldValue("levelName")); } // Mission cleanup group. This is where run time components will reside. The MissionCleanup // group will be added to the ServerGroup. SimGroup MissionCleanup = new SimGroup("MissionCleanup", true); // Make the MissionCleanup group the place where all new objects will automatically be added. Globals.SetInt("instantGroup", MissionCleanup.getId()); // Construct MOD paths Global.pathOnMissionLoadDone(); // Mission loading done... Global.echo("*** Mission loaded"); // Start all the clients in the mission Globals.SetBool("missionRunning", true); for (uint clientIndex = 0; clientIndex < ClientGroup.getCount(); clientIndex++) { ClientGroup.getObject(clientIndex).As <GameConnectionToClient>().loadMission(); } // Go ahead and launch the game //todo onMissionStart TheLevelInfo.call("onMissionStart"); }