apply
Performs an immediate repair on a live unit.
Function
Synopsis
btech.repair.apply( unit, repair )
Arguments
DbRef|Object unit- A registered live BattleTech unit.
table repair- A strict operation record. Unknown fields are rejected. Every record requires
a typed
BtechSectioninsectionand one of these exact shapes, usingbtech.repair.operations:{ operation = operations.REPAIR_ARMOR, section = BtechSection, value = integer }{ operation = operations.REPAIR_INTERNAL, section = BtechSection, value = integer }{ operation = operations.REPAIR_REAR_ARMOR, section = BtechSection, value = integer }{ operation = operations.REPAIR_PART, section = BtechSection, slot = integer }{ operation = operations.REATTACH, section = BtechSection }
Raw operation and section strings are rejected. Armor and internal values must be integers from 0 through 255.
slotis a one-based integer within the selected section’s current critical-slot count.REPAIR_REAR_ARMORis valid only for a Mech’s center, left, or right torso (CTORSO/CT,LTORSO/LT, orRTORSO/RT); this immediate operation is rejected for every other section and unit type.
Returns
None.
Raises
mux.object.invalidifunitis not a registered BattleTech unit.mux.object.unavailableif the unit’s runtime state is unavailable.mux.arg.invalidifrepairis not a table; has an unknown or missing field; specifies an unsupported operation or section; or supplies a fractional, out-of-range, or otherwise invalidvalueorslot.
Examples
local unit = mux.world.object(42)
btech.repair.apply(unit, {
operation = btech.repair.operations.REPAIR_ARMOR,
section = btech.unit.sections.CENTER_TORSO,
value = 32,
})
btech.repair.apply(unit, {
operation = btech.repair.operations.REPAIR_PART,
section = btech.unit.sections.LEFT_ARM,
slot = 3,
})
Notes
Repairs apply immediately and do not enqueue technician work. Surplus positional
arguments are ignored consistently with other native btech functions.
Scheduled repair discovery remains compatibility-oriented: it may report and
restore configured stored rear armor on other sections even though combat does
not consume those values.