1
0
Fork 0
A320-family/Nasal/Systems/ground_services.nas

90 lines
2.2 KiB
Text
Raw Normal View History

2019-10-14 16:48:35 +00:00
# A32X Ground Services
# D-ECHO, adapted from omega95
var door = aircraft.door.new("/services/deicing_truck/crane", 20);
var door3 = aircraft.door.new("/services/deicing_truck/deicing", 20);
var ground_services = {
init : func {
me.UPDATE_INTERVAL = 0.1;
me.loopid = 0;
me.ice_time = 0;
# Catering Truck
2020-02-07 16:10:54 +00:00
setprop("services/catering/scissor-deg", 0);
setprop("services/catering/position-norm", 0);
2019-10-14 16:48:35 +00:00
# De-icing Truck
2020-02-07 16:10:54 +00:00
setprop("services/deicing_truck/enable", 0);
setprop("services/deicing_truck/de-ice", 0);
2019-10-14 16:48:35 +00:00
# Set them all to 0 if the aircraft is not stationary
2020-02-07 16:10:54 +00:00
if (getprop("velocities/groundspeed-kt") >= 2) {
setprop("services/chocks/nose", 0);
setprop("services/chocks/left", 0);
setprop("services/chocks/right", 0);
setprop("services/fuel-truck/enable", 0);
setprop("services/deicing_truck/enable", 0);
setprop("services/catering/enable", 0);
2019-10-14 16:48:35 +00:00
}
me.reset();
},
update : func {
# Catering Truck Controls
2020-02-07 16:10:54 +00:00
var cater_pos = getprop("services/catering/position-norm");
2019-10-14 16:48:35 +00:00
var scissor_deg = 3.325 * (1/D2R) * math.asin(cater_pos / (2 * 3.6612));
2020-02-07 16:10:54 +00:00
setprop("services/catering/scissor-deg", scissor_deg);
2019-10-14 16:48:35 +00:00
# De-icing Truck
2020-02-07 16:10:54 +00:00
if (getprop("services/deicing_truck/enable") and getprop("services/deicing_truck/de-ice")) {
2019-10-14 16:48:35 +00:00
if (me.ice_time == 2) {
door.move(1);
ground_message ("Lifting De-icing Crane...");
}
if (me.ice_time == 220) {
door3.move(1);
ground_message ("Starting De-icing Process...");
}
if (me.ice_time == 420) {
door3.move(0);
ground_message ("De-icing Process Completed...");
}
if (me.ice_time == 650) {
door.move(0);
ground_message ("Lowering De-icing Crane...");
}
if (me.ice_time == 900) {
ground_message("De-icing Completed!", 1, 1, 1);
2020-02-07 16:10:54 +00:00
setprop("services/deicing_truck/de-ice", 0);
2019-10-14 16:48:35 +00:00
}
} else {
me.ice_time = 0;
}
me.ice_time += 1;
},
reset : func {
me.loopid += 1;
me._loop_(me.loopid);
},
_loop_ : func(id) {
id == me.loopid or return;
me.update();
settimer(func { me._loop_(id); }, me.UPDATE_INTERVAL);
}
};
var ground_message = func (string) {
2020-02-07 16:10:54 +00:00
setprop("sim/messages/ground", string);
2019-10-14 16:48:35 +00:00
}
setlistener("sim/signals/fdm-initialized", func {
ground_services.init();
});