Optimize fire code, remove un-needed setprop in ground_services

This commit is contained in:
Jonathan Redpath 2019-01-22 11:16:54 +00:00
parent aec704910f
commit fd652537cb
2 changed files with 23 additions and 23 deletions

View file

@ -81,24 +81,6 @@ var master_fire = func {
dcbat = getprop("/systems/electrical/bus/dcbat");
pause = getprop("/sim/freeze/master");
###################
# Detection Logic #
###################
if (fwddet) {
setprop("/controls/fire/cargo/fwdsmokeLight", 1);
setprop("/controls/fire/cargo/warnfwd", 1);
} else {
setprop("/controls/fire/cargo/fwdsmokeLight", 0);
}
if (aftdet) {
setprop("/controls/fire/cargo/aftsmokeLight", 1);
setprop("/controls/fire/cargo/warnaft", 1);
} else {
setprop("/controls/fire/cargo/aftsmokeLight", 0);
}
###############
# Discharging #
###############
@ -192,6 +174,28 @@ var master_fire = func {
}
###################
# Detection Logic #
###################
setlistener("/systems/failures/cargo-fwd-fire", func() {
if (getprop("/systems/failures/cargo-fwd-fire")) {
setprop("/controls/fire/cargo/fwdsmokeLight", 1);
setprop("/controls/fire/cargo/warnfwd", 1);
} else {
setprop("/controls/fire/cargo/fwdsmokeLight", 0);
}
}, 0, );
setlistener("/systems/failures/cargo-aft-fire", func() {
if (getprop("/systems/failures/cargo-aft-fire")) {
setprop("/controls/fire/cargo/aftsmokeLight", 1);
setprop("/controls/fire/cargo/warnaft", 1);
} else {
setprop("/controls/fire/cargo/aftsmokeLight", 0);
}
}, 0, );
###################
# Update Function #
###################
@ -200,5 +204,4 @@ var update_fire = func {
master_fire();
}
var fire_timer = maketimer(0.2, update_fire);
var fire_timer = maketimer(0.2, update_fire);

View file

@ -62,9 +62,6 @@ var ground_services = {
if (me.ice_time == 900) {
ground_message("De-icing Completed!", 1, 1, 1);
setprop("/services/deicing_truck/de-ice", 0);
setprop("/controls/ice/wing/temp", 30);
setprop("/controls/ice/wing/eng1", 30);
setprop("/controls/ice/wing/eng2", 30);
}
} else {