Fix heavy coins ignoring water physics (Closes #3729)#3771
Fix heavy coins ignoring water physics (Closes #3729)#3771franciscogfsm wants to merge 6 commits intoSuperTux:masterfrom
Conversation
Heavy coins (and coins dropped by killed enemies) were not applying water physics when falling into water, causing them to sink straight to the bottom at full speed instead of becoming floaty. Fixed by adding a per-frame water tile check in HeavyCoin::update(). When the coin is detected inside a water tile, the gravity modifier is reduced to 0.1 and the downward velocity is capped at 100, matching the floaty behaviour of other physics objects like rocks and enemies. Use named constants for water physics values Testing Implemented for the Bug Fix
|
Hello, just curious which AI model you used for this? |
|
Hey what do you think its wrong apart from the tests so i can improve ? |
|
Did you utilize an LLM to make this contribution? You did not answer that. What I think is wrong is the test cases existing in the first place: we got a slew of contributions making test cases for game logic. We don't desire unit tests for physics like this because we sometimes also change these things based on the eye (and tbh, they are kind of redundant...), thus we can't honestly maintain tests like that. |
|
Hey, yeah I used AI for the comments, english is not my main language so i used it just to be clear about what changed and why. I totally get the issue with the tests. The actual fix I wrote and tested manually myself, heavy coins now float in water as expected, i am just slowing down the gravity and checking if its a water tile, in terms of performance i also don't think its an issue. Thank you for your feedback hope we can close this. |
|
Hey, i have removed the unecessary files, now is just the gravity tweak. |
There was a problem hiding this comment.
I think you restored the wrong file... :)
You can try doing a git revert for that one.
Fix #3729: Heavy coins not affected by water physics
Heavy coins (and coins dropped by killed enemies) were not applying
water physics when falling into water, causing them to sink straight
to the bottom at full speed instead of floating like other objects.
Fixed by adding a per-frame water tile check in HeavyCoin::update().
When the coin is detected inside a water tile:
This matches the floaty behaviour of other physics objects such as
rocks and enemies. Named constants are used for both water physics
values to avoid magic numbers.
Tested manually by dropping heavy coins and enemy-dropped coins into
water both now float as expected. Automated tests have also been
implemented covering the fix.
Closes #3729