space-wizards / space-station-14

A multiplayer game about paranoia and chaos on a space station. Remake of the cult-classic Space Station 13.
https://spacestation14.io
MIT License
2.61k stars 3.26k forks source link

Throwing bottles of chemicals at someone can sometimes make more than you started with #29114

Open Erisfiregamer1 opened 3 months ago

Erisfiregamer1 commented 3 months ago

Description

Splashing chems at someone can sometimes make more then you had started with.

Reproduction Grab a bottle of Cognizine, your local Urist McHands, and a syringe + beaker. Throw the bottle of cog at the Urist and collect the stuff on the ground. Cry, as 30 < 44.6 (or more sometimes).

Put some armor and a jumpsuit on the Urist for a better result! I think this was just placebo, so... nevermind.

Screenshots (I'll attach more screenshots when I get them, this was hackily reproduced on Arcadis)

Additional context I found this out when an admin threw a 30u bottle of cognizine at me. (I got 50u from the puddles)

bruhmogus commented 3 months ago

can confirm, i am the admin who helped eris test

beck-thompson commented 3 months ago

I bet this is the same issue as the drains!

beck-thompson commented 3 months ago

Spent a while trying to figure it out! I think its something to do with the spreading but I'm not sure.

This fixes the bug: Change line 495 in PuddleSytem.cs from: _solutionContainerSystem.AddSolution(puddleComponent.Solution.Value, addedSolution); to: _solutionContainerSystem.TryTransferSolution(puddleComponent.Solution.Value, addedSolution, addedSolution.Volume);

No idea why this really works but it does fix the bug (I mean it doesn't make sense to add it anyway). There has to be a bigger issue where somewhere its being applied twice though so I don't think this is a good solution.

Also, the issue is that it double the amount of reagent in the puddle. The reason you get stuff like 30 -> 44.6 is because some of it gets like applied to people! If you throw it in an open space it exactly doubles the amount of reagent.

Tayrtahn commented 3 months ago

Ahh, I think I see what's happening.

I haven't tested this yet, but I'm guessing it's because there's a SpillableComponent on the bottle that has an event handler that makes it spill when it lands AND its DestructibleComponent has a SpillBehavior on it that makes it spill its contents when destroyed. And since it takes damage and gets destroyed when it lands, both wind up happening.

beck-thompson commented 3 months ago

I think your correct Tayrtahn! It looks like TrySplashSpillAt is being called once in DamageThreshold and once by SpillOnLand.

I really don't know how to approach fixing this (Which one should we keep or not keep etc..?) so I think someone else should probably do this!

Thanks for the insight Tayrahn 😎

Tayrtahn commented 3 months ago

Seems odd that TrySplashSpillAt apparently isn't actually removing the solution from the entity. That seems worth looking into.