WeaponMechanics/MechanicsMain

listenerConditions in Lever firemode "Open" mechanics cause no sound to be played

Opened this issue · 2 comments

Current/Expected Behavior

If I add listenerConditions to a CustomSound mechanic under the Open mechanics of a Lever Firearm_Action weapon, the sound will not play. However, it will play correctly if moved under the Close mechanics, or if the listenerConditions are removed.

Steps To Reproduce

Consider the following mechanic:

  Firearm_Action:
    Type: "LEVER"
    Open:
      Time: 17
      Mechanics:
        - "CustomSound{sound=bolt_open, volume=0.25, pitch=1, noise=0.1, listenerConditions=[Range{max=6}], delayBeforePlay=10}"

The bolt_open sound does not play when I fire the weapon. But now if I remove the listenerConditions and /wm reload, the sound will play as expected:

  Firearm_Action:
    Type: "LEVER"
    Open:
      Time: 17
      Mechanics:
        - "CustomSound{sound=bolt_open, volume=0.25, pitch=1, noise=0.1, delayBeforePlay=10}"

It seems to be specific to Open mechanics because the same mechanic under Close works correctly.

Log File

Log is here, although there appears to be nothing of note.

Anything else?

No response

Upon further investigation, it seems the real issue is some kind of incompatibility between listenerConditions and delayBeforePlay when they are in the same mechanic.

Works:

  Firearm_Action:
    Type: "LEVER"
    Open:
      Time: 17
      Mechanics:
        - "CustomSound{sound=mosin_bolt_open, volume=3, pitch=1, noise=0.1, delayBeforePlay=5}"

Doesn't work:

  Firearm_Action:
    Type: "LEVER"
    Open:
      Time: 17
      Mechanics:
        - "CustomSound{sound=mosin_bolt_open, volume=3, pitch=1, noise=0.1, delayBeforePlay=5, listenerConditions=[Range{max=6}]}"

I can't think of any obvious reason why that might be the case... delayBeforePlay doesn't actually change how mechanics are called, it just delays it. It's one of those special arguments...

Have you been able to find more info on what is causing the issue?