Open Wuzzy2 opened 3 years ago
For boats: https://github.com/minetest/minetest_game/blob/2e7b509a94dbbe2c407d47e9bd1ad1d97c403cfe/mods/boats/init.lua#L175-L178 Seems to be the result of this load-reducing early return.
That early return is useful for reducing load, as players tend to leave many boats sitting around, and water draining away from under a boat does not happen often. But, i agree that that boat floating should not happen when the boat has a driver, it is primarily for parked unoccupied boats.
So as a balance i suggest disabling that early return if the boat has a driver, a simple change to:
if not self.driver and self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
I will approve this if anyone makes a PR.
To fix carts i ask for advice from @SmallJoker
I will approve this if anyone makes a PR
Here you are: #2788
Yes sure, and the next issue will request physics to be applied in all cases so that carts and boats can jump off rails or cliffs.
In the design of boost_cart I intentionally avoided calculations as much as possible, so that a bunch of idling carts have no impact on the server performance. Though it should be okay to perform periodic checks (2... 5s) when the cart is standing still. The server physics engine then has to deal with collisions.
Yeah, i am not requesting changes to carts, i leave that to SmallJoker to judge.
The early return for carts seems to be:
https://github.com/minetest/minetest_game/blob/7ae983b66901cc5f58a8d48e33d01c4b8b1836a3/mods/carts/cart_entity.lua#L189-L196
So we could add not self.driver
just like boats so that there is no early return when a player is attached, unoccupied stationary carts would still trigger an early return.
However, i leave this to SmallJoker to decide.
Another simpler solution would be to check the node at long intervals, like every 5 seconds during "sleep mode". (with "sleep mode" I mean while the entity is not moving and returns.)
For the cart: When rail is missing: Apply simple gravity, until it hits solid ground or a rail, then it's at "sleep mode" again (unless the rail was a slope, then the cart "wakes" up and does normal rail physics). The gravity could just be a very basic downwards force, to keep things simple.
For the boat: Just check for the node every X seconds. If water (or a solid ground) is missing, force it to "wake up" and do a physics update.
For carts, rails could even instantly notify any cart above it, when they got destroyed.
I also had that issue with carts
If you place a boat, do not move the boat, and the water below it disappears / drains out, the boat keeps floating in mid-air. But the boat will fall as soon as a player starts to move the boat.
If you place a cart on a rail, then remove the block with the rail on it, the cart will float. You can not move it afterwards, unless you somehow find a way to place back the rail.
Version: 5.3.0