Add missile thruster checks and update configurations
- Implemented validation for missile thrusters, halting if none are found. - Increased `HYDRO_TANK_FILLED_PERCENT` from 20 to 40. - Changed runtime update frequency from `Update100` to `Update10`.
This commit is contained in:
parent
0cbd5370f9
commit
736aec97db
1 changed files with 15 additions and 5 deletions
|
|
@ -124,13 +124,23 @@ namespace IngameScript
|
|||
}
|
||||
|
||||
IMyProgrammableBlock programmableBlock = this.gridTerminal.GetBlock<IMyProgrammableBlock>("[PM] Programmable Block", missileGrid);
|
||||
|
||||
if (programmableBlock == null)
|
||||
{
|
||||
this.Print("Cannot find the missile programmable block");
|
||||
break;
|
||||
}
|
||||
|
||||
IEnumerable<IMyThrust> thrusters = this.gridTerminal.GetBlocksFromGroup<IMyThrust>("[PM] Thrusters", missileGrid);
|
||||
if (thrusters.Count() == 0)
|
||||
{
|
||||
this.Print("Cannot find missile thrusters");
|
||||
break;
|
||||
}
|
||||
|
||||
// When launched the missile will enabled itself its thrusters.
|
||||
foreach (var thruster in thrusters)
|
||||
thruster.Enabled = false;
|
||||
|
||||
tank.Stockpile = true;
|
||||
connector.Connect();
|
||||
|
||||
|
|
@ -182,7 +192,7 @@ namespace IngameScript
|
|||
|
||||
public const string GRID_PREFIX = "[PML]";
|
||||
public const string MISSILE_GRID_PREFIX = "[PM]";
|
||||
public const double HYDRO_TANK_FILLED_PERCENT = 20;
|
||||
public const double HYDRO_TANK_FILLED_PERCENT = 40;
|
||||
|
||||
const string LAUNCHER_SMALL_CONNECTOR_NAME = "Connector Launcher"; // Following by a number: "01", "02", etc.
|
||||
const string DOORS_MISSILES_GROUP = "Doors Missiles";
|
||||
|
|
@ -202,7 +212,7 @@ namespace IngameScript
|
|||
public Program()
|
||||
{
|
||||
var output = this.Me.GetSurface(0);
|
||||
this.output = new Output(output);
|
||||
this.output = new Output(output, 14);
|
||||
this.output.Print("Missile launcher system starting...");
|
||||
|
||||
this.missilesDoors = Utils.GetBlocksFromGroup<IMyDoor>(this.GridTerminalSystem, String.Format("{0} {1}", GRID_PREFIX, DOORS_MISSILES_GROUP));
|
||||
|
|
@ -227,7 +237,7 @@ namespace IngameScript
|
|||
this.launchers.Add(new Launcher(n, this.GridTerminalSystem, this.output, connector));
|
||||
}
|
||||
|
||||
this.Runtime.UpdateFrequency = UpdateFrequency.Update100;
|
||||
this.Runtime.UpdateFrequency = UpdateFrequency.Update10;
|
||||
|
||||
this.output.Print($"Missile launcher system started ({this.launchers.Count} launcher(s))");
|
||||
}
|
||||
|
|
@ -293,7 +303,7 @@ namespace IngameScript
|
|||
|
||||
public void Main(string argument, UpdateType updateSource)
|
||||
{
|
||||
if ((updateSource & UpdateType.Update100) != 0)
|
||||
if ((updateSource & UpdateType.Update10) != 0)
|
||||
{
|
||||
this.UpdateState();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue