17 lines
519 B
Plaintext
17 lines
519 B
Plaintext
function evcalc { //returns the average exaust velocity of active engines. to convert to isp, divide by constant:g0
|
|
local englist is list().
|
|
local totalflow is 0.
|
|
local totalthrust is 0.
|
|
list engines in englist.
|
|
for eng in englist {
|
|
if eng:ignition and not eng:flameout {
|
|
set totalflow to totalflow + (eng:possiblethrust /(eng:isp * constant:g0)).
|
|
set totalthrust to totalthrust + eng:possiblethrust.
|
|
}
|
|
}
|
|
if totalthrust = 0 { //avoid div by 0 later
|
|
return 1.
|
|
}
|
|
return (totalthrust / totalflow).
|
|
}
|