public void Main(string argument) { if (!setupSuccess) { return; } if (argument == "Parse") { string[] orders = Me.CustomData.Split('\n'); short errors = 0; foreach (string order in orders) { if (!launchHandler.ParseLaunchOrder(order)) { Echo("Parsing of line " + order + " failed!"); errors++; } } Echo("Finished parsing with " + errors + " incorrect lines"); Echo("Remenber that type errors will occur only at runtime"); } if (launched) { if (!init) { initMissile(); init = true; Echo("Init completed"); } else { directions = funcs.run(control); if (funcs.lastDistance < 3) { foreach (IMyWarhead boom in warheads) { if (boom.GetValueBool("Safety")) { boom.SetValueBool("Safety", false); } } foreach (IMyWarhead boom in warheads) { boom.Detonate(); } } SetGyros(directions.Z, directions.Y, 0); if (directions.Y == 0 && directions.Z == 0) { Echo("Target lost"); } else { Echo("Tracking target"); } } //TODO currently only one argument is needed, if more are needed delete the following return return; } if (argument == "Fire") { if (visor.AvailableScanRange < 5000) { Echo("Scanning is recharging"); return; } MyDetectedEntityInfo target; target = visor.Raycast(5000); if (target.IsEmpty()) { //Search in cone form //TODO launch sequence without direct line of sight possible, redirecting missile per antenna Echo("No target found"); return; } funcs.LockTarget(target, control); merge.Enabled = false; launched = true; Echo("Launched"); return; } }