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 Program()
 {
     m_LcdAccident   = GridTerminalSystem.GetBlockWithName(AccidentLCD) as IMyTextPanel;
     m_TimerAccident = GridTerminalSystem.GetBlockWithName(AccidentTimer) as IMyTimerBlock;
     if (Storage.Length > 0)
     {
         m_LastAccident = DateTime.Parse(Storage);
     }
 }
Exemple #3
0
 public Program()
 {
     GridTerminalSystem.GetBlockGroupWithName("Gyros").GetBlocks(gyros);
     GridTerminalSystem.GetBlockGroupWithName("GyroYows").GetBlocks(gyroyowss);
     GridTerminalSystem.GetBlockGroupWithName("GyroRolls").GetBlocks(gyrorolls);
     cockpit = GridTerminalSystem.GetBlockWithName("Azimuth Open Cockpit") as IMyCockpit;
     text    = GridTerminalSystem.GetBlockWithName("Text panel 6") as IMyTextPanel;
     Runtime.UpdateFrequency = UpdateFrequency.Update1;
 }
Exemple #4
0
        private void set_cursor_position(string name)
        {
            //find a block by name and point to it on the screen
            Echo("CURSING");
            IMyTerminalBlock block = GridTerminalSystem.GetBlockWithName(name);

            cursor_vec = block.Position;
            Echo("Found at:" + cursor_vec.ToString());
        }
Exemple #5
0
        public Program()
        {
            StepScheduler = new Scheduler(this);
            MyThruster    = new Thruster(this);

            IMyTextSurfaceProvider debugoutputblock = GridTerminalSystem.GetBlockWithName("LCD Panel debug") as IMyTextSurfaceProvider;

            debugoutput = debugoutputblock.GetSurface(0);
        }
Exemple #6
0
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update100;
            _debug = new Debug(this);

            //_ship_dock = GridTerminalSystem.GetBlockWithName("DRN-M: Connector") as IMyShipConnector;
            _ground_dock = GridTerminalSystem.GetBlockWithName("STN: Connector") as IMyShipConnector;
            //_remote_control = GridTerminalSystem.GetBlockWithName("DRN-M: Remote Control") as IMyRemoteControl;
        }
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update100;

            var confString = Me.CustomData;

            if (confString.Length == 0)
            {
                showConfHelp = true;
                return;
            }

            var conf = confString.Split(',');

            if (conf.Length != 4)
            {
                showConfHelp = true;
                help         = "\nInvalid Conf:\n" + confString;
                return;
            }
            cockpitId  = conf[0];
            displayNum = int.Parse(conf[1]);
            wgt1       = int.Parse(conf[2]);
            wgt2       = int.Parse(conf[3]);

            if (showConfHelp)
            {
                ShowHelp();
                return;
            }

            var cockpit = GridTerminalSystem.GetBlockWithName(cockpitId);

            if (cockpit == null)
            {
                help = "\nBad Cockpit Name";
                ShowHelp();
                return;
            }

            try {
                display = (cockpit as IMyTextSurfaceProvider).GetSurface(displayNum);
            } catch {
                help = "\nCould not get display surface";
                ShowHelp();
                return;
            }

            PrepareTextSurfaceForSprites(display);
            viewport = new RectangleF(
                (display.TextureSize - display.SurfaceSize) / 2f,
                display.SurfaceSize
                );

            inventories = GetInventories();
        }
Exemple #8
0
        private IMyTextSurface ParseSurfaceProperty(string surfaceDef, string warnPrefix = "WARNING: ")
        {
            string[]       fields = surfaceDef.Split(':');
            IMyTextSurface result = Me.GetSurface(0);

            string blockName  = fields[0];
            int    surfaceIdx = 0;

            if (fields.Length > 2)
            {
                Echo($"{warnPrefix}Awaiting maximum 2 fields, but got {fields.Length}. Ignoring unnecessary fields.");
            }

            if (fields.Length > 1)
            {
                try
                {
                    surfaceIdx = (int)ParseFloat(fields[1], $"Value of field #2 (display-nr) is not a number: {fields[1]}");
                }
                catch (Exception ex)
                {
                    Echo($"{warnPrefix}{ex.Message}. Using display-nr {surfaceIdx}.");
                }
            }

            IMyEntity ent = GridTerminalSystem.GetBlockWithName(blockName) as IMyEntity;

            if (ent == null)
            {
                Echo($"{warnPrefix}'{blockName}' not found on this grid. Using programmable block for output.");
            }
            else if (ent is IMyTextSurfaceProvider)
            {
                IMyTextSurfaceProvider provider = (IMyTextSurfaceProvider)ent;
                if (surfaceIdx >= provider.SurfaceCount)
                {
                    Echo($"{warnPrefix}You provided a display-nr {surfaceIdx} which '{blockName}' doesn't have (max. {provider.SurfaceCount - 1}). Using display-nr 0 instead.");
                    surfaceIdx = 0;
                }
                result = provider.GetSurface(surfaceIdx);
            }
            else if (ent is IMyTextSurface)
            {
                if (fields.Length == 2)
                {
                    Echo($"{warnPrefix}You provided a display-nr, but '{blockName}' is not providing multiple displays. Ignoring display-nr.");
                }
                result = (IMyTextSurface)ent;
            }
            else
            {
                Echo($"{warnPrefix}'{blockName}' is not valid. Using programmable block for output.");
            }

            return(result);
        }
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update100;

            inventoryDisplayMapping = new Dictionary <string, IMyTextPanel>();
            // ------------------------------ Begin things you can configure --------------------------

            /** These are the displays you need to run this. They're all mandatory and the script will fail if they don't exist.
             *  Create the 5 displays, name them to match the strings below, and set them to display text/images BEFORE
             *  running the script. If you read this after you ran the script, just do it and re-compile/rerun.
             */
            inventoryDisplayMapping["MyObjectBuilder_Ore"]       = GridTerminalSystem.GetBlockWithName("display_ore") as IMyTextPanel;
            inventoryDisplayMapping["MyObjectBuilder_Ingot"]     = GridTerminalSystem.GetBlockWithName("display_ingot") as IMyTextPanel;
            inventoryDisplayMapping["MyObjectBuilder_Component"] = GridTerminalSystem.GetBlockWithName("display_comp") as IMyTextPanel;
            _display_temp = GridTerminalSystem.GetBlockWithName("display_debug_temp") as IMyTextPanel;
            _display_perm = GridTerminalSystem.GetBlockWithName("display_debug_perm") as IMyTextPanel;

            // NOTE: For the system to create these items, you must have at least ONE of it already in your inventory.
            // Also NOTE: This script only takes into account the grid the prog block is part of, not subgrids.
            // The amount of each non-bulk item you want to have on hand at all times
            targetItemCount = 10000;
            // The amount of each bulk item you want to have on hand at all times (list of bulk items below)
            bulkItemCount = 20000;

            // List of items to create in bulk. You can add to or remove from this list, but be sure you're using the
            // name for the item that the code uses (Not always the same as in-game text).
            bulkItems = new HashSet <string>();
            bulkItems.Add("SteelPlate");
            bulkItems.Add("ConstructionComponent");
            bulkItems.Add("InteriorPlate");
            bulkItems.Add("ThrustComponent");
            bulkItems.Add("BulletproofGlass");
            // --------------------------------- End things you can configure ------------------------------------

            inventoryStats                                = new Dictionary <string, string>();
            buildingItemTypes                             = new[] { "Ore", "Ingot", "Component" };
            toolTypes                                     = new[] { "Weld", "Grind", "Drill", "Rifle" };
            inventoryToBlueprintMap                       = new Dictionary <string, string>();
            inventoryToBlueprintMap["Computer"]           = "ComputerComponent";
            inventoryToBlueprintMap["Construction"]       = "ConstructionComponent";
            inventoryToBlueprintMap["Detector"]           = "DetectorComponent";
            inventoryToBlueprintMap["Girder"]             = "GirderComponent";
            inventoryToBlueprintMap["Medical"]            = "MedicalComponent";
            inventoryToBlueprintMap["Motor"]              = "MotorComponent";
            inventoryToBlueprintMap["RadioCommunication"] = "RadioCommunicationComponent";
            inventoryToBlueprintMap["Thrust"]             = "ThrustComponent";
            inventoryToBlueprintMap["Reactor"]            = "ReactorComponent";
            inventoryToBlueprintMap["Reactor"]            = "ReactorComponent";
            inventoryToBlueprintMap["GravityGenerator"]   = "GravityGeneratorComponent";


            //blueprintToInventoryMap = inventoryToBlueprintMap.ToDictionary(i => i.Value, i => i.Key);
            tempItemList = new List <MyInventoryItem>();
            _logText     = new FixedSizedQueue <string>(15);
            unproducable = new HashSet <string>();
        }
Exemple #10
0
 public Program()
 {
     _logger   = new Logger(Me.GetSurface(0));
     _displays = new List <Display>();
     // _displays.Add(new Game(Me.GetSurface(0), this));
     _floor  = EnumerateFloor();
     _sensor = (IMySensorBlock)GridTerminalSystem.GetBlockWithName("F_SENSOR");
     Runtime.UpdateFrequency = UpdateFrequency.Once | UpdateFrequency.Update1;
     Log("Initialized");
 }
        public IMyTextPanel GetTextPanelWithName(string name)
        {
            IMyTextPanel p = GridTerminalSystem.GetBlockWithName(name) as IMyTextPanel;

            if (p == null)
            {
                Echo($"Could not find TextPanel named [{name}]");
            }
            return(p);
        }
    protected static IMyInventory GetInvWithName(string name, int idx)
    {
        IMyTerminalBlock blk = GridTerminalSystem.GetBlockWithName(name);

        if (blk == null)
        {
            return(null);
        }
        return(blk.GetInventory(idx));
    }
        /// отключаем соединитель
        private void mergeUnlock()
        {
            IMyShipMergeBlock merge = GridTerminalSystem.GetBlockWithName(NAME_MERGE_BLOCK) as IMyShipMergeBlock;

            if (!merge.Enabled)
            {
                merge.Enabled = true;
            }
            merge.Enabled = false;
        }
Exemple #14
0
 public Program()
 {
     var gyros = new List<IMyGyro>();
     var thrusters = new List<IMyThrust>();
     GridTerminalSystem.GetBlocksOfType(gyros);
     GridTerminalSystem.GetBlocksOfType(thrusters);
     shipController = GridTerminalSystem.GetBlockWithName("Controller") as IMyShipController;
     gridControl = new GridControl(gyros, thrusters, shipController);
     Runtime.UpdateFrequency = UpdateFrequency.Update1;
 }
Exemple #15
0
 public Program()
 {
     Runtime.UpdateFrequency = UpdateFrequency.Update1;
     camera  = GridTerminalSystem.GetBlockWithName("camera (atmo miner)") as IMyCameraBlock;
     rotor1  = GridTerminalSystem.GetBlockWithName("rotor 1 (cam)") as IMyMotorStator;
     rotor2  = GridTerminalSystem.GetBlockWithName("rotor 2 (cam)") as IMyMotorStator;
     cockpit = GridTerminalSystem.GetBlockWithName("Industrial Cockpit (atmo miner)") as IMyShipController;
     gyros   = new List <IMyGyro>();
     GridTerminalSystem.GetBlocksOfType <IMyGyro>(gyros);
 }
Exemple #16
0
        private void UpdateControlStatus(IMyTextSurface surface)
        {
            var hydrogen_control = GridTerminalSystem.GetBlockWithName("Hydrogen Control Program") as IMyProgrammableBlock;

            surface.WriteText(String.Format(
                                  "- Control Status\nHydrogen Engines {0}\nAir: {1}",
                                  hydrogen_control.CustomData,
                                  GetRoomPressure()
                                  ));
        }
Exemple #17
0
        public Program()
        {
            myBlockGroupMainThruster = new List <IMyTerminalBlock>();
            myBlockGroupMain         = new List <IMyTerminalBlock>();

            cockpit = GridTerminalSystem.GetBlockWithName("Azimuth Open Cockpit No Oxygen 3") as IMyCockpit;
            text    = GridTerminalSystem.GetBlockWithName("LCD Panel") as IMyTextPanel;

            Runtime.UpdateFrequency = UpdateFrequency.Update1;
        }
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update100;
            Setup();
            // delete me
            var rotor = GridTerminalSystem.GetBlockWithName("Builder Rotor 2") as IMyMotorStator;

            rotor.TargetVelocityRPM = 0.1f;
            //
        }
Exemple #19
0
 public Program()
 {
     cockpit                 = (IMyCockpit)GridTerminalSystem.GetBlockWithName("drill_cockpit");
     piston_y                = (IMyPistonBase)GridTerminalSystem.GetBlockWithName("piston_y");
     piston_z                = (IMyPistonBase)GridTerminalSystem.GetBlockWithName("piston_z");
     rotor                   = (IMyMotorStator)GridTerminalSystem.GetBlockWithName("circle_rotor");
     cockpit_lcd             = (IMyTextSurface)cockpit.GetSurface(4);
     cockpit_lcd.ContentType = ContentType.TEXT_AND_IMAGE;
     Runtime.UpdateFrequency = UpdateFrequency.Update10;
 }
Exemple #20
0
        public Program()
        {
            var pistonGroup = GridTerminalSystem.GetBlockGroupWithName("Drill Rig Pistons");

            pistonGroup.GetBlocksOfType(_pistons);
            var drillGroup = GridTerminalSystem.GetBlockGroupWithName("Drill Rig Drills");

            drillGroup.GetBlocksOfType(_drills);
            _drillHeadRotor = GridTerminalSystem.GetBlockWithName("Rotor Drill Head") as IMyMotorAdvancedStator;
        }
Exemple #21
0
        public Program()
        {
            cockpit = GridTerminalSystem.GetBlockWithName("Azimuth Open Cockpit") as IMyCockpit;
            roterR1 = GridTerminalSystem.GetBlockWithName("Rotor") as IMyMotorStator;
            // roterR2 = GridTerminalSystem.GetBlockWithName("Rotor2") as IMyMotorStator;
            // roterR3 = GridTerminalSystem.GetBlockWithName("Rotor3") as IMyMotorStator;
            Runtime.UpdateFrequency = UpdateFrequency.Update1;

            motors.Add(new motorBase(roterR1, false, 0, 0));
        }
Exemple #22
0
    public Program()
    {
        //Ищем блоки.
        rotorAz   = GridTerminalSystem.GetBlockWithName("[SSB-s] RotorAzimuth") as IMyMotorStator;
        solar     = GridTerminalSystem.GetBlockWithName("[SSB-s] Solar panel 1") as IMySolarPanel;
        text      = Me.GetSurface(0);
        textPanel = GridTerminalSystem.GetBlockWithName("[SSB-s] LCD-Solar") as IMyTextPanel;

        Runtime.UpdateFrequency = UpdateFrequency.Update1;
    }
        void ProfilerReset()
        {
            profilerCount = 1;
            profile       = new StringBuilder();
            var screen = GridTerminalSystem.GetBlockWithName("DEBUG") as IMyTextPanel;

            screen?.WriteText("");
//            screen?.WritePublicText("");
            profilerHasWritten = false;
        }
Exemple #24
0
 public void SaveData()
 {
     userIpPanel = (IMyTextPanel)GridTerminalSystem.GetBlockWithName(lcdSavePanel);
     string[] ips = userIpPanel.GetText().Split(' ');
     for (int i = 0; i < ips.Length; i++)
     {
         knownIp.Add(ips[i]);
         Echo(ips[i]);
     }
 }
Exemple #25
0
        public void Main()
        {
            string        outputText;
            var           airVent                     = GridTerminalSystem.GetBlockWithName("AirLockVent") as IMyAirVent;
            var           airLockOutterDoor           = GridTerminalSystem.GetBlockWithName("AirlockOutterDoor") as IMyAirtightSlideDoor;
            var           airLockInnderDoorCockpit    = GridTerminalSystem.GetBlockWithName("AirlockInnerDoorCockpit") as IMyAirtightSlideDoor;
            var           airLockInnderDoorProcessing = GridTerminalSystem.GetBlockWithName("AirlockInnerDoorProcessing") as IMyAirtightSlideDoor;
            IMyBlockGroup lcdPanelsGroup              = GridTerminalSystem.GetBlockGroupWithName("AirLockPanels");
            var           oxygenLevel                 = airVent.GetOxygenLevel();

            if (lcdPanelsGroup == null)
            {
                Echo("Lcd Panels not found");
                return;
            }

            List <IMyTextPanel> textPanels = new List <IMyTextPanel>();

            lcdPanelsGroup.GetBlocksOfType(textPanels);
            foreach (var textPanel in textPanels)
            {
                outputText = airVent.CustomName + "'s Pressure: " + String.Format("{0:P2}", oxygenLevel);
                textPanel.WriteText(
                    outputText + "\n" +
                    "Pressure Unedited: " + oxygenLevel + "\n" +
                    "Inner Door Cockpit: " + airLockInnderDoorCockpit.Status + "\n" +
                    "Inner Door Processing Room: " + airLockInnderDoorCockpit.Status + "\n" +
                    "Outter Door Open: " + airLockOutterDoor.Status + "\n" +
                    "Vent Status: " + airVent.Status);
            }
            if (airVent.Depressurize)
            {
                airLockInnderDoorCockpit.CloseDoor();
                airLockInnderDoorProcessing.CloseDoor();
                airLockOutterDoor.Enabled = true;
                if (oxygenLevel <= 0.0)
                {
                    airLockInnderDoorCockpit.Enabled    = false;
                    airLockInnderDoorProcessing.Enabled = false;
                    airLockOutterDoor.OpenDoor();
                }
            }
            else if (airVent.PressurizationEnabled)
            {
                airLockOutterDoor.CloseDoor();
                airLockInnderDoorCockpit.Enabled    = true;
                airLockInnderDoorProcessing.Enabled = true;
                if (oxygenLevel >= 1.0f)
                {
                    airLockOutterDoor.Enabled = false;
                    airLockInnderDoorCockpit.OpenDoor();
                    airLockInnderDoorProcessing.OpenDoor();
                }
            }
        }
        // 0000


        public Program()
        {
            // 0000
            Runtime.UpdateFrequency = UpdateFrequency.Update10;
            tribalSensor            = GridTerminalSystem.GetBlockWithName("sensor1") as IMySensorBlock;
            List <IMyGravityGenerator> gravity = new List <IMyGravityGenerator>();

            GridTerminalSystem.GetBlocksOfType <IMyGravityGenerator>(gravity);
            gravGen = gravity[0];
            // 0000
        }
        public void output(object input)
        {
            string         output = input is string?(string)input : input.ToString();
            IMyTextSurface surf   = GridTerminalSystem.GetBlockWithName("OutputTest") as IMyTextSurface;

            if (surf == null)
            {
                return;
            }
            surf.WriteText(output, false);
        }
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update1;

            IMyBlockGroup batteryGroup = GridTerminalSystem.GetBlockGroupWithName("Base Batteries");

            batteryGroup.GetBlocks(batteryTerminalBlocks);

            lcd = GridTerminalSystem.GetBlockWithName("Power Status LCD") as IMyTextPanel;
            //light = GridTerminalSystem.GetBlockWithName("light") as IMyInteriorLight;
        }
Exemple #29
0
        public Program()
        {
            cockpit = GridTerminalSystem.GetBlockWithName("Control Stations") as IMyCockpit;
            roterR1 = GridTerminalSystem.GetBlockWithName("LargeAdvancedRingStator 2") as IMyMotorStator;
            roterR2 = GridTerminalSystem.GetBlockWithName("Two-ended Motor") as IMyMotorStator;
            // roterR3 = GridTerminalSystem.GetBlockWithName("Rotor3") as IMyMotorStator;
            Runtime.UpdateFrequency = UpdateFrequency.Update1;

            motors.Add(new motorBase(roterR1, false, 0, 0));
            motors.Add(new motorBase(roterR2, false, 0, 0));
        }
        public Program()
        {
            remCon = GridTerminalSystem.GetBlockWithName(REMCON_NAME) as IMyRemoteControl;

            GridTerminalSystem.GetBlockGroupWithName(GYRO_NAME).GetBlocks(blocks);
            GetGyros(gyros, blocks);
            GridTerminalSystem.GetBlockGroupWithName(THRUSTERS_FORWARD_NAME).GetBlocks(blocks);
            GetThrusts(thrusts, blocks);

            Runtime.UpdateFrequency = UpdateFrequency.Update10;
        }