engineer.ai - enenra/x4modding GitHub Wiki
Overview
Contains the logic relating to an object's "engineer", or the entity which controls automatic repairs on L/XL (and M???) ships, as well as stations.
Interrupts
handler | aiscript | comment |
---|---|---|
engineer_hacked |
if the engineer is hacked, the script will wait a specific amount of time |
Description
This script handles automatic repairs for objects (confirmed for L/XL ships and stations). This includes sending out mass traffic (in this case, repair drones) and then calculating repair rate depending on how many are deployed, along with the skill of the controlling entity's crew "combinedskill".
Repair Formula
The following is a pseudo-code representation of how the game calculates the amount of hull MW to repair each cycle.
A cycle happens at a rate of once every 10-11s.
baseRate
= 50
baseModifier
= 0.3 (for Xenon), 0.1 (for all other races)
droneModifier
= baseModifier
+ 1 * num Mk1 Repair Drones
+ 2 * num Mk2 Repair Drones
+ ... + X * num MkX Repair Drones
crewCombinedSkill
= not sure how the game calculates this, but it is a value between 0-100
Repair Amount = baseRate
* max(droneModifier
,baseModifier
) * (min(crewCombinedSkill
, 90) + 10) / 25
Notes
- Need some testing done for M ships to confirm if it works on them or not
- Stations are always repaired to 100%
- Ships are repaired to 60-100% based on combined crew skill (using this formula: 60 + (40 * repairmodifier/100))