mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed offsets for laser and rocket attacks of clay golem.
This commit is contained in:
parent
770d07ac90
commit
7f6c6c5603
@ -9,5 +9,5 @@ BasicRanged(
|
|||||||
),
|
),
|
||||||
projectile_body: Object(ClayRocket),
|
projectile_body: Object(ClayRocket),
|
||||||
projectile_light: None,
|
projectile_light: None,
|
||||||
projectile_speed: 20.0,
|
projectile_speed: 30.0,
|
||||||
)
|
)
|
||||||
|
@ -140,24 +140,26 @@ impl CharacterBehavior for Data {
|
|||||||
owner: Some(*data.uid),
|
owner: Some(*data.uid),
|
||||||
specifier: self.static_data.specifier,
|
specifier: self.static_data.specifier,
|
||||||
};
|
};
|
||||||
|
// Gets offsets
|
||||||
|
let body_offsets_r = data.body.radius() + 1.0;
|
||||||
let body_offsets_z = match data.body {
|
let body_offsets_z = match data.body {
|
||||||
Body::BirdLarge(_) | Body::Golem(_) => data.body.height() * 0.8,
|
Body::BirdLarge(_) => data.body.height() * 0.8,
|
||||||
|
Body::Golem(_) => data.body.height() * 0.9 + data.inputs.look_dir.z * 3.0,
|
||||||
_ => data.body.height() * 0.5,
|
_ => data.body.height() * 0.5,
|
||||||
};
|
};
|
||||||
// Gets offsets
|
|
||||||
let (body_offsets, ori) = match self.static_data.orientation_behavior {
|
let (body_offsets, ori) = match self.static_data.orientation_behavior {
|
||||||
OrientationBehavior::Normal | OrientationBehavior::Turret => (
|
OrientationBehavior::Normal | OrientationBehavior::Turret => (
|
||||||
Vec3::new(
|
Vec3::new(
|
||||||
(data.body.radius() + 1.0) * data.inputs.look_dir.x,
|
body_offsets_r * data.inputs.look_dir.x,
|
||||||
(data.body.radius() + 1.0) * data.inputs.look_dir.y,
|
body_offsets_r * data.inputs.look_dir.y,
|
||||||
body_offsets_z,
|
body_offsets_z,
|
||||||
),
|
),
|
||||||
Ori::from(data.inputs.look_dir),
|
Ori::from(data.inputs.look_dir),
|
||||||
),
|
),
|
||||||
OrientationBehavior::FromOri => (
|
OrientationBehavior::FromOri => (
|
||||||
Vec3::new(
|
Vec3::new(
|
||||||
(data.body.radius() + 1.0) * update.ori.look_vec().x,
|
body_offsets_r * update.ori.look_vec().x,
|
||||||
(data.body.radius() + 1.0) * update.ori.look_vec().y,
|
body_offsets_r * update.ori.look_vec().y,
|
||||||
body_offsets_z,
|
body_offsets_z,
|
||||||
),
|
),
|
||||||
Ori::from(Vec3::new(
|
Ori::from(Vec3::new(
|
||||||
|
@ -187,11 +187,15 @@ pub fn handle_shoot(
|
|||||||
.write_resource::<Vec<Outcome>>()
|
.write_resource::<Vec<Outcome>>()
|
||||||
.push(Outcome::ProjectileShot { pos, body, vel });
|
.push(Outcome::ProjectileShot { pos, body, vel });
|
||||||
|
|
||||||
let eye_height = state
|
let eye_height =
|
||||||
.ecs()
|
state
|
||||||
.read_storage::<comp::Body>()
|
.ecs()
|
||||||
.get(entity)
|
.read_storage::<comp::Body>()
|
||||||
.map_or(0.0, |b| b.eye_height());
|
.get(entity)
|
||||||
|
.map_or(0.0, |b| match b {
|
||||||
|
comp::Body::Golem(_) => b.height() * 0.45,
|
||||||
|
_ => b.eye_height(),
|
||||||
|
});
|
||||||
|
|
||||||
pos.z += eye_height;
|
pos.z += eye_height;
|
||||||
|
|
||||||
|
@ -1649,7 +1649,7 @@ impl<'a> AgentData<'a> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Tactic::ClayGolem if matches!(self.char_state, CharacterState::BasicRanged(_)) => {
|
Tactic::ClayGolem if matches!(self.char_state, CharacterState::BasicRanged(_)) => {
|
||||||
const ROCKET_SPEED: f32 = 20.0;
|
const ROCKET_SPEED: f32 = 30.0;
|
||||||
aim_projectile(
|
aim_projectile(
|
||||||
ROCKET_SPEED,
|
ROCKET_SPEED,
|
||||||
Vec3::new(self.pos.0.x, self.pos.0.y, self.pos.0.z + eye_offset),
|
Vec3::new(self.pos.0.x, self.pos.0.y, self.pos.0.z + eye_offset),
|
||||||
@ -3508,6 +3508,7 @@ impl<'a> AgentData<'a> {
|
|||||||
tgt_data.pos,
|
tgt_data.pos,
|
||||||
attack_data.dist_sqrd,
|
attack_data.dist_sqrd,
|
||||||
)
|
)
|
||||||
|
&& attack_data.angle < 45.0
|
||||||
{
|
{
|
||||||
// If target in range threshold and haven't been lasering for more than 10
|
// If target in range threshold and haven't been lasering for more than 10
|
||||||
// seconds already or if target is moving slow-ish, laser them
|
// seconds already or if target is moving slow-ish, laser them
|
||||||
|
Loading…
Reference in New Issue
Block a user