forked from RCrockford/kOS-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckcontrol.ks
More file actions
22 lines (19 loc) · 712 Bytes
/
checkcontrol.ks
File metadata and controls
22 lines (19 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@lazyglobal off.
// Wait for unpack
wait until Ship:Unpacked.
local totalControlled is 0.
for a in Ship:ModulesNamed("ModuleProceduralAvionics")
{
local controllable is choose a:GetField("controllable") if a:HasField("Controllable") else 0.
set totalControlled to totalControlled + controllable.
}
for a in Ship:ModulesNamed("ModuleAvionics")
{
local controllable is choose a:GetField("controllable") if a:HasField("Controllable") else 0.
set totalControlled to totalControlled + controllable.
}
if Ship:Mass < totalControlled
print "Have avionics for control.".
else
print "Insufficient avionics for control.".
print " M=" + round(Ship:Mass, 3) + " C=" + round(totalControlled, 3).