Barotrauma icon indicating copy to clipboard operation
Barotrauma copied to clipboard

XML of items using fuel/batteries using 1 statuseffect per item instead of condition

Open ubertpendragon opened this issue 3 years ago • 1 comments

Disclaimers

  • [X] I have searched the issue tracker to check if the issue has already been reported.
  • [ ] My issue happened while using mods.

What happened?

Instead of using different condition values for fuel/batteries, items that use fuel/batteries have a Statuseffect for each

Example with sonar beacon (uses batteries)

    <LightComponent LightColor="0.0,1.0,0.0,1.0" range="50" powerconsumption="10" blinkfrequency="2" IsOn="false" canbeselected="false">
      <StatusEffect type="OnActive" targettype="Contained" Condition="-0.1">
        <RequiredItem items="batterycell" type="Contained" />
      </StatusEffect>
      <StatusEffect type="OnActive" targettype="Contained" Condition="-0.05">
        <RequiredItem items="fulguriumbatterycell" type="Contained" />
      </StatusEffect>
      <StatusEffect type="OnActive" targettype="Contained" Condition="-0.1">
        <RequiredItem excludedidentifiers="batterycell,fulguriumbatterycell" type="Contained" />
      </StatusEffect>
      <StatusEffect type="OnActive" targettype="This" SoundRange="50000" setvalue="true">
        <Conditional Voltage="gt 0.5" targetitemcomponent="LightComponent" />
        <sound file="Content/Items/Weapons/SonarDecoy.ogg" range="500.0" loop="true" volume="0.25" />
      </StatusEffect>
    </LightComponent>

You have: -1 statuseffect for regular batteries -1 statuseffect for fulgurium -1 statuseffect for modded batteries

In every item that uses Fulgurium, it seems to follow the rule that Fulgurium has 2x the duration of regular batteries. Same goes for diving suit and Oxygen vs Oxygenite. The only notable exceptions is stun baton (-25 vs -16.7), which requires a specific statuseffect for the increased stun anyway

In short, the condition of the item should be increased and all consumption rate statuseffects merged into one and use a tag (oxygensource) instead of individual identifiers. Setting oxygenite/fulgurium default condition to 300, and having one statuseffect instead of 3 for each item. Fuel rods and modded items already rely on conditions

      <StatusEffect type="OnActive" targettype="Contained" Condition="-0.1">
        <RequiredItem tag="mobilebattery" type="Contained" />
      </StatusEffect>

and health="200" in the Fulgurium battery Item parameter

As for special effects like Oxygenite speed boost or incendium burns require their own, separate statuseffect not involving condition.

ubertpendragon avatar Oct 06 '22 17:10 ubertpendragon

Good point! It doesn't make any sense for them to be configured like this - I suspect they were originally implemented when there was no way to adjust an item's health. Changed in https://github.com/Regalis11/Barotrauma-development/commit/7cab02a1207ca9a68a4748894feeec3364d32e57

Regalis11 avatar Oct 07 '22 07:10 Regalis11

Tested against release commit https://github.com/Regalis11/Barotrauma-development/commit/56ddb502c58d91fea177e4f4c9b9c57bb12e7c8c

The stun baton's appear to have been missed, I couldn't find any other items using a fulgurium battery / mobile battery that this would impact in other ways. The condition usage of stun batons is -25 for regular and -16.7 for fulgurium. but we have now doubled fulgurium to 200 condition (Giving likely far more uses than intended per charge).

NilanthAnimosus avatar Oct 14 '22 09:10 NilanthAnimosus

Fixed in https://github.com/Regalis11/Barotrauma-development/commit/26220ef57c9cb955e40da532c221bcceaf3d704e

Regalis11 avatar Oct 14 '22 10:10 Regalis11

Tested; XML looks good and consumables still seem to retain their same charge/discharge rates as before.

Jade-Harleyy avatar Oct 14 '22 17:10 Jade-Harleyy

Also, if I may add an idea here: Could this be done to ammunition aswell? -1 condition per shot, but max health is changed to the total number of shots in a magazine. Would make everything simpler as opposed to always 100 condition but changing the decrease.

Jade-Harleyy avatar Oct 15 '22 13:10 Jade-Harleyy