Skip to content
zer0Kerbal edited this page Aug 9, 2019 · 1 revision
<title>ODFC Documentation</title>

Here you'll find all the necessary ConfigNode definitions, including key/value pairs, for creating your own parts to use the ODFC module, or to augment the included parts. Note that everything contained within is case-sensitive.

These are the names of the nodes themselves, and are followed by braces in the configuration file, e.g. MODE { }. Items tagged (M) are mandatory, (R) are recommended, and (D) can be depended on if other values in other nodes are used. Any mandatory values in an optional node are mandatory only if the optional node is declared. Any value in <> is a placeholder for a type of variable, and can be entered multiple times as long as each name is unique within that node.

Parent: PART
Children: FSHORT (R), MODE (M)
Values: name (M), ScaleHack, EmitCoeff
Required: 1
Notes: See the documentation on the KSP wiki for more information.
Parent: MODULE
Children: None
Values: <ResourceShorthand> (M)
Required: 0 to 1; 1 strongly recommended
Notes: Should always be used in order to avoid graphical display issues (text being too long) in KSP's tweakables, especially if any FUELS contain multiple resources.
Parent: MODULE
Children: FUELS (M), BYPRODUCTS, TANKS, LIGHTS, EMITTERS (D), EMITSCALE
Values: MaxEC (R)
Required: > 0; 2 to 4 strongly recommended
Notes: Each "MODE" defines one method in which a fuel cell can operate. Users can cycle between modes using a tweakable button, or defined action groups.
Parent: MODE
Children: None
Values: <ResourceRate> (M)
Required: > 0
Notes: Holds a list of all fuels to be consumed while the fuel cell is in nominal operation in this mode.
Parent: MODE
Children: None
Values: <ResourceRate> (M)
Required: No
Notes: Byproducts are created during nominal operation of the fuel cell in a given mode, and can be beneficial or harmful (e.g., if creating a fuel cell to work with TACLS, you might make one that uses Hydrogen + Oxidizer and creates Water as a byproduct, or some other combination of fuels that creates Waste).
Parent: MODE
Children: None
Values: <TankValue> (M)
Required: No
Notes: Holds a list of names of mesh GameObject names and their respective textures to be used while the fuel cell is in this mode.
Parent: MODE
Children: None
Values: <LightValue> (M)
Required: No
Notes: Holds a list of names of light GameObject names and their respective colors to be used while the fuel cell is in this mode.
Parent: MODE
Children: None
Values: <EmitterValue> (M)
Required: Depends; A matching (name-equivalent) entry to all values declared in EMITSCALE must be declared.
Notes: Holds a list of names of KSPParticleEmitter GameObject names and their respective color arrays to be used while the fuel cell is in this mode. It's best to declare these even if you do not plan on ever changing the colors from what is in the base model, if only so that you can use the EMITSCALE feature.
Parent: MODE
Children: None
Values: <EmitterScale> (M)
Required: No
Notes: Holds a list of names of KSPParticleEmitter GameObject names and their flow rates (Emission) relative to EmitCoeff to be used while the fuel cell is in this mode. Note that this requires a corresponding (identical name) entry in EMITTERS to work properly.

There are two value name types, predefined strings and user-defined strings (which must refer to an object of the appropriate type). User-defined strings are noted by the name being enclosed in <> brackets.

Used In: MODULE
Value Type: String
Default Value:
Required: Yes
Notes: Must be set to "ODFC" (sans-quotes). This is how KSP knows which plugin to use for the part behavior of a given MODULE.
Used In: MODULE
Value Type: Float
Default Value: 1.0
Required: No
Notes: This is to hack around scaling of certain elements in KSP that are not automatically scaled along with meshes. Set this to be whatever value you are scaling your model by.
Used In: MODULE
Value Type: Int
Default Value: 50
Required: No
Notes: This is used as a coefficient when calculating how many particles an emitter will emit (known as "emission"), and will be equal to the emission when the <EmitterScale> for an <EmitterValue> = 1, and the fuel cell is operating at 100% rated capacity (before the effects of rate limiting). It is not a strict limit on individual or total emission values. For performance reasons, I recommend having no more than a combined total of 100 emission for any part in any configuration. There are two easy ways to do this: by setting EmitCoeff to 100, and ensuring the sum of all <EmitterScale> values are <= 1, or by setting EmitCoeff to 100 / n (where 'n' is your <EmitterValue> count) and making sure the sum of all <EmitterScale> values are <= n. The stock parts in this mod are configured to do the latter.
Used In: MODE
Value Type: Float
Default Value: 10
Required: No, but strongly recommended
Notes: This is the maximum amount of ElectricCharge per second that a nominal fuel cell in this mode can generate, assuming no rate limiting. The default value is merely an internal requirement, and should not be used as a guideline for balance. Instead, refer to the bundled parts for balance recommendations. Lastly, note that this value has a direct impact on efficiency, and raising/lowering it without adjusting values in FUELS will increase/decrease efficiency respectively.
Used In: FSHORT
Name Type: String, the full name of the resource (e.g. LiquidFuel).
Value Type: String, the shorthand name of the aforementioned resource (e.g. LF).
Required: No, but strongly recommended
Notes: This table is used to solve the problem of lengthy resource names, which can be too long to fit into a tweakable (right click menu) when they are concatenated for display to the user for the current mode of operation. As such, this allows you to configure abbreviations for whatever resources your part may use. This library is shared across all parts using the mod, and if several different resource abbreviations are given in different parts, it will use whichever one is loaded first.
Used In: FUELS, BYPRODUCTS
Name Type: String, the name of the resource to be consumed as a fuel or produced as a byproduct.
Value Type: Float, how much of the resource is consumed/produced when the fuel cell is running at maximum rate in this mode.
Required: > 0
Notes: Each resource here is consumed (in the case of being used in FUELS) or generated (if used in BYPRODUCTS) at the given rate when an unconstrained fuel cell is running at maximum capacity. At slower rates, resource consumption/production is linearly interpolated. The value(s) set here determine efficiency for a given mode, along with MaxEC. See its notes for additional details.
Used In: TANKS
Name Type: String, the name of the tank's GameObject mesh.
Value Type: String, matching the appropriate KSP path to the desired texture for the named tank in this mode.
Required: No
Notes: This controls what textures are mapped to which "tank" meshes on the model, as defined by GameObjects within the model. Using these you can swap tank textures to reflect the resources currently in use. Note that no resource is actually stored on the fuel cell, with the exception of some ElectricCharge required for operation (see Notes for more information).
Used In: LIGHTS
Name Type: String, the name of the light GameObject.
Value Type: Color, in R,G,B floats (e.g. 1,0.5,0).
Required: No
Notes: This defines the color to be applied to various light GameObjects within the model when operating in a given mode. Lights are linearly scaled in brightness between their default value and 0 depending on the use of the fuel cell for power generation.
Used In: EMITTERS
Name Type: String, the name of the KSPParticleEmitter GameObject.
Value Type: Color array of length = 5, colors delimited by one or more spaces. See <LightValue> for how colors are defined.
Required: No, except for all names in <EmitterScale>.
Notes: This defines emitters (KSPParticleEmitter GameObjects) to be used to represent the fuel being consumed or "burned", and lets you set an array of colors to be applied to those emitters for a given mode (leftmost is the earliest color time-wise, and rightmost the last).
Used In: EMITSCALE
Name Type: String, the name of the KSPParticleEmitter GameObject
Value Type: Float, the amount by witch the named emitter's emission value is scaled. See EmitCoeff for more info.
Required: No, but requires an identically named entry in <EmitterValue>.
Notes: As fuels are frequently not consumed symmetrically, this allows you to scale the various output rates (emissions) of the emitters to represent this asymmetry. See the notes section of EmitCoeff for assistance in calculating the values to be used here.

Lastly, it is worth noting that all fuel cell configurations should include a RESOURCE definition with a non-zero amount of ElectricCharge, as this will prevent divide by zero errors in the code which could lead to unpredictable behavior.

If you are creating models for use with the plugin, be sure to read this section.

Animation is optional but recommended. Models should be built in their "deployed" state, with a single animation retracting any necessary elements. This animation will be played in reverse when deploying. When importing into Unity, remember to set "Animation Type" to "Legacy" under "Rig", and "Generation" to "Store in Root." Under "Animations," set "Wrap Mode" to "ClampForever" (sic), and be sure to set the "Wrap Mode" for the animation itself to "Clamp Forever." Lastly, remember to uncheck "Play Automatically" on the Animation component in your GameObject.

KSPParticleEmitters can be embedded in the model to give a visual representation of the fuel being consumed. Be sure to uncheck "Simulate World Space" when doing so, but realize that there are several bugs with the current version of PartTools (1.1 as of this writing) and emitters, and appearance in Unity will not match the appearance in the game. Emitters will be scaled by ScaleHack, so remember to set that equal to whatever scaling your model is using. Also, all emitters should have the same "emission" values, as <EmitterScale> for an emitter defaults to 1 if not present. Lastly, alpha settings for color animations will be overridden (along with the color, of course) if values for the emitters are specified in the EMITTERS ConfigNode, as they should be.

Light "Range" is scaled by ScaleHack (assuming the light is listed in LIGHTS), so be sure to set that when scaling your model. Note that when scaling, "Intensity" is dependant on "Range," so this will not change how bright your lights appear. Light "Intensity" should be set to how bright you want the light to appear when the fuel cell is operating at maximum capacity (if not rate limited), and the plugin will automatically scale intensity between the model's internal value and zero depending on the output of the fuel cell.

Tanks, if present, use texture swapping instead of model (i.e. UV) swapping, in order to make modding in additional tank textures for other resources more accessible. See <TankValue> for more information.