Esempio n. 1
0
            public void Launch(int VertDelay = 0)
            {
                if (VertDelay != 0)
                {
                    VerticalDelay = VertDelay;
                }
                else
                {
                    VerticalDelay = LAUNCH_DELAY;
                }

                foreach (var hydrogenTank in hydrogenTanks)
                {
                    hydrogenTank.Stockpile = false;
                }

                //zostaje
                foreach (IMyBatteryBlock bat in batteries)
                {
                    bat.Enabled    = true;
                    bat.ChargeMode = ChargeMode.Discharge;
                }
                //zostaje
                foreach (IMyGyro gyro in gyros)
                {
                    gyro.Enabled      = true;
                    gyro.GyroOverride = true;
                    gyro.Pitch        = 0;
                    gyro.Yaw          = 0;
                    gyro.Roll         = 0;
                }
                foreach (IMyDecoy dec in decoys)
                {
                    dec.Enabled = true;
                }

                if (WARHEAD_TIMER > 30)
                {
                    foreach (IMyWarhead warhead in warheads)
                    {
                        warhead.DetonationTime = WARHEAD_TIMER;
                        warhead.StartCountdown();
                    }
                }
                merge.ApplyAction(Actions.TURN_OFF);       //WYŁACZA MERGE BLOCK
                connector.ToggleConnect();                 //rOZŁACZA Connector
                status = 2;
            }
Esempio n. 2
0
            // int CowntDown=5;
            // bool StartCountDown =false;

            public Torpedo(string GroupName)
            {
                Name = GroupName;
                List <IMyTerminalBlock> templist = new List <IMyTerminalBlock>();

                templist.Clear();

                gts.GetBlocksOfType <IMyShipConnector>(templist, (b) => b.CustomName.Contains(GroupName));
                merge = templist[0] as IMyShipConnector;
                if (merge.Status == MyShipConnectorStatus.Connectable)
                {
                    merge.ToggleConnect();
                }
                templist.Clear();

                gts.GetBlocksOfType <IMyCockpit>(templist, (b) => b.CustomName.Contains(GroupName));
                remcon    = templist[0] as IMyCockpit;
                batteries = new List <IMyBatteryBlock>();
                gts.GetBlocksOfType <IMyBatteryBlock>(batteries, (b) => b.CustomName.Contains(GroupName));
                foreach (IMyBatteryBlock battery in batteries)
                {
                    battery.Enabled = true;
                }
                thrusters = new List <IMyThrust>();
                gts.GetBlocksOfType <IMyThrust>(thrusters, (b) => b.CustomName.Contains(GroupName));
                gyros = new List <IMyGyro>();
                gts.GetBlocksOfType <IMyGyro>(gyros, (b) => b.CustomName.Contains(GroupName));
                warheads = new List <IMyWarhead>();
                gts.GetBlocksOfType <IMyWarhead>(warheads, (b) => b.CustomName.Contains(GroupName));
                decoys = new List <IMyDecoy>();
                gts.GetBlocksOfType <IMyDecoy>(decoys, (b) => b.CustomName.Contains(GroupName));
                status = 1;
            }
Esempio n. 3
0
            /// <summary>
            /// Gets actions for blocks implementing IMyShipConnector.
            /// </summary>
            public static void GetConnectorActions(IMyTerminalBlock tBlock, List <IScrollableAction> actions)
            {
                IMyShipConnector connector = (IMyShipConnector)tBlock;

                actions.Add(new BlockAction(
                                () =>
                {
                    string status = "";

                    if (connector.Status == ConnectorStatus.Connected)
                    {
                        status = "Locked";
                    }
                    else if (connector.Status == ConnectorStatus.Connectable)
                    {
                        status = "Ready";
                    }
                    else if (connector.Status == ConnectorStatus.Unconnected)
                    {
                        status = "Unlocked";
                    }

                    return($"Lock/Unlock ({status})");
                },
                                () => connector.ToggleConnect()));
            }
Esempio n. 4
0
            public void Launch(int VertDelay = 0)
            {
                if (VertDelay != 0)
                {
                    VerticalDelay = VertDelay;
                }
                else
                {
                    VerticalDelay = LAUNCH_DELAY;
                }
                foreach (IMyBatteryBlock bat in batteries)
                {
                    bat.Enabled    = true;
                    bat.ChargeMode = ChargeMode.Discharge;
                }
                foreach (IMyGyro gyro in gyros)
                {
                    gyro.Enabled      = true;
                    gyro.GyroOverride = true;
                    gyro.Pitch        = 0;
                    gyro.Yaw          = 0;
                    gyro.Roll         = 0;
                }
                foreach (IMyDecoy dec in decoys)
                {
                    dec.Enabled = true;
                }

                if (WARHEAD_TIMER > 30)
                {
                    foreach (IMyWarhead warhead in warheads)
                    {
                        warhead.DetonationTime = WARHEAD_TIMER;
                        warhead.StartCountdown();
                    }
                }
                merge.ToggleConnect();
                status = 2;
            }
Esempio n. 5
0
            public Torpedo(string GroupName, Program program)
            {
                _program = program;
                Name     = GroupName;
                List <IMyTerminalBlock> templist = new List <IMyTerminalBlock>();

                templist.Clear();

                _program.Echo("Init Connector");
                gts.GetBlocksOfType <IMyShipConnector>(templist, (b) => b.CustomName.Contains(GroupName));
                connector = templist[0] as IMyShipConnector;
                connector.ApplyAction(Actions.TURN_ON);
                if (connector.Status == MyShipConnectorStatus.Connectable)
                {
                    connector.ToggleConnect();
                }
                templist.Clear();

                _program.Echo("Init Merge Block");
                gts.GetBlocksOfType <IMyShipMergeBlock>(templist, (b) => b.CustomName.Contains(GroupName));
                merge = templist[0] as IMyShipMergeBlock;
                merge.ApplyAction(Actions.TURN_ON);
                merge.Enabled = true;
                templist.Clear();

                _program.Echo("Init Remote Control");
                gts.GetBlocksOfType <IMyRemoteControl>(templist, (b) => b.CustomName.Contains(GroupName));
                remcon = templist[0] as IMyRemoteControl;
                //remcon.ApplyAction(Actions.TURN_ON);


                _program.Echo("Init Battery");
                batteries = new List <IMyBatteryBlock>();
                gts.GetBlocksOfType <IMyBatteryBlock>(batteries, (b) => b.CustomName.Contains(GroupName));
                foreach (IMyBatteryBlock battery in batteries)
                {
                    battery.ApplyAction(Actions.TURN_ON);
                    battery.Enabled = true;
                }

                _program.Echo("Init HYDROGEN tANKS");
                hydrogenTanks = new List <IMyGasTank>();
                gts.GetBlocksOfType <IMyGasTank>(hydrogenTanks, (b) => b.CustomName.Contains(GroupName));
                foreach (IMyGasTank hydrogenTank in hydrogenTanks)
                {
                    hydrogenTank.ApplyAction(Actions.TURN_ON);
                    hydrogenTank.Enabled   = true;
                    hydrogenTank.Stockpile = true;                     //Tankowanie zbiorników
                }

                _program.Echo("Init thrusters");
                thrusters = new List <IMyThrust>();
                gts.GetBlocksOfType <IMyThrust>(thrusters, (b) => b.CustomName.Contains(GroupName));
                _program.Echo("Init gyros");
                gyros = new List <IMyGyro>();
                gts.GetBlocksOfType <IMyGyro>(gyros, (b) => b.CustomName.Contains(GroupName));
                _program.Echo("Init warheads");
                warheads = new List <IMyWarhead>();
                gts.GetBlocksOfType <IMyWarhead>(warheads, (b) => b.CustomName.Contains(GroupName));
                _program.Echo("Init decoys");
                decoys = new List <IMyDecoy>();
                gts.GetBlocksOfType <IMyDecoy>(decoys, (b) => b.CustomName.Contains(GroupName));
                status = 1;
            }