[Unstable] Some bugs about grenade rework
Discussed in https://github.com/FakeFishGames/Barotrauma/discussions/14227
Originally posted by zhu-rengong June 28, 2024
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?
Issue 1 Only pulling the grenade pin and waiting for it to explode will not reduce reputation. Issue 2 In multiplayer, the grenade will keep emitting a large number of particles (safety pins) after being thrown. Issue 3 If you start the next round while the grenade is cooking, it will stop cooking.
Test Videos:
https://github.com/FakeFishGames/Barotrauma/assets/73634685/bca5688d-020b-4c8b-b6f2-46663cdf6d79
https://github.com/FakeFishGames/Barotrauma/assets/73634685/d273f07e-df5a-465c-8602-913e6281cdb9
https://github.com/FakeFishGames/Barotrauma/assets/73634685/e6730925-ec27-4017-a8cb-beabecf9e673
Fixes for each of the above issues (take frag grenade as example): Issue 1 Based on the code here: https://github.com/FakeFishGames/Barotrauma/blob/4f556236b877ae99438fd83ede21d7b415705b9c/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs#L925-L935 we used the following 2 StatusEffects to track the user who pull the pin
<ItemComponent
<StatusEffect type="OnUse" target="This" indestructible="true" condition="0.0" setvalue="true" comparison="And" />
<StatusEffect type="OnUse" target="This" indestructible="false" setvalue="true" />
</ItemComponent>
Issue 2
No idea, it looks like <Use /> is being applied multiple times.
Issue 3
Use Powered instead of ItemComponent due to its IsActive property is not savable but the former's is.
https://github.com/FakeFishGames/Barotrauma/blob/4f556236b877ae99438fd83ede21d7b415705b9c/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs#L111-L129
https://github.com/FakeFishGames/Barotrauma/blob/4f556236b877ae99438fd83ede21d7b415705b9c/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Power/Powered.cs#L122-L134
Reproduction steps
- Host server
- Start a campaign
- Follow the steps of above videos
Bug prevalence
Happens every now and then
Single player or multiplayer?
Multiplayer hosted from the in-game menu (= using a listen server)
-
No response
Version
v1.6.100.0 (unstable)
-
No response
Which operating system did you encounter this bug on?
Windows
Relevant error messages and crash reports
No response
Fixed in https://github.com/FakeFishGames/Barotrauma-development/issues/5535
Tested, working correctly. Can be merged and closed.