Skip to content

Predefined Components

Denadan edited this page Jan 22, 2019 · 17 revisions

List of Predefined components to use

RGBColor (RGBColorComponent)

Change color of component in inventoty and salvage list, on mech.

Example

"RGBColor" : { "Color" : "red"; }

"RGBColor" : { "Color" : "#A00000"; }

Parameters

  • Color - HTML-coded color

Color (ColorComponent)

Change color of component in inventoty and salvage list, on mech.

Example

"Color" : { "UIColor" : "Red"; }

Parameters

ColorTag (TagColorComponent)

Change color of component in inventoty and salvage list, on mech based on preset color

Example

"ColorTag " : { "Tag" : "SRM"; }

Parameters

  • Tag - predefined color tag. To define colortags use "ColorTags" section in mod.json at CustomComponent folder, for examlpe
"ColorTags" : [
  { "Tag" : "SRM", "Color" : "purple" },
  { "Tag" : "othertag", "Color" : "#800080" },
]

TonnageAllowed

Limit Component usage to given tonnage. Also hide from inventory list in mechlab when mech have wrong tonnage like JumpJets do

Example

"TonnageAllowed" : { "Tonnage" : 50 }

TonnageLimit(TonnageLimited)

Limit Component usage to given tonnage range. Also hide from inventory list in mechlab when mech have wrong tonnage like JumpJets do

Example

"TonnageLimit" : { "Min" : 30, "Max" : 50 }

Sorter

Try to put item in given position when(and only when) installed. If you have gaps in order or few items with same order - order can be wrong. Values less then 0 will be ignored. If value more then current count of component in location - item will be put in end of list as usual

Example

"Sorter" : { "Order" : 0 } - always put item on top of installed components

Complex theme, so it have own article

Defaults

Defaults - components that controloed by other components. Player cannot add or remove they manualy, buy, sell or salvage(they not appear on this list basicly). All next components use defaults as part of own logic. Usualy they DarkGrey color on mech, but you can ovveride this using ColorComponent(default color for upgrades "Upgrade"). Main idea - they can be created or destroyed any time. Attention: Default must be same base type as main component - Weapon, AmmunitionBox, JumpJet, HeatSink or Upgrade

Flags

List of string values, that can stored and checked like ComponentTags. Some of them predefined and describe component behaviour, but you can add any value to implement own

Example

"Flags" : { "flags" : ["default"] }

"Flags" : {
  "flags" : ["invalid"],
  "ErrorInvalid" : "Something wrong with {0}, remove it"
}

Predefined values

  • "hide" - item filtered from mechlab inventory list(but appear in storage and shop inventory)
  • "autorepair" - item repair iteself instead removing when you press "repair all" or "replace part" in mechlab
  • "no_remove" - item cannot be removed from mech inventory by player, but it will removed with "Strip Equip" or "Replace Part" if auto repair not set
  • "no_salvage" - item cannot be salvaged
  • "default" - implement all 4 flags and item also destroyed iteself when moved to inventory and left on mech when stripped(but will be removed if main component removed)
  • "not_broken" - if component is damaged or destroyed - mech cannot be fielded
  • "not_destroyed" - if component is destroyed - mech cannot be fielded
  • "invalid" - invalidate mech when equiped. for safe removing items from mod

Error Messages

  • ErrorCannotRemove = "Cannot remove vital component" - Message for "default" and "no_remove" items when player try to grab it
  • ErrorItemBroken = "{0} is damaged, repair it" - Message for "not_broken"
  • ErrorItemDestroyed = "{0} is destroyed, replace it" - Message for "not_destroyed"
  • ErrorInvalid = "{0} is placeholder, remove it" - Message for "invalid"

All Messages can use {0} parameter for item name(include ErrorCannotRemove)

Replace(AutoReplace)

Item replaced with default when removed, include remove by user, strip, remove broken by repair. Reverse replacement can be done by Category. For example Leg Actuators - it must be on mech, it can be upgraded(i.e. replaced) with current Leg Actuators with bonuses but when this bonus actuator removed default must be placed.

Parameters

  • ComponentDefId - id of component for replace
  • Location - optional, location where to add replace, if not set - current location used.

Example

"Replace" : { "ComponentDefId" : "<id of default component>"}

note: currently supported only replace with defaults, posibility to replace with "normal" items from inventory investigated

Linked(AutoLinked)

Item have "appendixes" which must be added or removed with it. For example - XL-Engine have parts in side torso.

Examlpe

"Linked" : {
  "Links" : [ 
    { "ComponentDefId" : "Gear_Engine_XL_Left", "Location" : "LeftTorso" },
    { "ComponentDefId" : "Gear_Engine_XL_Right", "Location" : "RightTorso" }
  ]
}

note1: appendixes must be Default

note2: appendixes must be some base type as main item, i.e. Upgrade or Weapon