A little example for the Space Engineers game, when one reactor is shutdown, and the other needs to be started. An when main is back On, the secondary is shutdown. Do not forget to add the timer block!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| const String PRI_REACTOR = "Primary Reactor";
const String SEC_REACTOR = "Secondary Reactor";
const String STATUS_PANEL = "Reactor status LCD";
void Main(string argument) {
var GTS = GridTerminalSystem;
IMyReactor pri = GTS.GetBlockWithName(PRI_REACTOR) as IMyReactor;
IMyReactor sec = GTS.GetBlockWithName(SEC_REACTOR) as IMyReactor;
IMyTextPanel panel = GTS.GetBlockWithName(STATUS_PANEL) as IMyTextPanel;
if (!pri.IsWorking) {
sec.ApplyAction("OnOff_On");
} else {
sec.ApplyAction("OnOff_Off");
}
rewrite(panel,
PRI_REACTOR + ": " + (pri.IsWorking?"On":"Off") + "\n" +
SEC_REACTOR + ": " + (sec.IsWorking?"On":"Off") + "\n");
}
void rewrite(IMyTextPanel panel, String text) {
panel.WritePublicText(text, false);
panel.ShowPublicTextOnScreen();
} |
const String PRI_REACTOR = "Primary Reactor";
const String SEC_REACTOR = "Secondary Reactor";
const String STATUS_PANEL = "Reactor status LCD";
void Main(string argument) {
var GTS = GridTerminalSystem;
IMyReactor pri = GTS.GetBlockWithName(PRI_REACTOR) as IMyReactor;
IMyReactor sec = GTS.GetBlockWithName(SEC_REACTOR) as IMyReactor;
IMyTextPanel panel = GTS.GetBlockWithName(STATUS_PANEL) as IMyTextPanel;
if (!pri.IsWorking) {
sec.ApplyAction("OnOff_On");
} else {
sec.ApplyAction("OnOff_Off");
}
rewrite(panel,
PRI_REACTOR + ": " + (pri.IsWorking?"On":"Off") + "\n" +
SEC_REACTOR + ": " + (sec.IsWorking?"On":"Off") + "\n");
}
void rewrite(IMyTextPanel panel, String text) {
panel.WritePublicText(text, false);
panel.ShowPublicTextOnScreen();
}