-
Notifications
You must be signed in to change notification settings - Fork 5
Interfaces
Interfaces used in CustomComponents to handle events or implement other common logic. All event called only when affected item with this custom component(i.e. mechvalidate called if mech have this item equiped)
- void OnLoaded();
Called after component Loaded, so any initialization logic can be put here
bool OnItemGrab(IMechLabDraggableItem item, MechLabPanel mechLab, out string error)
Called before item removed from mech by user(direct grab, strip equip, remove destroyed item) used for example by Default items to cancel remove.
-
IMechLabDraggableItem item
- MechLabItemSlotElement containing this item -
MechLabPanel mechLab
- mechlab
- return value - if false item grabbing will be canceled
- out string error - if grabbing canceled and error not empty - error message which show to user
void OnItemGrabbed(IMechLabDraggableItem item, MechLabPanel mechLab, MechLabLocationWidget widget)
Called when item grabbed, can be used to do something after item is removed from mech(postfix patch to MechLabLocationWidget.OnItemGrab and MechLabLocationWidget.StripEquipment/RepairAll/StripDestroyedComponents). for example AutoLinked used this to remove linked parts.
-
IMechLabDraggableItem item
- MechLabItemSlotElement containing this item -
MechLabPanel mechLab
- mechlab -
MechLabLocationWidget widget
- location from where item was grabbed
bool CheckFilter(MechLabPanel panel)
Implement MechLab inventory filtering (postfix patch to MechLabInventoryWidget.ApplyFiltering). used for example by TonnageAllowed/TonnageLimited. Return false if item must be hided. Returning true not force item to appear - it can be hided by other filters - customcomponents or game default ones.
void ValidateMech(Dictionary<MechValidationType, List<string>> errors, MechValidationLevel validationLevel, MechDef mechDef)
Called when game validate mech. List of error messages storred in errors Dictionary by MechValidationType. critical error prevent from save mech design and leave mechlab. If called from mechlab have validationLevel == MechValidationLevel.MechLab. Also mechlab show icon for each category end message with errors/warnings when you try save design. In other case small warning or error icon will be shown on mechbay based on errors.
bool ValidateMechCanBeFielded(MechDef mechDef)
"Quick" check before mech can be used in battle. called on deploy window and if return false prevent mech to be selected.
- void OnInstalled(WorkOrderEntry_InstallComponent order, SimGameState state, MechDef mech);
Called when installation/remove(in game terms it is same, just for Remove DesiredLocation == None) order done. used to add/remove defaults with given item
Called by Validator during adding item on mech.