mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Don't allow interaction with mounted entity
This commit is contained in:
parent
edb0c87c29
commit
89cd58b1ac
@ -10,6 +10,8 @@ use client::Client;
|
||||
use common::{
|
||||
comp,
|
||||
consts::MAX_PICKUP_RANGE,
|
||||
link::Is,
|
||||
mounting::Mount,
|
||||
terrain::Block,
|
||||
util::find_dist::{Cube, Cylinder, FindDist},
|
||||
vol::ReadVol,
|
||||
@ -121,6 +123,7 @@ pub(super) fn select_interactable(
|
||||
let scales = ecs.read_storage::<comp::Scale>();
|
||||
let colliders = ecs.read_storage::<comp::Collider>();
|
||||
let char_states = ecs.read_storage::<comp::CharacterState>();
|
||||
let is_mount = ecs.read_storage::<Is<Mount>>();
|
||||
|
||||
let player_cylinder = Cylinder::from_components(
|
||||
player_pos,
|
||||
@ -135,10 +138,11 @@ pub(super) fn select_interactable(
|
||||
scales.maybe(),
|
||||
colliders.maybe(),
|
||||
char_states.maybe(),
|
||||
!&is_mount,
|
||||
)
|
||||
.join()
|
||||
.filter(|(e, _, _, _, _)| *e != player_entity)
|
||||
.map(|(e, p, s, c, cs)| {
|
||||
.filter(|(e, _, _, _, _, _)| *e != player_entity)
|
||||
.map(|(e, p, s, c, cs, _)| {
|
||||
let cylinder = Cylinder::from_components(p.0, s.copied(), c, cs);
|
||||
(e, cylinder)
|
||||
})
|
||||
|
@ -5,6 +5,8 @@ use client::{self, Client};
|
||||
use common::{
|
||||
comp,
|
||||
consts::MAX_PICKUP_RANGE,
|
||||
link::Is,
|
||||
mounting::Mount,
|
||||
terrain::Block,
|
||||
util::find_dist::{Cylinder, FindDist},
|
||||
vol::ReadVol,
|
||||
@ -123,10 +125,11 @@ pub(super) fn targets_under_cursor(
|
||||
scales.maybe(),
|
||||
&ecs.read_storage::<comp::Body>(),
|
||||
ecs.read_storage::<comp::Item>().maybe(),
|
||||
!&ecs.read_storage::<Is<Mount>>(),
|
||||
)
|
||||
.join()
|
||||
.filter(|(e, _, _, _, _)| *e != player_entity)
|
||||
.filter_map(|(e, p, s, b, i)| {
|
||||
.filter(|(e, _, _, _, _, _)| *e != player_entity)
|
||||
.filter_map(|(e, p, s, b, i, _)| {
|
||||
const RADIUS_SCALE: f32 = 3.0;
|
||||
// TODO: use collider radius instead of body radius?
|
||||
let radius = s.map_or(1.0, |s| s.0) * b.max_radius() * RADIUS_SCALE;
|
||||
|
Loading…
Reference in New Issue
Block a user