X4: Foundations
0 of 0

File information

Last updated

Original upload

Created by

kuertee

Uploaded by

kuertee

Virus scan

Safe to use

Tags for this mod

About this mod

-Undocked ships will suffer wear and tear if their service crews are fewer than 50% capacity.
-Service crews of 50% or more prevent (and repair) wear and tear. I.e. service crews cannot repair more than the amount of wear and tear.

Requirements
Permissions and credits
Changelogs
Donations
Wear and tear
https://www.nexusmods.com/x4foundations/mods/523
by kuertee

Updates
v6.0.002, 13 Apr 2023:
-Tweak: Version number update for consistency with my other mods. No internal changes since the last version.

Mod effects
-Undocked ships will suffer wear and tear if their service crews are fewer than 50% capacity.
-Service crews of 50% or more prevent (and repair) wear and tear. I.e. service crews cannot repair more than the amount of wear and tear.

Requirements
SirNukes Mod Support APIs mod (https://www.nexusmods.com/x4foundations/mods/503) - for Lua Loader and Simple Menu Options
Kuertee's UI Extensions mod (https://www.nexusmods.com/x4foundations/mods/552) - Modded Lua files with callbacks to allow more than one mod to change the same UI element.

Wear and tear
Wear and tear is hull, engine, and shield percentage damage. It cannot damage the hull or component of less than 25%.

Undocked ships suffer wear and tear at the rate of:
2% every hour when fewer than 25% service crew
1% every hour when between 25% and 49% service crew

The skill of the crew further modifies these rates.
The lesser the total skill below 50%, the more wear and tear is suffered.
The greater the total skill above 50%, the less wear and tear is suffered.

Note that wear and tear are applied to all ship sizes, it looks like engines and shields of only L and XL ships are affected.

Preventing and repairing wear and tear
Service crews of 50% or more than capacity prevent wear and tear and repair any wear and tear suffered.

The rate of repair while undocked is:
1% every 10s when between 50% and 74% service crew
2% every 10s when more than or equal to 75% service crew

And while docked:
1% per 10s when fewer than 25% service crew
2% every 10s when between 25% and 49% service crew
3% every 10s when between 50% and 75% service crew
4% every 10s when more than or equal to 75% service crew

The skill of the crew further modifies these rates.
The lesser the total skill below 50%, the less wear and tear is repaired.
The greater the total skill above 50%, the more wear and tear is repaired.

Service crews cannot repair hull, engine, and shield damage MORE than the amount of wear and tear they suffered.
Note that the base game's auto-repair by engineers (i.e. service crews) and repair drones of ships still function.
Their repairs are simply taken into account by the mod.
Service crews still cannot repair more than the amount of wear and tear even AFTER the repairs from the base game's engineers and repair drones.

For those interested, I describe below this readme the base game's auto-repair by engineers (i.e. service crew) functionality.

Dock for running repairs AI
Your wingmen will request permission to dock for running repairs via Comm when they suffer more than 10% wear and tear.
If you deny their request, they won't request to dock again for 30 minutes.
Your other ships will auto-dock in your ships or stations near them or neutral or friendly stations near them.

Map menu and Dock for running repairs command
When SirNuke's Mod Support APIs mod (https://www.nexusmods.com/x4foundations/mods/503) is installed:
-ships with wear and tear are listed amongst your Property Owned list,
-the "Dock for running repairs" command becomes available

Note that these features will not be compatible with 3rd-party mods that change these UI functions:
ui.addons.ego_detailmonitor.menu_map.createPropertyOwned ()
ui.addons.ego_detailmonitor.menu_map.createPropertyRow ()

Configuring the mod
These mod options are configurable/togglable when SirNuke's Mod Support APIs mod (https://www.nexusmods.com/x4foundations/mods/503) is installed:
-affect hulls
-affect engines
-affect shields
-wear and tear rates with service crew at fewer than 25%, between 25% and 49%, between 50% and 74%, more than or equal to 75%
-repair rates with service crew at fewer than 25%, between 25% and 49%, between 50% and 74%, more than or equal to 75%
-account for crew skill less than 50%
-account for crew skill more than 50%

Install
-Unzip to 'X4 Foundations/extensions/kuertee_wear_and_tear/'.
-Make sure the sub-folders and files are in 'X4 Foundations/extensions/kuertee_wear_and_tear/' and not in 'X4 Foundations/extensions/kuertee_wear_and_tear/kuertee_wear_and_tear/'.

Uninstall
-Delete the mod folder.

Troubleshooting
(1) Do not change the file structure of the mod. If you do, you'll need to troubleshoot problems you encounter yourself.
(2) Allow the game to log events to a text file by adding "-debug all -logfile debug.log" to its launch parameters.
(3) Enable the mod-specific Debug Log in the mod's Extension Options.
(4) Play for long enough for the mod to log its events.
(5) Send me (at [email protected]) the log found in My Documents\Egosoft\X4\(your player-specific number)\debug.log.

Credits
By kuertee.
German localisation by LeLeon.

History
v5.1.0314, 6 Dec 2022:
-Bug-fix: The auto-restock cooldown timer is decreased from 30min to 5min.

v5.1.03131, 31 Oct 2022:
-Bug-fix: Clean-up of data of destroyed ships was sometimes not happening.

v5.1.0313, 31 Oct 2022:
-Bug-fix: Ships with less than 25% hull with any amount of wear and tear were constantly docking to do running repairs on the wear and tear - regardless of wear and tear amount.

v5.1.0308, 29 Sep 2022:
-Bug-fix: The mod was repairing damage when they should only be repairing wear and tear.

v5.1.0305, 15 Sep 2022:
-Bug-fix: Support for salvage ship missions that require you to rescue then deliver the ship.

v5.1.0304, 3 Sep 2022:
-Bug-fix: Detecting when ships undock.

v5.1.0303, 1 Sep 2022:
-New feature: Reprogrammed 90% of the code as ship AIs. Previously, the code was in the game's Mission Director layer.
-New feature: Disables the base-game's repairs by service crew. Only repair drones repair ships out of dock. Disable/enable this option in the Extension Options. Note that service crew still prevent wear and tear in flight and repair wear and tear (i.e. not damage) when docked.
-Bug-fix: Ships in fleets with Auxiliaries (i.e. resupply and repair ships) now request repairs only every 30 min or when the ship's hull is at 50% or less.

v4.2.07, 3 Jan 2022:
-Bug-fix: The "AI autodocks" option was off by default. It should be on by default.

v4.2.05, 26 Dec 2021:
-New feature: Extensions Options to turn off the AI auto-docking for maintenance repair. (Thank a possible Omicron exposure, and my x-mas day isolation, for my time to do this request. LOL!)

v2.0.2, 22 Apr 2021:
-New feature: Now uses Egosoft's new Cutscene for comms that shows the interior of the ship.

v2.0.1, 18 Apr 2021:
-Bug-fix: Was using a text reference from "Crime has consequences". Fixed in this version.

v2.0.0, 11 Mar 2021:
-New feature: updated for v4.0.0 beta 11 of the base game.
-Tweaks: Cleaned-up unnecessary localisation files. Rewrote content.xml manifest file.

v1.1.4, 18 Dec 2020:
-Bug-fix: The UI would sometimes bug-out if the ship becomes unavailable (e.g. destroyed or changed ownership).

v1.1.3, 16 Dec 2020:
-Bug-fix: Sometimes undock time wasn't getting set properly - resulting in very high wear and tear after undocking.

v1.1.2, 8 Dec 2020:
-Bug-fix: The mod was setting heavily-damaged ships to have a hull of 25%.

v1.1.1, 6 Nov 2020:
-Bug-fix: Suppress reporting of null errors that are reported as false (anyway). The debugger just reports them even if they are evaluated as false correctly.

v1.1.0, 2 Nov 2020:
-New feature: "Crime has consequences" mod (https://www.nexusmods.com/x4foundations/mods/566) compatibility: Ships will not dock for running repairs on stations of factions they have a record (i.e. fines) with.
-Bug-fix: div by 0 bug in applying wear and tear after a ship loses its service crew (e.g. from a transfer).
-Bug-fix: Check if hull, engines and shields have more 25% points and apply wear and tear if so. Previously, hull, engines, and shields were resetting their points to 25% if it wear and tear takes it below that.
-Bug-fix: Reset the "sent a dock for running repairs" flag if the ship has no dock order. This bug occurred if the ship was sent a "dock for running repair" command either by the player or the AI, but the order was cleared before it completed because of, for e.g., the ship's commander was changed.
-Update: Pilot cutscene caption standardised with my other mods. I.e. name, faction, ship/station, caption.

v1.0.3, 28 Aug 2020:
-Now uses my UI Extensions mod (https://www.nexusmods.com/x4foundations/mods/552) to effect this mod's changes to the Lua files.
-Bug fix: AI in selecting docking locations for running repairs.

v1.0.2, 18 Jul 2020:
-Bug-fix: These ship types are now ignored: shiptype.xsdrone, shiptype.escapepod, shiptype.distressdrone, shiptype.lasertower, shiptype.smalldrone.
-Tweak: In case of data pre-v1.0.1, excess wear and tear (i.e. when wear and tear + ship's hull percentage is greater than 100) is removed.
-Tweak: UI: "Dock for running repairs" command is disabled on ships with no service crew. Previously, when this command is given, they would ignore it anyway.
-Tweak: UI: "Dock for running repairs" command is also disabled on ships that are already docking. Previously, this command is disabled on ships that were already docking for running repairs but not for other docking reasons.

v1.0.1, 17 Jul 2020:
-Bug-fix: Repairs outside the wear and tear system NOW affect the wear and tear data. Previously, the code was disabled.
-Bug-fix: "Dock for running repairs" AI finds docks that are nearest each ship rather than the dock nearest to the first ship in the batch of ships the AI determined that need to dock. Note that the player CAN still group-select ships and order them to "Dock for running repairs" at one location.
-Bug-fix: Ignore ships that do not require service crew.
-Bug-fix: Running repairs when docked are now applied even when the selected intervals are low. Previously, running repairs were sometimes ignored at low application/repair intervals.
-Tweak: Ships that already have a dock order at the top of their queue of actions do not request nor acquire "Dock for running repairs".
-Bug-fix: Ships that do not have any service crew do not request to "Dock for running repairs" nor acquire the "Dock for running repairs" AI.
-Tweak: NPC wingmen confirm your order to dock for running repairs.
-Bug-fix: "Apply to ship hulls" option in Extension Options re-enabled.
-Bug-fix: Property > Deployables tab re-enabled.

1.0.0, 26 Jun 2020: initial release