diff --git a/MissileLauncher/Program.cs b/MissileLauncher/Program.cs index 1116d01..23ecdbe 100644 --- a/MissileLauncher/Program.cs +++ b/MissileLauncher/Program.cs @@ -124,13 +124,23 @@ namespace IngameScript } IMyProgrammableBlock programmableBlock = this.gridTerminal.GetBlock("[PM] Programmable Block", missileGrid); - if (programmableBlock == null) { this.Print("Cannot find the missile programmable block"); break; } + IEnumerable thrusters = this.gridTerminal.GetBlocksFromGroup("[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(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(); }