MSUTeam / MSU

Modding Standards and Utilities for Battle Brothers
21 stars 4 forks source link

[Vanilla BUG] call onCombatStarted for armor upgrades #347

Open Darxo opened 4 months ago

Darxo commented 4 months ago

Versions

Describe the bug Currently the function onCombatStarted() is not called for armor upgrades. This is because they are hidden inside the armor.nut they are attached to and the armor.nut needs to pass that event on. But unlike many other events, this is not passed on in Vanilla.

To Reproduce

  1. Hook an armor upgrade or create a new armor upgrade and utilize their function onCombatStarted(), e.g. by printing an error message.
  2. Add that upgrade to your invenotory, use it and start a battle
  3. The log is not printed

Expected behavior onCombatStarted() is called so it can be used for armor upgrades. For example by adding a dummy effect at combat start which implements the effect of that attachement.

Screenshots Example implementation: image

Enduriel commented 4 months ago

This is important and we should definitely fix it, we could do this in 1.3.1 as it's a vanilla fix

Enduriel commented 4 months ago

Actually I suspect this may be the case for other functions we have added to items and we should probably patch all of those.

ETA: That might cause issues with layered items systems... Not sure how to handle this generically.