Skip to content
Lemonymous edited this page Jan 9, 2022 · 2 revisions

Table of Contents

 

ReplaceRepair

A library allowing you to change the repair skill of pilots or mechs, or other conditions of your choosing.

How to add the library to your mod:

  • See Creating-Mods for details on how to create mods.
  • Download the latest release of this library.
  • Unzip the content into your mod's scripts folder.
  • In the init function in your mod's init.lua, initialize the library with either of the following lines. 1 will only initialize the library, while 2 will both initialize it and give you a library object you can use to call the library functions with. The library object can be fetched in this way several times without issue.
    1. require(self.scriptPath.."replaceRepair/replaceRepair")
    2. local replaceRepair = require(self.scriptPath.."replaceRepair/replaceRepair")

How to use the library to add custom repair skills:

  • After the library has been initialized in your mod, you can access the library's functions with your reference to the library object. See addSkill for more details.

 

addSkill

  • void   replaceRepair:addSkill(repairSkill)
Argument name Type Description
repairSkill table Descriptions for the repair skill replacement

 

repairSkill must define all of the following fields:

Argument name Type Description
name string Display name for the repair skill
description string Displayed description for the repair skill
weapon string Id for the skill used for the repair skill

 

repairSkill must also define one of the following fields:

Argument name Type Description
pilotSkill string The pilot skill associated with the repair skill
mechType string The mech type associated with the repair skill
isActive function The custom function defining when the repair skill is active

 

repairSkill may define the following additional optional fields:

Argument name Type Description
icon string path to the displayed icon for the repair skill. Either relative to the mod, or in the game assets
iconFrozen string path to the displayed icon for the repair skill when the mech is frozen. Either relative to the mod, or in the game assets

 

Adds a repair skill which will become available based on the definition provided by either pilotSkill, mechType or isActive.

If pilotSkill is defined, then mechs piloted by a pilot with this pilot skill will have this repair skill.

Otherwise, if mechType is defined, then mechs of this type will have this repair skill.

Otherwise, if isActive is defined, then mechs will have this repair skill only when the function isActive returns true.

The field weapon defines what the repair skill will do, while the fields name, description, icon and iconFrozen will determine how it will be displayed.

 

Example:

replaceRepair:addSkill{
	name = "Example Punch",
	description = "Punches instead of repairing",
	pilotSkill = "Extra_XP", -- Ralph's pilot skill
	weapon = "Prime_Punchmech", -- Titan Fist
	icon = "img/weapons/prime_punchmech.png"
}

This example would change the repair skill to Combat Mech's Titan Fist when piloted by Ralph Karlsson.

 

Skill_Repair_Orig

Replace Repair functions by overwriting the vanilla repair skill Skill_Repair, and dynamically changing it to appear like different mechs and pilots have different repair skills.

The original vanilla repair skill definition is stored in Skill_Repair_Orig instead. It is preserved in the event someone needs to reference the vanilla skill.