public DangerLights(IMyGridTerminalSystem mts) { IMyMotorStator[] upperMotors = new IMyMotorStator[dangerUpperMotorCount]; IMyLightingBlock[] upperLights = new IMyLightingBlock[dangerUpperLightCount]; IMyMotorStator[] lowerMotors = new IMyMotorStator[dangerLowerMotorCount]; IMyLightingBlock[] lowerLights = new IMyLightingBlock[dangerLowerLightCount]; for (int i = 0; i < dangerUpperMotorCount; i++) { upperMotors[i] = mts.GetBlockWithName("[Base]DoorDangerUpperMotor" + i) as IMyMotorStator; upperMotors[i].TargetVelocityRPM = 0; } for (int i = 0; i < dangerUpperLightCount; i++) { upperLights[i] = mts.GetBlockWithName("[Base]DoorDangerUpperLight" + i) as IMyLightingBlock; upperLights[i].Enabled = false; } for (int i = 0; i < dangerLowerMotorCount; i++) { lowerMotors[i] = mts.GetBlockWithName("[Base]DoorDangerLowerMotor" + i) as IMyMotorStator; lowerMotors[i].TargetVelocityRPM = 0; } for (int i = 0; i < dangerLowerLightCount; i++) { lowerLights[i] = mts.GetBlockWithName("[Base]DoorDangerLowerLight" + i) as IMyLightingBlock; lowerLights[i].Enabled = false; } upperLightGroup = new DangerLightGroup(upperMotors, upperLights); lowerLightGroup = new DangerLightGroup(lowerMotors, lowerLights); }
void Main() { self = GridTerminalSystem; var light = self.GetBlockWithName("Inventory Full Light"); if (light == null) { return; } var l = new List <IMyTerminalBlock> (); self.GetBlocksOfType <IMyCargoContainer> (l); List <IMyCargoContainer> cargo = this.GetBlockOfType <IMyCargoContainer> (); if (All <IMyCargoContainer> (cargo, (c => c.GetInventory(0).IsFull))) { light.ApplyAction("OnOff_On"); } else { light.ApplyAction("OnOff_Off"); } var timer = (IMyTimerBlock)self.GetBlockWithName("Timer Block"); timer.ApplyAction("Start"); }
public Doors(IMyGridTerminalSystem gts) { tlM = gts.GetBlockWithName("[Base]tlM") as IMyMotorStator; trM = gts.GetBlockWithName("[Base]trM") as IMyMotorStator; blM = gts.GetBlockWithName("[Base]blM") as IMyMotorStator; brm = gts.GetBlockWithName("[Base]brM") as IMyMotorStator; }
public Program() { #region Constructor Help /* The constructor, called only once every session and * // always before any other method is called. Use it to * // initialize your script. * // * // The constructor is optional and can be removed if not * // needed. * // * // It's recommended to set RuntimeInfo.UpdateFrequency * // here, which will allow your script to run itself without a * timer block.*/ #endregion _timer = GridTerminalSystem.GetBlockWithName("MRF_Timer") as IMyTimerBlock; _lOn = GridTerminalSystem.GetBlockWithName("MRF_lOn") as IMyInteriorLight; _lOff = GridTerminalSystem.GetBlockWithName("MRF_lOff") as IMyInteriorLight; _rotor = GridTerminalSystem.GetBlockWithName("MRF_Rotor") as IMyMotorStator; _debugPanel = GridTerminalSystem.GetBlockWithName("MRF_Debug") as IMyTextPanel; SetDrills(); _debugPanel.WriteText(string.Join(",", _drills.Select(d => d.Name))); }
/// <summary> /// 初始化主要文本面板 /// </summary> /// <param name="mainTextSurfaceNames"></param> /// <param name="myGridTerminalSystem"></param> /// <param name="me"></param> public static TextSurfacesModel InitTextSurface(IReadOnlyCollection <string> mainTextSurfaceNames, IMyGridTerminalSystem myGridTerminalSystem, IMyProgrammableBlock me) { var textSurfaces = new List <IMyTextSurface>(); foreach (string mainTextSurfaceName in mainTextSurfaceNames) { string[] trueNames = mainTextSurfaceName.Split('&'); if (trueNames.Length == 1) { var textSurface = myGridTerminalSystem.GetBlockWithName(trueNames[0]) as IMyTextSurface; textSurfaces.Add(textSurface); } else if (trueNames.Length == 2) { var index = Convert.ToInt32(trueNames[1]); var textSurfaceProvider = myGridTerminalSystem.GetBlockWithName(trueNames[0]) as IMyTextSurfaceProvider; if (textSurfaceProvider != null && textSurfaceProvider.SurfaceCount >= index) { textSurfaces.Add(textSurfaceProvider.GetSurface(index)); } } } textSurfaces.Add(me.GetSurface(0)); return(new TextSurfacesModel(textSurfaces)); }
// // http://steamcommunity.com/sharedfiles/filedetails/?id=360966557 // https://forum.keenswh.com/threads/pb-scripting-guide-how-to-use-self-updating.7398267/ // //---------------------------------------------------------------------------------------------------------------------- // Kopioitava koodi //---------------------------------------------------------------------------------------------------------------------- void Main() { // ------------ Auto update --------------- Runtime.UpdateFrequency = UpdateFrequency.Update10; // ------------ Definitions --------------- IMyTextPanel naytto1 = GridTerminalSystem.GetBlockWithName("Infoscreen") as IMyTextPanel; IMyCargoContainer cargo1 = GridTerminalSystem.GetBlockWithName("Hitsi cargo 1") as IMyCargoContainer; // ------------ Logic --------------- // --- Cargo 1 usage --- float usedVolume1 = 0.0f; float maxVolume1 = 0.0f; usedVolume1 = (float)cargo1.GetInventory(0).CurrentVolume; maxVolume1 += (float)cargo1.GetInventory(0).MaxVolume; float pctUsed1 = 100.0f * usedVolume1 / maxVolume1; // ------------ Screen writing --------------- naytto1.WritePublicText("\n\n\n\n Cargo-1 käytössä: " + (int)pctUsed1 + "%", false); naytto1.ShowPublicTextOnScreen(); }
public CameraTurret(IMyGridTerminalSystem gts, IProcessSpawner spawner) { this.camera = gts.GetBlockWithName("SMB Turret Camera") as IMyCameraBlock; this.pitch = gts.GetBlockWithName("SMB Camera Turret Rotor") as IMyMotorStator; this.yaw = gts.GetBlockWithName("SMB Camera Turret Base Rotor") as IMyMotorStator; gts.GetBlocksOfType(this.controllers); spawner.Spawn(this.main, "camera-turret"); }
public void Rescan(SystemState state, IMyGridTerminalSystem gts) { if (!string.IsNullOrEmpty(state.Static.OreStatusDisplayName)) { oreStatusScreen = (IMyTextPanel)gts.GetBlockWithName(state.Static.OreStatusDisplayName); } if (!string.IsNullOrEmpty(state.Static.IngotStatusDisplayName)) { ingotStatusScreen = (IMyTextPanel)gts.GetBlockWithName(state.Static.IngotStatusDisplayName); } }
public IMyTextSurface SetupPanel(string panelName) { IMyTextSurface surface = GridTerminalSystem.GetBlockWithName(panelName) as IMyTextSurface; if (surface == null) { return(null); } return(surface); }
private EngineModule BuildModule(StaticState.EngineModuleDef definition, RotorLimits limits, ref long hash) { var governing = gridTerminalSystem.GetBlockWithName(definition.GoverningRotorName) as IMyMotorStator; var opposing = gridTerminalSystem.GetBlockWithName(definition.OpposingRotorName) as IMyMotorStator; AddToHash(ref hash, governing?.EntityId ?? 0); AddToHash(ref hash, opposing?.EntityId ?? 0); var thrusters = GetThrusters(governing, opposing); return(new EngineModule(definition.Name, new FacingRotorPair(governing, opposing), limits, thrusters)); }
public SunTracker(IMyGridTerminalSystem terminal, string solarPanelName, string rotor1Name, string rotor2Name, System.Action <string> echo) { Error = false; trackingState = TrackingState.Sleep; this.echo = echo; solarPanel = terminal.GetBlockWithName(solarPanelName) as IMyPowerProducer; rotor1 = terminal.GetBlockWithName(rotor1Name) as IMyMotorStator; rotor2 = terminal.GetBlockWithName(rotor2Name) as IMyMotorStator; if (solarPanel == null) { echo("Unable to locate solar panel: " + solarPanelName); Error = true; } if (rotor1 == null) { echo("Unable to locate rotor: " + rotor1Name); Error = true; } if (!solarPanel.IsFunctional) { echo("Solar panel is not functional"); Error = true; } if (!rotor1.IsFunctional) { echo("Rotor is not functional"); Error = true; } if (rotor2 != null && !rotor2.IsFunctional) { echo("Rotor is not functional"); Error = true; return; } bestPower = currentPower; rotor1.TargetVelocityRPM = 0; if (rotor2 != null) { rotor2.TargetVelocityRPM = 0; } sleepWaitCount = waitForSleep - 1; }
static bool LookupSurface(string addr, IMyGridTerminalSystem gts, out IMyTerminalBlock block, out int surfid) { //finds a block and a surface that correspond to the given address string long blockid; block = null; surfid = 0; int sepidx = addr.LastIndexOf('/'); if (sepidx < 0) { sepidx = addr.Length; } if (addr[0] != '@') { block = gts.GetBlockWithName(addr.Substring(0, sepidx)); } else if (long.TryParse(addr.Substring(0, sepidx), out blockid)) { block = gts.GetBlockWithId(blockid); } var p = block as IMyTextSurfaceProvider; if (p == null) { return(false); } return((sepidx == addr.Length) || int.TryParse(addr.Substring(sepidx + 1), out surfid)); }
public Program() { gts = GridTerminalSystem; lcd = gts.GetBlockWithName("LCD") as IMyTextPanel; generator = new Random(); iterator = new IterableInt(1); int x = generator.Next() % (Size - BoxSize); int y = generator.Next() % (Size - BoxSize); int dX = generator.Next() % 2; int dY = generator.Next() % 2; position = new Vector2((float)x, (float)y); direction = new Vector2(dX == 0 ? -1f : 1f, dY % 2 == 0 ? -1f : 1f); buffer = new StringBuilder(Size * (Size + 1)); buffer.Append((char)0, Size * (Size + 1)); Inicialize(); Update(); Runtime.UpdateFrequency = UpdateFrequency.Update1; Echo("X " + x.ToString() + " Y " + y.ToString()); Echo("Hours " + DateTime.Now.Hour.ToString()); Echo(lcd.SurfaceSize.ToString()); }
public Dictionary <string, int> GetRequiredComponents() { IMyTextPanel panel = GridTerminalSystem.GetBlockWithName("TXTPNL") as IMyTextPanel; var blocks = Projector.RemainingBlocksPerType; char[] delimiters = new char[] { ',' }; char[] remove = new char[] { '[', ']' }; Dictionary <string, int> totalComponents = new Dictionary <string, int>(); foreach (var item in blocks) { string[] blockInfo = item.ToString().Trim(remove).Split(delimiters, StringSplitOptions.None); try { string blockName = blockInfo[0]; int amount = Convert.ToInt32(blockInfo[1]); BlueprintDefinitions.AddComponents(totalComponents, BlueprintDefinitions.GetBlockComponents(blockName), amount); } catch (Exception ex) { GridProgram.Echo($"Error in GetRequiredComponent() at {blockInfo[0]}:{blockInfo[1]} => {ex.Message}"); } // blockInfo[0] is blueprint, blockInfo[1] is number of required item } string output = ""; foreach (KeyValuePair <string, int> component in totalComponents) { output += component.Key.Replace("MyObjectBuilder_BlueprintDefinition/", "") + " " + component.Value.ToString() + "\n"; } panel.WriteText(output); return(totalComponents); }
public void WriteTextToPanel(string panelname, string text, bool append = false) { IMyTextPanel textpanel; try { textpanel = (IMyTextPanel)(GridTerminalSystem.GetBlockWithName(panelname)); } catch (InvalidCastException ex) { throw (new InvalidCastException(String.Format("The block with name \"{0}\" is not of type IMyTextPanel."), ex)); } if (textpanel != null) { textpanel.WritePublicText(text, append); textpanel.ShowTextureOnScreen(); textpanel.ShowPublicTextOnScreen(); } else { throw (new ArgumentException(String.Format("The name \"{0}\" does not match any blocks in the current grid."), "panelname")); } }
public DrillTower Build(StaticState.DrillTowerDef definition) { gridTerminalSystem.GetBlockGroupWithName(definition.PistonGroupName)?.GetBlocksOfType(local_static_pistons); gridTerminalSystem.GetBlockGroupWithName(definition.DrillGroupName)?.GetBlocksOfType(local_static_drills); gridTerminalSystem.GetBlockGroupWithName(definition.DrillClampsGroupName)?.GetBlocksOfType(local_static_clamps); gridTerminalSystem.GetBlocksOfType(local_static_floodlights, b => b.CustomName == definition.FloodlightsName); var rotor = gridTerminalSystem.GetBlockWithName(definition.RotorName) as IMyMotorStator; var display = gridTerminalSystem.GetBlockWithName(definition.DisplayName) as IMyTextPanel; var stacks = new PistonTopology().GetPistonStacks(local_static_pistons); var drills = new DrillHead(local_static_drills.ToArray()); var clamps = new ClampGroup(local_static_clamps.ToArray()); var lights = new LightGroup(local_static_floodlights.ToArray()); return(new DrillTower(stacks, drills, clamps, rotor, lights, display)); }
public Lights(IMyGridTerminalSystem gts) { lightGroups = new LightGroup[lightGroupCount]; for (int i = 0; i < lightGroupCount; i++) { List <IMyInteriorLight> lightGroup = new List <IMyInteriorLight>(); for (int j = 0; j < lightGroupSize; j++) { IMyInteriorLight light = gts.GetBlockWithName("Licht" + i + "." + j) as IMyInteriorLight; if (light == null) { string error = "Licht " + i + "." + j + " nicht gefunden."; } else { lightGroup.Add(light); light.Enabled = lightState; } } lightGroups[i] = new LightGroup(lightGroup.ToArray()); } }
public void CheckAssemblers(ref List <ControlObject> controlObjectList) { IMyGridTerminalSystem myGridTerminalSystem = null; List <IMyAssembler> gridAssemblers = new List <IMyAssembler>(); myGridTerminalSystem.GetBlocksOfType <IMyAssembler>(gridAssemblers); int assemblerFound = 0; foreach (ControlObject controlObject in controlObjectList) { assemblerFound = 0; for (var i = 0; i < controlObject.getAssemblersNames().Count; i++) { IMyAssembler assembler = (IMyAssembler)myGridTerminalSystem.GetBlockWithName(controlObject.getAssemblersNames()[i]); if (assembler != null) { controlObject.setAssemblers(assembler); assemblerFound++; } } controlObject.setQtdyOfAssemblersFound(assemblerFound); if (controlObject.getAssemblersNames().Count == assemblerFound) { controlObject.setFoundAllAssemblers(true); } else { controlObject.setFoundAllAssemblers(false); } } }
public void CheckProductionNeed(ref List <ControlObject> controlObjectList, ref FinalContainer finalContainer) { IMyGridTerminalSystem myGridTerminalSystem = null; IMyCargoContainer finalContainerUnico = null; foreach (ControlObject controlObject in controlObjectList) { MyItemType item = new MyItemType(controlObject.getComponentIDValue(), ""); for (int i = 0; i < finalContainer.getContainerName().Count(); i++) { finalContainerUnico = (IMyCargoContainer)myGridTerminalSystem.GetBlockWithName(finalContainer.getContainerName()[i]); if (finalContainerUnico != null) { MyInventoryItem myInventoryItem = (MyInventoryItem)finalContainerUnico.GetInventory().FindItem(item); if (myInventoryItem != null) { controlObject.setComponentsAmountProduced((int)myInventoryItem.Amount); controlObject.setComponentsAmountToProduce(controlObject.getComponetAmountKeepStorage() - controlObject.getComponentsAmountProduced()); } else { controlObject.setComponentsAmountProduced(controlObject.getComponetAmountKeepStorage()); controlObject.setComponentsAmountToProduce(controlObject.getComponetAmountKeepStorage()); } } } } }
public ConfigItem(MyIni _ini, string key, IMyGridTerminalSystem GridTerminalSystem) { this.BlockName = _ini.Get(key, "BlockName").ToString(); this.IsGroup = _ini.Get(key, "IsGroup").ToBoolean(); this.Speed = _ini.Get(key, "Speed").ToDouble(1); this.Disabled = _ini.Get(key, "Disabled").ToBoolean(); this.IsPiston = _ini.Get(key, "IsPiston").ToBoolean(); if (!this.IsGroup) { if (this.IsPiston) { this.Pistons.Add(GridTerminalSystem.GetBlockWithName(this.BlockName) as IMyPistonBase); if (Pistons.Count == 0) { throw new Exception($"Couldn't find piston group for {key}"); } } else { this.Rotors.Add(GridTerminalSystem.GetBlockWithName(this.BlockName) as IMyMotorStator); if (Rotors.Count == 0) { throw new Exception($"Couldn't find rotor group for {key}"); } } } else { IMyBlockGroup Blocks = GridTerminalSystem.GetBlockGroupWithName(this.BlockName); if (this.IsPiston) { Blocks.GetBlocksOfType <IMyPistonBase>(this.Pistons); if (Pistons.Count == 0) { throw new Exception($"Couldn't find pistons for {key}"); } } else { Blocks.GetBlocksOfType <IMyMotorStator>(this.Rotors); if (Rotors.Count == 0) { throw new Exception($"Couldn't find rotors for {key}"); } } } }
void initMandatoryField <T>(IMyGridTerminalSystem gts, string name, out T field) where T : class, IMyTerminalBlock { field = gts.GetBlockWithName(name) as T; if (field == null) { this.log($"Connector '{this.Name}': could not find {typeof(T)} '{name}'"); } }
Program() { gts = GridTerminalSystem; cockpit = gts.GetBlockWithName(COCKPIT) as IMyCockpit; sound = gts.GetBlockGroupWithName(SOUND) as IMySoundBlock; radar = new Radar(RADAR); arta = new Artillery(ARTA, cockpit, 1200, 900); Torpedos = new List <Torpedo>(); InitializeTorpedos(); WolfPackDelays = new List <int>(); lcd = gts.GetBlockWithName(LCD) as IMyTextPanel; if (lcd == null) { lcd = cockpit.GetSurface(0) as IMyTextPanel; } }
public void Main() { Logger = new StringBuilder(); Logger.AppendLine("Missing Components: "); Logger.AppendLine(); //Get inventories; cargo blocks, connectors, assemblers var cargo_blocks = new List <IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType <IMyCargoContainer>(cargo_blocks); var ass_blocks = new List <IMyAssembler>(); GridTerminalSystem.GetBlocksOfType <IMyAssembler>(ass_blocks); var conn_blocks = new List <IMyShipConnector>(); GridTerminalSystem.GetBlocksOfType <IMyShipConnector>(conn_blocks); cargo_blocks.InsertRange(0, ass_blocks); cargo_blocks.InsertRange(0, conn_blocks); var filtered_blocks = new List <IMyTerminalBlock>(); for (int i = 0; i < cargo_blocks.Count; ++i) { if (!CargoTargets.ContainsKey(cargo_blocks[i].CustomName)) { filtered_blocks.Add(cargo_blocks[i]); } } for (int i = 0; i < CargoTargets.Count; ++i) { var key = CargoTargets.Keys.ElementAt(i); var val = CargoTargets[key]; FillCargo(key, val, filtered_blocks); } var lcd = GridTerminalSystem.GetBlockWithName(LcdName) as IMyTextPanel; //lcd.WritePublicText(Logger.ToString(), false); lcd.WriteText(Logger.ToString(), false); Echo(Logger.ToString()); }
public static MyBatteryItemRenderer Find(IMyGridTerminalSystem gts, string name) { IMyBatteryBlock batteryBlock = gts.GetBlockWithName(name) as IMyBatteryBlock; if (batteryBlock == null) { return(null); } return(new MyBatteryItemRenderer(batteryBlock)); }
/// <summary> /// Appends block, from the grid, with the given name and type; to the end of a typed block list. /// </summary> /// <typeparam name="BlockType">Block type that is a subtype of IMyTerminalBlock.</typeparam> /// <param name="blockName">string containing custom name of block.</param> /// <param name="blockList">List of blocks of given type.</param> public void AppendBlockFromCustomName <BlockType>(string blockName, List <BlockType> blockList) where BlockType : IMyTerminalBlock { BlockType block; if ((block = (BlockType)gridTerminalSystem.GetBlockWithName(blockName)) == null) { throw new Exception("Block with name '" + blockName + "' does not exist in this grid."); } blockList.Add(block); }
public static MyPowerProductionItemRenderer Find(IMyGridTerminalSystem gts, string name) { IMyPowerProducer powerProducer = gts.GetBlockWithName(name) as IMyPowerProducer; if (powerProducer == null) { return(null); } return(new MyPowerProductionItemRenderer(powerProducer)); }
public Program() { InitLocales(); IMyBlockGroup ingotStorageGroup = GridTerminalSystem.GetBlockGroupWithName(INGOT_STORAGE_GROUP); ingotStorageGroup.GetBlocksOfType(ingots); panel = GridTerminalSystem.GetBlockWithName(PANEL_NAME) as IMyTextPanel; }
// // http://steamcommunity.com/sharedfiles/filedetails/?id=360966557 // https://forum.keenswh.com/threads/pb-scripting-guide-how-to-use-self-updating.7398267/ // //---------------------------------------------------------------------------------------------------------------------- // Kopioitava koodi //---------------------------------------------------------------------------------------------------------------------- void Main() { // ------------ Auto update --------------- Runtime.UpdateFrequency = UpdateFrequency.Update10; // ------------ Definitions --------------- IMyTextPanel naytto = GridTerminalSystem.GetBlockWithName("infoscreen") as IMyTextPanel; IMyPistonBase poraPiston = GridTerminalSystem.GetBlockWithName("Piston 1") as IMyPistonBase; IMyShipDrill drill = GridTerminalSystem.GetBlockWithName("Drill") as IMyShipDrill; float sijainti = 0.0f; float velocity = 0.0f; float maxdepth = 0.0f; string poratPaalla = null; // ------------ Logiikka --------------- if ((drill as IMyFunctionalBlock).Enabled == true) { poratPaalla = "Enabled"; } else { poratPaalla = "Disabled"; } sijainti = poraPiston.CurrentPosition; maxdepth = poraPiston.MaxLimit; velocity = poraPiston.Velocity; // ------------ Screen writing --------------- naytto.WritePublicText("Syvyys: " + sijainti.ToString("0.0") + " Velocity: " + velocity.ToString("0.0") + " Limit: " + maxdepth.ToString("0.0") + '\n', false); naytto.WritePublicText("Porat: " + poratPaalla, true); naytto.ShowPublicTextOnScreen(); }
public void OrganizeInventory(List <IMyCargoContainer> primaryStorage) { List <IMyInventory> inventories = GetInventories(); string componentStorageName = "Component Storage"; string oreIngotStorageName = "Ore and Ingot Storage"; string garbageStorageName = "Garbage Storage"; string gearStorageName = "Gear Storage"; IMyCargoContainer component = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(componentStorageName); IMyCargoContainer ironOre = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(oreIngotStorageName); IMyCargoContainer garbage = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(garbageStorageName); IMyCargoContainer gear = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(gearStorageName); if (component == null & ironOre == null) { primaryStorage[0].CustomName = componentStorageName; primaryStorage[1].CustomName = oreIngotStorageName; component = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(componentStorageName); ironOre = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(oreIngotStorageName); } else if (component == null) { primaryStorage[0].CustomName = componentStorageName; component = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(componentStorageName); } else if (ironOre == null) { primaryStorage[1].CustomName = oreIngotStorageName; ironOre = (IMyCargoContainer)GridTerminalSystem.GetBlockWithName(oreIngotStorageName); } for (int y = 0; y < inventories.Count; y++) { if (inventories[y].GetItems().Count > 0) { List <IMyInventoryItem> items = inventories[y].GetItems(); for (int x = 0; x < items.Count; x++) { Echo(inventories[y].CurrentMass.ToString()); IMyInventoryItem item; item = items[x]; inventories[y].TransferItemTo(component.GetInventory(), x, null, true, item.Amount); } } } }
private IMyTextPanel InitialiseDebugDisplay() { if (_block != null) { return(_block); } else { _block = _myGridTerminalSystem.GetBlockWithName(_name) as IMyTextPanel; } return(_block); }
public AutoHoverController(IMyGridTerminalSystem gts, IMyProgrammableBlock pb) { Me = pb; GridTerminalSystem = gts; remote = GridTerminalSystem.GetBlockWithName(RemoteControlName) as IMyRemoteControl; gyro = GridTerminalSystem.GetBlockWithName(GyroName) as IMyGyro; if (!String.IsNullOrEmpty(TextPanelName)) screen = GridTerminalSystem.GetBlockWithName(TextPanelName) as IMyTextPanel; var list = new List<IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType<IMyGyro>(list, x => x.CubeGrid == Me.CubeGrid && x != gyro); gyros = list.ConvertAll(x => (IMyGyro)x); gyros.Insert(0, gyro); gyros = gyros.GetRange(0, GyroCount); mode = "Hover"; setSpeed = 0; }