Space Engineers

Space Engineers

Sem avaliações suficientes
Script checks turrets v1.1
   
Premiar
Adic. a Favoritos
Nos Favoritos
Desfavoritar
Tamanho:
Publicado em:
Atualizado em:
845.000 B
29 jan. 2015 às 0:30
29 jan. 2015 às 0:56
2 notas de alterações ( ver )

Subscreve para transferir
Script checks turrets v1.1

Descrição
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 comentários
Roon_Boh  [autor] 7 mar. 2015 às 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 14 fev. 2015 às 5:34 
Can condition of OK or normal error output be written to a text panel and a light triggered if not ok?