PartToggledComponents

From Cosmoteer Wiki
< Modding‎ | ComponentsModding/Components/PartToggledComponentsRules
Jump to navigation Jump to search
CalloutIconWarning.png
Work in Progress
This page is currently WORK IN PROGRESS. Some things may be missing.

Feel free to contribute and don't worry about perfection - other editors can make corrections if necessary. Just get creating!

Code locations (what's this?):

Cosmoteer.Ships.Parts.Logic.PartToggledComponents
Cosmoteer.Ships.Parts.Logic.PartToggledComponentsRules

A part sub-component that adds/removes sub-components depending on the state of a toggle component.

Alias ToggledComponents.

If you want a part to have some functionality only when some condition is met, you can use this.

Inherits from PartComponent.

Used by thruster_boost , ...

Name Type Required? Default value Description
Toggle ID<PartComponentRules> Yes - Which toggle decides whether or not the components listed in this exist, or don't.
Invert bool - - Inverts the outcome of the Toggle field.
IncludeInBlueprints bool - -
Components List<PartComponentRules> Yes new

The list of components affected by the toggle, formatted just like any typical list of components found directly in a part.

Notes

  • Nothing here is buffable.
  • You can use this to make connected textures. See the example below.

Examples

Boost Thruster

The boost components are only toggled On when the ship is boosting. This also turns off the ability to receive batteries.

(WIP)

Connected textures

Connected walkways code.png


And the code for it (both courtesy of Ahlgreen) :

Connected walkways.png

This is achieved by using "a ToggledComponents for each texture, toggled by a MultiToggle". See the code on the right.

See also