-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotAus.cs
66 lines (53 loc) · 1.78 KB
/
NotAus.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using Sandbox.Common;
using Sandbox.Common.Components;
using Sandbox.Common.ObjectBuilders;
using Sandbox.Definitions;
using Sandbox.Engine;
using Sandbox.Game;
using Sandbox.ModAPI.Ingame;
using Sandbox.ModAPI.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
using VRage;
namespace TestScript
{
public class NotAus : IngameScript
{
public static StringBuilder debug = new StringBuilder();
string debugName = "Debug";
void Main()
{
// initialize
var blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyShipController>(blocks, FilterShipController);
if (blocks.Count == 0)
throw new Exception("Did not find any cockpit.");
IMyShipController controller = blocks[0] as IMyShipController;
if (!controller.DampenersOverride)
{
controller.GetActionWithName("DampenersOverride").Apply(controller);
}
Debug(debug.ToString());
}
void Debug(String message)
{
var list = new List<IMyTerminalBlock>();
GridTerminalSystem.SearchBlocksOfName(debugName, list);
if (list.Count > 0)
list[0].SetCustomName(debugName + ":\n\r" + message);
}
static bool FilterShipController(IMyTerminalBlock block)
{
return !block.DefinitionDisplayNameText.Equals(cockpitSubtypes[0]);
}
public static string[] cockpitSubtypes = new string[]
{
"Passenger Seat",
"Flight Seat",
"Cockpit",
"Fighter Cockpit",
"Control Station"
};
}
}