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::{
|
use common::{
|
||||||
comp,
|
comp,
|
||||||
consts::MAX_PICKUP_RANGE,
|
consts::MAX_PICKUP_RANGE,
|
||||||
|
link::Is,
|
||||||
|
mounting::Mount,
|
||||||
terrain::Block,
|
terrain::Block,
|
||||||
util::find_dist::{Cube, Cylinder, FindDist},
|
util::find_dist::{Cube, Cylinder, FindDist},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
@ -121,6 +123,7 @@ pub(super) fn select_interactable(
|
|||||||
let scales = ecs.read_storage::<comp::Scale>();
|
let scales = ecs.read_storage::<comp::Scale>();
|
||||||
let colliders = ecs.read_storage::<comp::Collider>();
|
let colliders = ecs.read_storage::<comp::Collider>();
|
||||||
let char_states = ecs.read_storage::<comp::CharacterState>();
|
let char_states = ecs.read_storage::<comp::CharacterState>();
|
||||||
|
let is_mount = ecs.read_storage::<Is<Mount>>();
|
||||||
|
|
||||||
let player_cylinder = Cylinder::from_components(
|
let player_cylinder = Cylinder::from_components(
|
||||||
player_pos,
|
player_pos,
|
||||||
@ -135,10 +138,11 @@ pub(super) fn select_interactable(
|
|||||||
scales.maybe(),
|
scales.maybe(),
|
||||||
colliders.maybe(),
|
colliders.maybe(),
|
||||||
char_states.maybe(),
|
char_states.maybe(),
|
||||||
|
!&is_mount,
|
||||||
)
|
)
|
||||||
.join()
|
.join()
|
||||||
.filter(|(e, _, _, _, _)| *e != player_entity)
|
.filter(|(e, _, _, _, _, _)| *e != player_entity)
|
||||||
.map(|(e, p, s, c, cs)| {
|
.map(|(e, p, s, c, cs, _)| {
|
||||||
let cylinder = Cylinder::from_components(p.0, s.copied(), c, cs);
|
let cylinder = Cylinder::from_components(p.0, s.copied(), c, cs);
|
||||||
(e, cylinder)
|
(e, cylinder)
|
||||||
})
|
})
|
||||||
|
@ -5,6 +5,8 @@ use client::{self, Client};
|
|||||||
use common::{
|
use common::{
|
||||||
comp,
|
comp,
|
||||||
consts::MAX_PICKUP_RANGE,
|
consts::MAX_PICKUP_RANGE,
|
||||||
|
link::Is,
|
||||||
|
mounting::Mount,
|
||||||
terrain::Block,
|
terrain::Block,
|
||||||
util::find_dist::{Cylinder, FindDist},
|
util::find_dist::{Cylinder, FindDist},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
@ -123,10 +125,11 @@ pub(super) fn targets_under_cursor(
|
|||||||
scales.maybe(),
|
scales.maybe(),
|
||||||
&ecs.read_storage::<comp::Body>(),
|
&ecs.read_storage::<comp::Body>(),
|
||||||
ecs.read_storage::<comp::Item>().maybe(),
|
ecs.read_storage::<comp::Item>().maybe(),
|
||||||
|
!&ecs.read_storage::<Is<Mount>>(),
|
||||||
)
|
)
|
||||||
.join()
|
.join()
|
||||||
.filter(|(e, _, _, _, _)| *e != player_entity)
|
.filter(|(e, _, _, _, _, _)| *e != player_entity)
|
||||||
.filter_map(|(e, p, s, b, i)| {
|
.filter_map(|(e, p, s, b, i, _)| {
|
||||||
const RADIUS_SCALE: f32 = 3.0;
|
const RADIUS_SCALE: f32 = 3.0;
|
||||||
// TODO: use collider radius instead of body radius?
|
// TODO: use collider radius instead of body radius?
|
||||||
let radius = s.map_or(1.0, |s| s.0) * b.max_radius() * RADIUS_SCALE;
|
let radius = s.map_or(1.0, |s| s.0) * b.max_radius() * RADIUS_SCALE;
|
||||||
|
Loading…
Reference in New Issue
Block a user