OpenXcom Forum

Modding => OXCE Bugs => OpenXcom Extended => OXCE Bugs FIXED => Topic started by: Torchwood on April 25, 2022, 01:52:44 pm

Title: [FIXED] Fire Extinguisher with instant grenades will not extinguish people
Post by: Torchwood on April 25, 2022, 01:52:44 pm
Ran into a curious issue playing OpenXCom 7.5.3, XPirtaez M5.2.1. Simply put, the fire extinguisher code does not seem to be working properly.

Simply put, while fire extinguishers in weapon form (i.e. item with aimed shot cloud and limited ammo) work as intended, putting the isFireExtinguisher effect into an instant grenade like XPiratez' foam grenade does not work properly - while they put out ambient fires, burning people keep burning.

Frustratingly, this issue was not present in OpenXCom 7.0, when I played XPiratez L10.

In XPiratez, this has some implication to mid-lategame play - advanced weapons start a lot of fires and being able to quickly put out burning soldiers becomes important. Needless to say, an ethereal battleship is not a good place to find out your premier tool do this doesn't work.

To make things even weirder, changing the item to behave like a normal grenade does fix the issue. But I would prefer not to resort to this.

Made a few screenshots to illustrate the issue. In order - after lighting the test craft on fire, before throwing foam grenade, after throwing foam grenade, after using fire extinguisher.
Title: Re: [Bug] Fire Extinguisher code with instant grenades will not extinguish people
Post by: Meridian on April 25, 2022, 02:00:32 pm
Thanks, I'll check.
Title: Re: [Bug] Fire Extinguisher code with instant grenades will not extinguish people
Post by: Meridian on April 25, 2022, 02:51:32 pm
Found it.

For scripting purposes, special effects handling was moved from `hitUnit` to `damageUnit`(since OXCE v7.4.2).
And `damageUnit` is skipped completely when rolled damage <= 0

We'll need some time to figure out how to best fix it... until then you can mod the item to roll at least 1 damage.
(Currently the foam grenade has power=70, but randomType=5... which means it always rolls 0 damage)


EDIT: pasting a vanillized foam grenade ruleset for future testing

Code: [Select]
  - type: STR_FOAM_GRENADE
#    categories: [STR_BAT_CAT_GRENADE, STR_BAT_CAT_SMOKE, STR_BAT_CAT_UTILITY, STR_BAT_CAT_MOSTLY_HARMLESS, STR_BAT_CAT_EXO]
#    supportedInventorySections: *InventorySectionsStandard
    size: 0.1
    costSell: 1250
    weight: 5
    bigSprite: 22 # 3140
    floorSprite: 22 # 426
#    handSprite: 2216
#    hitAnimation: 40
    power: 70
    fuseType: -2
    damageType: 9
    damageAlter:
      IgnoreSelfDestruct: true
      FixRadius: 6
      ToStun: 2.0
      ToTime: 2.0
    isFireExtinguisher: true
    costPrime:
      time: 30
    costThrow:
      energy: 10
      time: 40
    throwMultiplier:
      throwing: 0.8
    costUnprime:
      time: 15
#    unprimeActionName: STR_UNPRIME_GRENADE
    battleType: 4
    invWidth: 2
    invHeight: 1
    armor: 50
    attraction: 6
#    listOrder: 14482
Title: Re: [Bug] Fire Extinguisher code with instant grenades will not extinguish people
Post by: Torchwood on April 25, 2022, 04:38:06 pm
Okay, that was helpful. Thank you.

Knowing this I can make a stopgap fix. Let's give it damage type 4, just like the extinguisher.

Code: [Select]
  - type: STR_FOAM_GRENADE
    categories: [STR_BAT_CAT_GRENADE, STR_BAT_CAT_SMOKE, STR_BAT_CAT_UTILITY, STR_BAT_CAT_MOSTLY_HARMLESS, STR_BAT_CAT_EXO]
    supportedInventorySections: *InventorySectionsStandard
    size: 0.1
    costSell: 1250
    weight: 5
    bigSprite: 3140
    floorSprite: 426
    handSprite: 2216
    hitAnimation: 40
    power: 70
    fuseType: -2
    damageType: 9
    damageAlter:
      IgnoreSelfDestruct: true
      RandomType: 4
      FixRadius: 6
      ToStun: 0.4
      ToTime: 0.8
    isFireExtinguisher: true
    costPrime:
      time: 30
    costThrow:
      energy: 10
      time: 40
    throwMultiplier:
      throwing: 0.8
    costUnprime:
      time: 15
    unprimeActionName: STR_UNPRIME_GRENADE
    battleType: 4
    invWidth: 2
    invHeight: 1
    armor: 50
    attraction: 6
    listOrder: 14482

I've tested it myself and it works. Also actually does stun damage and TU damage now, could almost double as improvised tear gas now.

Might still make problems if damage is totally nullified. Most choking immune armors are fireproof since those are sealed exosuits and power armor, but not all.
Title: Re: [Bug] Fire Extinguisher code with instant grenades will not extinguish people
Post by: Meridian on May 01, 2022, 06:54:57 pm
It should be fixed in OXCE v7.5.14 and higher.

Small potential breaking change:
As a side effect `hitUnit` script hook is now called for negative damage too.
The `damageUnit` script hook will only be called when damage is bigger than 0.