Space Engineers

Space Engineers

Nincs elegendő értékelés
Script checks turrets v1.1
   
Díjazás
Kedvenc
Kedvenc
Törlés
Fájlméret:
Közzétéve:
Frissítve:
845.000 B
2015. jan. 29., 0:30
2015. jan. 29., 0:56
2 változásjegyzék ( megnézés )

Feliratkozás a letöltéshez
Script checks turrets v1.1

Leírás
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 megjegyzés
Roon_Boh  [készítő] 2015. márc. 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. febr. 14., 5:34 
Can condition of OK or normal error output be written to a text panel and a light triggered if not ok?