mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed non-dismounting teleportation
This commit is contained in:
parent
68491dde55
commit
5988237b3d
@ -230,15 +230,15 @@ fn position_mut<T>(
|
|||||||
dismount_volume: Option<bool>,
|
dismount_volume: Option<bool>,
|
||||||
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
||||||
) -> CmdResult<T> {
|
) -> CmdResult<T> {
|
||||||
let entity = if dismount_volume.unwrap_or(true) {
|
if dismount_volume.unwrap_or(true) {
|
||||||
server
|
server
|
||||||
.state
|
.state
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_storage::<Is<VolumeRider>>()
|
.write_storage::<Is<VolumeRider>>()
|
||||||
.remove(entity);
|
.remove(entity);
|
||||||
entity
|
}
|
||||||
} else {
|
|
||||||
server
|
let entity = server
|
||||||
.state
|
.state
|
||||||
.read_storage::<Is<Rider>>()
|
.read_storage::<Is<Rider>>()
|
||||||
.get(entity)
|
.get(entity)
|
||||||
@ -249,7 +249,9 @@ fn position_mut<T>(
|
|||||||
.read_resource::<UidAllocator>()
|
.read_resource::<UidAllocator>()
|
||||||
.retrieve_entity_internal(is_rider.mount.into())
|
.retrieve_entity_internal(is_rider.mount.into())
|
||||||
})
|
})
|
||||||
.or(server
|
.map(Ok)
|
||||||
|
.or_else(|| {
|
||||||
|
server
|
||||||
.state
|
.state
|
||||||
.read_storage::<Is<VolumeRider>>()
|
.read_storage::<Is<VolumeRider>>()
|
||||||
.get(entity)
|
.get(entity)
|
||||||
@ -265,9 +267,8 @@ fn position_mut<T>(
|
|||||||
.retrieve_entity_internal(uid.into())?),
|
.retrieve_entity_internal(uid.into())?),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.transpose()?)
|
})
|
||||||
.unwrap_or(entity)
|
.unwrap_or(Ok(entity))?;
|
||||||
};
|
|
||||||
|
|
||||||
let mut maybe_pos = None;
|
let mut maybe_pos = None;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user