FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.74k stars 405 forks source link

Update WaitForItemUsedAction will cause the action registered by ItemComponent.OnUsed to be overwritten but this is unexpected behavior in XML code #14826

Open Regalis11 opened 1 week ago

Regalis11 commented 1 week ago

Discussed in https://github.com/FakeFishGames/Barotrauma/discussions/14795

Originally posted by **zhu-rengong** October 8, 2024 ### 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? If there is a Scripted Event with WaitForItemUsedAction, when you trigger the event twice, the OnUsed action registered for the tagged Item will be overwritten. Take the following script as an example: I expect that when you use a revolver, a round will be spawned in the revolver, but i got only 1 round after triggering the same event twice. ```xml ``` ### Reproduction steps 1. copy the above xml code 2. type in `triggerevent spawn_round_after_use_revolver` twice 3. fire revolver, you will only get 1 round spawned 4. type in `triggerevent spawn_round_after_use_revolver` and `triggerevent spawn_round_after_use_revolver_copy1` once 5. fire revolver, you will get 2 rounds spawned in expectation https://github.com/user-attachments/assets/c2fde3fb-3f89-43e3-91af-b2ac5611c760 ### Bug prevalence Happens every now and then ### Single player or multiplayer? Single player ### - _No response_ ### Version v1.5.9.2 (Summer Update Hotfix 2) ### - _No response_ ### Which operating system did you encounter this bug on? Windows ### Relevant error messages and crash reports _No response_
Regalis11 commented 1 week ago

Fixed in https://github.com/FakeFishGames/Barotrauma-development/commit/d7bcf0fae34e49d09c42a792b9a9acd8b5342f22