Barotrauma
Barotrauma copied to clipboard
DelayedEffect with delaytype="ReachCursor" is always applied immediately, regardless of whether the projectile reaches the cursor or not
Disclaimers
- [X] I have searched the issue tracker to check if the issue has already been reported.
- [X] My issue happened while using mods.
What happened?
When you specify the DelayType of DelayedEffect as ReachCursor, before the Effect is applied, it will calculate the distance from the item to the Cursor position of its projectile.User. If the displacement of the projectile exceeds this distance, the Effect will be applied. But now, as the title says, the displacement has exceeded the predetermined distance before Effect is applied.
Reproduction steps
- Copy the following xml code into any projectile component of any item:
<StatusEffect type="OnUse" target="This" delaytype="ReachCursor">
<Remove />
</StatusEffect>
- Shoot the modified projectile
- projectile will be removed immediately
Bug prevalence
Happens every now and then
Single player or multiplayer?
Single player
-
No response
Version
v1.2.8.0 (Winter Update hotfix 2)
-
No response
Which operating system did you encounter this bug on?
Windows
Relevant error messages and crash reports
No response
The predetermined distance in this case seems to be 0 (as you have not defined any distance), so the expected behavior is that the effect triggers immediately (since the distance will always be larger than 0).
This is some ancient functionality btw that we didn't end up using for anything, so I'm not entirely sure if it'd work correctly even if the distance was defined. I'm kind of leaning towards just removing it (especially if it doesn't work).
Actually we don't need to give the distance, because distance = Vector2.Distance(projectile.WorldPosition,character.CursorWorldPosition), it depends on where your cursor position is.
Ah, you're right, I'd missed that part of the code!
Fixed in https://github.com/FakeFishGames/Barotrauma-development/commit/c9d49ed77e5cfdc54a82c60b140b5002736a403d