Skip to content

Instantly share code, notes, and snippets.

@Krutonium
Created May 16, 2020 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krutonium/98b253804598e812db6dda5195d1f3ce to your computer and use it in GitHub Desktop.
Save Krutonium/98b253804598e812db6dda5195d1f3ce to your computer and use it in GitHub Desktop.
Doors aren't opening.
using Sandbox.Game.EntityComponents;
using Sandbox.ModAPI.Ingame;
using Sandbox.ModAPI.Interfaces;
using SpaceEngineers.Game.ModAPI.Ingame;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System;
using VRage.Collections;
using VRage.Game.Components;
using VRage.Game.GUI.TextPanel;
using VRage.Game.ModAPI.Ingame.Utilities;
using VRage.Game.ModAPI.Ingame;
using VRage.Game.ObjectBuilders.Definitions;
using VRage.Game;
using VRage;
using VRageMath;
using VRage.Audio;
namespace IngameScript
{
partial class Program : MyGridProgram
{
// This file contains your actual script.
//
// You can either keep all your code here, or you can create separate
// code files to make your program easier to navigate while coding.
//
// In order to add a new utility class, right-click on your project,
// select 'New' then 'Add Item...'. Now find the 'Space Engineers'
// category under 'Visual C# Items' on the left hand side, and select
// 'Utility Class' in the main area. Name it in the box below, and
// press OK. This utility class will be merged in with your code when
// deploying your final script.
//
// You can also simply create a new utility class manually, you don't
// have to use the template if you don't want to. Just do so the first
// time to see what a utility class looks like.
//
// Go to:
// https://github.com/malware-dev/MDK-SE/wiki/Quick-Introduction-to-Space-Engineers-Ingame-Scripts
//
// to learn more about ingame scripts.
List<IMyAirtightHangarDoor> hangars;
List<IMyDoor> doors;
public Program()
{
Runtime.UpdateFrequency = UpdateFrequency.Update10;
IMyBlockGroup hangarDoors = GridTerminalSystem.GetBlockGroupWithName("PRXB Hangar Port Entry Doors");
IMyBlockGroup hangarDoors2 = GridTerminalSystem.GetBlockGroupWithName("PRXB Hangar Starboard Entry Doors");
List<IMyAirtightHangarDoor> HG1 = new List<IMyAirtightHangarDoor>();
List<IMyAirtightHangarDoor> HG2 = new List<IMyAirtightHangarDoor>();
hangarDoors.GetBlocksOfType<IMyAirtightHangarDoor>(HG1);
hangarDoors2.GetBlocksOfType<IMyAirtightHangarDoor>(HG2);
HG1.AddRange(HG2);
//IMyBlockGroup SD1 = GridTerminalSystem.GetBlockGroupWithName("PRXB Port Doors");
//IMyBlockGroup SD2 = GridTerminalSystem.GetBlockGroupWithName("PRXB Starboard Doors");
//List<IMyDoor> LSD1 = new List<IMyDoor>();
//List<IMyDoor> LSD2 = new List<IMyDoor>();
//SD1.GetBlocksOfType<IMyDoor>(LSD1);
//SD2.GetBlocksOfType<IMyDoor>(LSD2);
//LSD1.AddRange(LSD2);
hangars = HG1;
//doors = LSD1;
}
public void Main(string argument, UpdateType updateSource)
{
bool shouldLock = false;
foreach(var door in hangars)
{
door.OpenDoor();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment