A3XX: Code Cleanup, less garbage collecting nessesary = more FPS?
This commit is contained in:
parent
9bfc9f5f11
commit
4f307bf176
1 changed files with 51 additions and 25 deletions
|
@ -5,6 +5,33 @@
|
|||
# Init Vars #
|
||||
#############
|
||||
|
||||
setlistener("/sim/signals/fdm-initialized", func {
|
||||
var xfeed_sw = getprop("/controls/fuel/x-feed");
|
||||
var tank2pump1_sw = getprop("/controls/fuel/tank2pump1");
|
||||
var tank2pump2_sw = getprop("/controls/fuel/tank2pump2");
|
||||
var tank3pump1_sw = getprop("/controls/fuel/tank3pump1");
|
||||
var tank3pump2_sw = getprop("/controls/fuel/tank3pump2");
|
||||
var tank4pump1_sw = getprop("/controls/fuel/tank4pump1");
|
||||
var tank4pump2_sw = getprop("/controls/fuel/tank4pump2");
|
||||
var mode_sw = getprop("/controls/fuel/mode");
|
||||
var xfeed = getprop("/systems/fuel/x-feed");
|
||||
var ac1 = getprop("/systems/electrical/bus/ac1");
|
||||
var ac2 = getprop("/systems/electrical/bus/ac2");
|
||||
var gravityfeedL = getprop("/systems/fuel/gravityfeedL");
|
||||
var gravityfeedR = getprop("/systems/fuel/gravityfeedR");
|
||||
var gload = getprop("/accelerations/pilot-gdamped");
|
||||
var gravityfeedL_output = getprop("/systems/fuel/gravityfeedL-output");
|
||||
var gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output");
|
||||
var tank2feed0 = getprop("/systems/fuel/tank[2]/feed0");
|
||||
var tank2feed1 = getprop("/systems/fuel/tank[2]/feed1");
|
||||
var tank3feed0 = getprop("/systems/fuel/tank[3]/feed0");
|
||||
var tank3feed1 = getprop("/systems/fuel/tank[3]/feed1");
|
||||
var tank4feed0 = getprop("/systems/fuel/tank[4]/feed0");
|
||||
var tank4feed1 = getprop("/systems/fuel/tank[4]/feed1");
|
||||
var gravityfeedL = getprop("/systems/fuel/gravityfeedL");
|
||||
var gravityfeedR = getprop("/systems/fuel/gravityfeedR");
|
||||
});
|
||||
|
||||
var fuel_init = func {
|
||||
setprop("/systems/fuel/gravityfeedL", 0);
|
||||
setprop("/systems/fuel/gravityfeedR", 0);
|
||||
|
@ -33,20 +60,20 @@ var fuel_init = func {
|
|||
# Main Loops #
|
||||
##############
|
||||
var master_fuel = func {
|
||||
var xfeed_sw = getprop("/controls/fuel/x-feed");
|
||||
var tank2pump1_sw = getprop("/controls/fuel/tank2pump1");
|
||||
var tank2pump2_sw = getprop("/controls/fuel/tank2pump2");
|
||||
var tank3pump1_sw = getprop("/controls/fuel/tank3pump1");
|
||||
var tank3pump2_sw = getprop("/controls/fuel/tank3pump2");
|
||||
var tank4pump1_sw = getprop("/controls/fuel/tank4pump1");
|
||||
var tank4pump2_sw = getprop("/controls/fuel/tank4pump2");
|
||||
var mode_sw = getprop("/controls/fuel/mode");
|
||||
var xfeed = getprop("/systems/fuel/x-feed");
|
||||
var ac1 = getprop("/systems/electrical/bus/ac1");
|
||||
var ac2 = getprop("/systems/electrical/bus/ac2");
|
||||
var gravityfeedL = getprop("/systems/fuel/gravityfeedL");
|
||||
var gravityfeedR = getprop("/systems/fuel/gravityfeedR");
|
||||
var gload = getprop("/accelerations/pilot-gdamped");
|
||||
xfeed_sw = getprop("/controls/fuel/x-feed");
|
||||
tank2pump1_sw = getprop("/controls/fuel/tank2pump1");
|
||||
tank2pump2_sw = getprop("/controls/fuel/tank2pump2");
|
||||
tank3pump1_sw = getprop("/controls/fuel/tank3pump1");
|
||||
tank3pump2_sw = getprop("/controls/fuel/tank3pump2");
|
||||
tank4pump1_sw = getprop("/controls/fuel/tank4pump1");
|
||||
tank4pump2_sw = getprop("/controls/fuel/tank4pump2");
|
||||
mode_sw = getprop("/controls/fuel/mode");
|
||||
xfeed = getprop("/systems/fuel/x-feed");
|
||||
ac1 = getprop("/systems/electrical/bus/ac1");
|
||||
ac2 = getprop("/systems/electrical/bus/ac2");
|
||||
gravityfeedL = getprop("/systems/fuel/gravityfeedL");
|
||||
gravityfeedR = getprop("/systems/fuel/gravityfeedR");
|
||||
gload = getprop("/accelerations/pilot-gdamped");
|
||||
|
||||
if (gload >= 0.7 and gravityfeedL) {
|
||||
setprop("/systems/fuel/gravityfeedL-output", 1);
|
||||
|
@ -60,8 +87,8 @@ var master_fuel = func {
|
|||
setprop("/systems/fuel/gravityfeedR-output", 0);
|
||||
}
|
||||
|
||||
var gravityfeedL_output = getprop("/systems/fuel/gravityfeedL-output");
|
||||
var gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output");
|
||||
gravityfeedL_output = getprop("/systems/fuel/gravityfeedL-output");
|
||||
gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output");
|
||||
|
||||
if ((ac1 >= 110 or ac2 >= 110) and tank2pump1_sw) {
|
||||
setprop("/systems/fuel/tank[2]/feed0", 1);
|
||||
|
@ -113,12 +140,12 @@ var master_fuel = func {
|
|||
setprop("/systems/fuel/x-feed", 0);
|
||||
}
|
||||
|
||||
var tank2feed0 = getprop("/systems/fuel/tank[2]/feed0");
|
||||
var tank2feed1 = getprop("/systems/fuel/tank[2]/feed1");
|
||||
var tank3feed0 = getprop("/systems/fuel/tank[3]/feed0");
|
||||
var tank3feed1 = getprop("/systems/fuel/tank[3]/feed1");
|
||||
var tank4feed0 = getprop("/systems/fuel/tank[4]/feed0");
|
||||
var tank4feed1 = getprop("/systems/fuel/tank[4]/feed1");
|
||||
tank2feed0 = getprop("/systems/fuel/tank[2]/feed0");
|
||||
tank2feed1 = getprop("/systems/fuel/tank[2]/feed1");
|
||||
tank3feed0 = getprop("/systems/fuel/tank[3]/feed0");
|
||||
tank3feed1 = getprop("/systems/fuel/tank[3]/feed1");
|
||||
tank4feed0 = getprop("/systems/fuel/tank[4]/feed0");
|
||||
tank4feed1 = getprop("/systems/fuel/tank[4]/feed1");
|
||||
|
||||
if (((ac1 >= 110 or ac2 >= 110) and tank2pump1_sw and tank2pump1_sw)) {
|
||||
setprop("/systems/fuel/gravityfeedL", 0);
|
||||
|
@ -132,8 +159,8 @@ var master_fuel = func {
|
|||
setprop("/systems/fuel/gravityfeedR", 1);
|
||||
}
|
||||
|
||||
var gravityfeedL = getprop("/systems/fuel/gravityfeedL");
|
||||
var gravityfeedR = getprop("/systems/fuel/gravityfeedR");
|
||||
gravityfeedL = getprop("/systems/fuel/gravityfeedL");
|
||||
gravityfeedR = getprop("/systems/fuel/gravityfeedR");
|
||||
|
||||
if ((getprop("/fdm/jsbsim/propulsion/tank[3]/contents-lbs") >= 50) and tank3feed0 and tank3feed1 and !gravityfeedL and !gravityfeedR) {
|
||||
setprop("/systems/fuel/only-use-ctr-tank", 1);
|
||||
|
@ -151,4 +178,3 @@ var update_fuel = func {
|
|||
}
|
||||
|
||||
var fuel_timer = maketimer(0.2, update_fuel);
|
||||
|
||||
|
|
Reference in a new issue