Skip to content

Conversation

@mszabo-wikia
Copy link
Contributor

@mszabo-wikia mszabo-wikia commented Jan 3, 2026

Changes

  • Make CompProperties_ArmorDurability.RegenInterval an int rather than a float, since it's a tick interval where fractional values do not make sense. Existing patches and defs use integer values.
  • Have CompArmorDurability compute the natural armor healing as the product of the number of regeneration intervals that elapsed since the last regeneration and the defined regeneration value.

Reasoning

For creatures with periodic natural armor regeneration, CompArmorDurability tracks the number of ticks that elapsed since the last bout of regeneration, then increases the natural armor with the product of the regeneration value and the VTR delta. However, this is incorrect: we instead should apply the regeneration value multiplied by the number of regeneration intervals that elapsed since the last time the natural armor was regenerated. This problem is especially visible with mods that throttle VTR aggressively, such as Slower Pawn Tick Rate, since the higher VTR deltas cause incorrectly high armor regeneration.

Testing

  • Compiles without warnings
  • Game runs without errors
  • Playtested a colony:
  1. Given this save naturalarmor.rws.zip, shoot a burst into the thrumbo, which has a natural armor regeneration value of 5 every 600 ticks.
  2. If Slower Pawn Tick Rate is loaded, note how the natural armor of the thrumbo regenerates unreasonably quickly.
  3. With this fix, the thrumbo's armor should regenerate by 5 every 600 ticks, both with and without the Slower Pawn Tick Rate mod.

For creatures with periodic natural armor regeneration,
CompArmorDurability tracks the number of ticks that elapsed since
the last bout of regeneration, then increases the natural armor
with the product of the regeneration value and the VTR delta.
However, this is incorrect: we instead should apply the regeneration value
multiplied by the number of regeneration intervals that elapsed since
the last time the natural armor was regenerated. This problem is
especially visible with mods that throttle VTR aggressively, such
as Slower Pawn Tick Rate, since the higher VTR deltas cause incorrectly
high armor regeneration.
@mszabo-wikia mszabo-wikia requested review from a team as code owners January 3, 2026 14:25
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-20678537940.zip

@github-actions github-actions bot added the Download in Comments This PR has a zipfile download available. label Jan 3, 2026
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-20679500433.zip

@mszabo-wikia mszabo-wikia force-pushed the fix-natural-armor-vtr branch from 3f68c18 to 106ff84 Compare January 3, 2026 15:59
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-20679556221.zip

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-20679560822.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Download in Comments This PR has a zipfile download available.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants