void DoYourJob()
        {
            if (schedule.Count > 0 && schedule[0].TTJ <= 0)
            {
                Job curr = schedule[0];
                schedule.RemoveAt(0);
                string name = "MISSILE-";
                IMyAirtightHangarDoor siloDoor = GridTerminalSystem.GetBlockWithName("Silo Door " + curr.misNo) as IMyAirtightHangarDoor;
                switch (curr.type)
                {
                case JobType.OpenDoor:
                    if (siloDoor != null)
                    {
                        siloDoor.OpenDoor();
                    }
                    else
                    {
                        ErrorOutput("NO SILO DOOR \"" + ("Silo Door " + curr.misNo) + "\"");
                        BumpMyMissile(curr.misNo);
                    }
                    break;

                case JobType.Launch:
                    IMyProgrammableBlock missile = GridTerminalSystem.GetBlockWithName(name + curr.misNo) as IMyProgrammableBlock;
                    if (missile == null)
                    {
                        string message = "ABORTING LAUNCH: MISSILE DOES NOT EXIST: \"" + name + curr.misNo + "\"";
                        ErrorOutput(message);
                        return;
                    }
                    else
                    {
                        long  code;
                        Entry entry;
                        if (long.TryParse(curr.code, out code) && Register.TryGet(code, out entry))
                        {
                            missile.TryRun("prep " + entry.Location.X + " " + entry.Location.Y + " " + entry.Location.Z + " " + code);
                        }
                        else
                        {
                            string message = "ABORTING LAUNCH: TARGET DOES NOT EXIST.";
                            ErrorOutput(message);
                            return;
                        }
                    }
                    break;


                case JobType.CloseDoor:
                    if (siloDoor != null)
                    {
                        siloDoor.CloseDoor();
                    }
                    break;
                }
            }
        }
Exemple #2
0
        public void launch(int missileNo)
        {
            IMyAirtightHangarDoor siloDoor = GridTerminalSystem.GetBlockWithName("Silo Door " + missileNo) as IMyAirtightHangarDoor;
            IMyProgrammableBlock  missile  = GridTerminalSystem.GetBlockWithName("MISSILE-" + missileNo) as IMyProgrammableBlock;

            if (curTarget == null || missile == null || siloDoor == null)
            {
                Output("ABORTING LAUNCH :" + (curTarget == null) + " " + (missile == null) + " " + (siloDoor == null));
                return;
            }
            siloDoor.OpenDoor();
            missile.Enabled = false;
            missile.Enabled = true;
            missile.TryRun("prep " + curTarget.X + " " + curTarget.Y + " " + curTarget.Z);
        }
Exemple #3
0
 private bool IsAirlockDoor(IMyAirtightHangarDoor door) => this.HasConfigSection(door, AirlockSection);