mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Adds a liveness check for mounting
This commit is contained in:
parent
09cbb90f61
commit
fafb344404
@ -113,8 +113,15 @@ pub fn handle_mount(server: &mut Server, mounter: EcsEntity, mountee: EcsEntity)
|
||||
state.ecs().read_storage::<comp::Pos>().get(mounter),
|
||||
state.ecs().read_storage::<comp::Pos>().get(mountee),
|
||||
);
|
||||
let alive = |e| {
|
||||
state
|
||||
.ecs()
|
||||
.read_storage::<comp::Health>()
|
||||
.get(e)
|
||||
.map_or(true, |h| !h.is_dead)
|
||||
};
|
||||
|
||||
if not_mounting_yet && within_range {
|
||||
if not_mounting_yet && within_range && alive(mounter) && alive(mountee) {
|
||||
if let (Some(mounter_uid), Some(mountee_uid)) = (
|
||||
state.ecs().uid_from_entity(mounter),
|
||||
state.ecs().uid_from_entity(mountee),
|
||||
|
Loading…
Reference in New Issue
Block a user