Space Engineers

Space Engineers

評價次數不足
Script checks turrets v1.1
   
獎勵
加入最愛
已加入最愛
移除最愛
檔案大小
發佈於
更新時間
845.000 B
2015 年 1 月 29 日 上午 12:30
2015 年 1 月 29 日 上午 12:56
2 項更新註記 (檢視)

訂閱以下載
Script checks turrets v1.1

描述
script checks the integrity and number of turrets.
This simple and easy to configure script checks the number of turrets and their performance.


// Change these string

const int TURRETS_COUNT = 3;
const bool TURRETS_ALARM_ON = true; // true/false true -on all TURRETS if alarm
const string ACTION_TIMERS_NAME = "Timer Block action";
const string TEXT_BLOCKS_NAME = "error log";


// Roon_Booh by for MagariSimoku 29/01/2015
List<IMyTerminalBlock> baseTurrets = new List<IMyTerminalBlock>();
List<IMyTerminalBlock> actionTimers = new List<IMyTerminalBlock>();
List<IMyTerminalBlock> alarmLogBlocks = new List<IMyTerminalBlock>();


void Main() {

baseTurrets.Clear();
actionTimers.Clear();

GridTerminalSystem.GetBlocksOfType<IMyLargeTurretBase>(baseTurrets);
GridTerminalSystem.SearchBlocksOfName(ACTION_TIMERS_NAME, actionTimers);
GridTerminalSystem.SearchBlocksOfName(TEXT_BLOCKS_NAME, alarmLogBlocks);

bool alarmAction = false;
string text = TEXT_BLOCKS_NAME + "\n";

for (int a = 0; a < baseTurrets.Count; a++) {
if (!baseTurrets[a].IsFunctional) {
alarmAction = true;
text += baseTurrets[a].CustomName + " broken\n";
}
else if (baseTurrets[a].IsBeingHacked) {
alarmAction = true;
text += baseTurrets[a].CustomName + " cracked\n";
}
}

if (baseTurrets.Count < TURRETS_COUNT) {
alarmAction = true;
text += (baseTurrets.Count + "/" + TURRETS_COUNT + " Destroy Blocks\n");
}

for (int ia = 0; ia < alarmLogBlocks.Count; ia++) {
alarmLogBlocks[ia].SetCustomName(text);
}

if (alarmAction == true) {
for (int j = 0; j < actionTimers.Count; j++) {
actionTimers[j].GetActionWithName("OnOff_On").Apply(actionTimers[j]);
actionTimers[j].GetActionWithName("Stop").Apply(actionTimers[j]);
actionTimers[j].GetActionWithName("TriggerNow").Apply(actionTimers[j]);
}

if (TURRETS_ALARM_ON) {
for (int x1 = 0; x1 < baseTurrets.Count; x1++) {
baseTurrets[x1].GetActionWithName("OnOff_On").Apply(baseTurrets[x1]);
}
}
}
//group.Blocks.IsFunctional
}
2 則留言
Roon_Boh  [作者] 2015 年 3 月 7 日 上午 11:11 
I can make the necessary changes, but I do not know what method to write in text or LSD panel. The light can be turned on, alarming clock, so the script when obnoruzhenii fault turret or its absence activate an alarm timer, and if the mood in your script that includes all the turret.
Weyrman Albie 2015 年 2 月 14 日 上午 5:34 
Can condition of OK or normal error output be written to a text panel and a light triggered if not ok?