kOS/lib/systems.ks

53 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

function Antennas {
parameter enable is true.
local eventName is "Activate".
if not enable {
set eventName to "Deactivate".
}
for p in SHIP:PARTS {
if p:MODULES:Find("ModuleRTAntenna") > -1 and p:GetModule("ModuleRTAntenna"):ALLEVENTNAMES:Find(eventName) > -1 {
p:GetModule("ModuleRTAntenna"):DoEvent(eventName).
}
}
}
function SolarPanels {
parameter enable is true.
if enable {
PANELS on.
} else {
PANELS off.
}
}
function NoFuelResources {
parameter enable is true.
for part in SHIP:PartsTagged("nofuel") {
for resource in part:RESOURCES {
set resource:ENABLED to enable.
}
}
}
function PreLaunchCrossfeed {
parameter enable is true.
local eventName is "Disable Crossfeed".
if enable {
set eventName to "Enable Crossfeed".
}
for part in SHIP:PartsTagged("prelaunch") {
if part:MODULES:Find("ModuleToggleCrossfeed") = -1 {
print "Prelaunch part does not have crossfeed module. skipping.".
} else if part:GetModule("ModuleToggleCrossfeed"):ALLEVENTNAMES:Find(eventName) > -1 {
part:GetModule("ModuleToggleCrossfeed"):DoEvent(eventName).
}
}
}