-
Notifications
You must be signed in to change notification settings - Fork 29
MASFlightComputer
The MASFlightComputer is the core of Avionics Systems. All MAS-enabled props use the MASFlightComputer to process data, and it provides IVA creators a number of configuration options. IVA authors are required to include MASFlightComputer in the part config for the IVA's they create. Typically, this is done by using a ModuleManager node (see the examples in MOARdV/FlightSystems). User-configurable fields are provided below, along with their defaults. Optional override fields are listed as well.
MODULE
{
name = MASFlightComputer
gLimit = (a ridiculously large number)
baseDisruptionChance = 0.0
requiresPower = false
powerOnVariable = ""
PERSISTENT_VARIABLES
{
MAS_IMP_Mode_Select = 1
}
RPM_COLOROVERRIDE
{
COLORDEFINITION
{
// 'white' label unlit color
name = ASET_SWITCHER_NAME_ZEROCOLOR
color = 213, 213, 213, 255
}
}
}
- gLimit - The maximum number of gees that MASFlightComputer can sustain before there is a risk of power disruption. See below for more information on this feature.
- baseDisruptionChance - A number between 0 (never) and 1 (always) that controls the likelihood each FixedUpdate of g forces in excess of the gLimit causing a power disruption. See below for more information on this feature.
-
requiresPower - Indicates whether the craft running out of ElectricCharge (or whatever the power resource is in the MAS config file) can disrupt instruments. Setting this to
truecan cause instrumentation to black out if batteries are depleted. - powerOnVariable - An optional variable that is evaluated to control power disruption. See below for more information on this feature.
This is an optional node that may be used to pre-configure some persistent variables in the pod. Each persistent variable is listed on its own line, and it is assigned its initial value (either a number or a string). In the above example, the pod pre-configures the persistent variable MAS_IMP_Mode_Select to 1. If no persistent variables need configured, this node may be omitted.
This is an optional node that may be used to override or define named color definitions. Each override uses the standardized COLORDEFINITION node, as shown. If a specific override color was not previously defined, it is added to the local color definition table.
As mentioned above, the MASFlightComputer can be affected by high g-loads and/or lack of power. This capability allows for a more realistic experience during IVA flight.
There are two components to using power disruption:
The IVA creator can control the capability in general using the MASFlightComputer configuration options. For example, I've been using gLimit = 5, baseDisruptionChance = 0.20, and requiresPower = true.
requiresPower is a simple boolean - if it is true, and the craft's power is very close to zero (< 0.0001), all configured instruments will be disabled.
gLimit and baseDisruptionChance configure intermittent disruption effects. When the pod is subjected to a g-load equal to gLimit, there is a baseDisruptionChance chance each FixedUpdate that a given instrument is disabled. As the g-load increases, the disruption chance increases with the square root of the difference between the g-load and gLimit. That is, if gLimit is 5, and the pod is under a 9g load, the disruption chance is (sqrt(9-5) = ) 2 times baseDisruptionChance.
powerOnVariable is an optional MAS variable that may provide a per-IVA power control without having to duplicate props to add extra conditions. For instance, an IVA's lamps and gauges may require a master power circuit to be switched on. This behavior may be emulated by using powerOnVariable = fc.GetPersistentAsNumber("Cockpit_Master_Power"), with a circuit breaker prop configured to toggle "Cockpit_Master_Power".
The powerOnVariable is evaluated in Boolean mode. If the result of the variable is 0 or less, it will disrupt power. If the result is any positive value, it will not disrupt power.
The second component of this feature is the use of fc.Conditioned() for controlling variables. Any variable that should be affected by power disruption (such as lights, electrically-controlled gauges, etc) should have their condition variable wrapped in fc.Conditioned(). For example, a lamp that indicates landing gear are deployed would use fc.Conditioned(fc.GetGear()) instead of simply fc.GetGear().
By using fc.Conditioned(), only those props that are affected by electrical disruption will change - for instance, it would look weird if the throttle controls on a craft started jumping around because of g-loads, or they snapped to the off position if the batteries were dead.