feather-rs / feather

A Minecraft server implementation in Rust
Apache License 2.0
2.58k stars 143 forks source link

Health and Fall damage systems #462

Open MrGunflame opened 2 years ago

MrGunflame commented 2 years ago

Health and Fall damage systems

Status

Description

Adds Health and Hunger components. Adds a health and fall damage system.

Related issues

358

Progress

Currently waiting for physics/velocity for correct player fall damage calcuation

Checklist

MrGunflame commented 2 years ago

Should be mostly complete now. Someone glance over it again.

qualterz commented 2 years ago

It works quite weird when you bunnyhoping down from low hills, and you also take damage during bunnyhop with some delay.

MrGunflame commented 2 years ago

Really hard to reproduce, I believe what happened was that when you hit the ground and jump again before the server ticks, the fall damage is calculated for both jumps. Resetting the fall distance when moving up should fix this, but this behavior should only be applied to players.

qualterz commented 2 years ago

Yep, looks like it is fixed. But there is another problem, sometimes when you fell down, the server does not register your fall at all, no one debug message about the missed fall. Demo

MrGunflame commented 2 years ago

That's a really weird one, seems to only happen when, immediately after connecting, you jump from a cliff into another chunk causing the client to reload and for some reason teleporting a bit up, resetting the falling distance. I'm not sure how to solve this in the current implementation while not re-enabling the bunnyhopping issue. I guess there's a reason minecraft uses player velocity to calculate fall damage, but that's not implemented in feather yet (afaik).

Defman commented 2 years ago

I think this is mostly do to physics not being implemented on server side, which means we 100% rely on the data from the client.

leElvyn commented 2 years ago

Is this PR mergable ?

MrGunflame commented 2 years ago

Currently this implementation works for mobs, but for players it's a little buggy due to entity physics not being implemented yet. I'd therefore wait until entity physics are implemented before merging this.