Conversation
| self.set_block(pos, BlockId::air()) | ||
| } | ||
|
|
||
| pub fn reset_player(&self, player: EntityRef) { |
There was a problem hiding this comment.
I think just completely ignoring a failure here is not ideal, maybe return an error of some kind upon failure.
| /// Increasing distance of an entity falling. Used to calculate | ||
| /// fall damage for entities with health. |
There was a problem hiding this comment.
Assuming I understand what this means, I think it would be best to say something similar to
/// Distance fallen since an entity was on solid ground.
Without the explanation of what the type is for.
|
Should be mostly complete now. Someone glance over it again. |
|
It works quite weird when you bunnyhoping down from low hills, and you also take damage during bunnyhop with some delay. |
|
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. |
|
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 |
|
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). |
|
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. |
| let client_id = game.ecs.get::<ClientId>(player_id).unwrap(); | ||
| let client = server.clients.get(*client_id).unwrap(); |
There was a problem hiding this comment.
Can't you ? these instead of unwrapping?
There was a problem hiding this comment.
Yea, not sure why I used unwrap there, but returning an error is the better way. Though not sure what error would be appropriate for server.clients.get instead of unwrapping if any?
| let network_id = game.ecs.get::<NetworkId>(player_id).unwrap(); | ||
| let position = game.ecs.get::<Position>(player_id).unwrap(); | ||
| let uuid = game.ecs.get::<Uuid>(player_id).unwrap(); |
There was a problem hiding this comment.
Can't you ? these instead of unwrapping?
|
Is this PR mergable ? |
|
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. |
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
cargo fmt,cargo clippy --all-targets,cargo build --releaseandcargo testand fixed any generated errors!Used specific traces (if you trace actions please specify the cause i.e. the player)