mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'juliancoffee/pillar_fix' into 'master'
Nerf pillars + Fix Beam ori See merge request veloren/veloren!2732
This commit is contained in:
commit
2b10f818f5
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Cultist,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 50,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: FromOri,
|
||||
ori_rate: 0.07,
|
||||
specifier: ClayGolem,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.2,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: FromOri,
|
||||
ori_rate: 0.2,
|
||||
specifier: Cultist,
|
||||
)
|
||||
|
@ -9,7 +9,6 @@ BasicBeam(
|
||||
damage_effect: Some(Lifesteal(0.15)),
|
||||
energy_regen: 25,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: LifestealBeam,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Bubbles,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: FromOri,
|
||||
ori_rate: 0.1,
|
||||
specifier: Frost,
|
||||
)
|
||||
|
@ -9,7 +9,6 @@ BasicBeam(
|
||||
damage_effect: Some(Lifesteal(0.125)),
|
||||
energy_regen: 50,
|
||||
energy_drain: 0,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: LifestealBeam
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 350,
|
||||
orientation_behavior: Normal,
|
||||
ori_rate: 0.3,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ BasicBeam(
|
||||
))),
|
||||
energy_regen: 0,
|
||||
energy_drain: 350,
|
||||
orientation_behavior: FromOri,
|
||||
ori_rate: 0.3,
|
||||
specifier: Flamethrower,
|
||||
)
|
||||
|
@ -251,7 +251,6 @@ pub enum CharacterAbility {
|
||||
damage_effect: Option<CombatEffect>,
|
||||
energy_regen: f32,
|
||||
energy_drain: f32,
|
||||
orientation_behavior: basic_beam::OrientationBehavior,
|
||||
ori_rate: f32,
|
||||
specifier: beam::FrontendSpecifier,
|
||||
},
|
||||
@ -745,7 +744,6 @@ impl CharacterAbility {
|
||||
ref mut damage_effect,
|
||||
energy_regen: _,
|
||||
ref mut energy_drain,
|
||||
orientation_behavior: _,
|
||||
ori_rate: _,
|
||||
specifier: _,
|
||||
} => {
|
||||
@ -1878,7 +1876,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
damage_effect,
|
||||
energy_regen,
|
||||
energy_drain,
|
||||
orientation_behavior,
|
||||
ori_rate,
|
||||
specifier,
|
||||
} => CharacterState::BasicBeam(basic_beam::Data {
|
||||
@ -1894,7 +1891,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
energy_regen: *energy_regen,
|
||||
energy_drain: *energy_drain,
|
||||
ability_info,
|
||||
orientation_behavior: *orientation_behavior,
|
||||
ori_rate: *ori_rate,
|
||||
specifier: *specifier,
|
||||
},
|
||||
|
@ -377,6 +377,8 @@ impl Body {
|
||||
Body::SeaLantern => Vec3::new(0.5, 0.5, 1.0),
|
||||
Body::Snowball => Vec3::broadcast(2.5),
|
||||
Body::Tornado => Vec3::new(2.0, 2.0, 3.4),
|
||||
Body::TrainingDummy => Vec3::new(1.5, 1.5, 3.0),
|
||||
// FIXME: this *must* be exhaustive match
|
||||
_ => Vec3::broadcast(0.5),
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ use crate::{
|
||||
utils::*,
|
||||
},
|
||||
uid::Uid,
|
||||
util::Dir,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
@ -38,8 +39,6 @@ pub struct StaticData {
|
||||
pub energy_regen: f32,
|
||||
/// Energy drained per second
|
||||
pub energy_drain: f32,
|
||||
/// Used to dictate how orientation functions in this state
|
||||
pub orientation_behavior: OrientationBehavior,
|
||||
/// How fast enemy can rotate with beam
|
||||
pub ori_rate: f32,
|
||||
/// What key is used to press ability
|
||||
@ -64,9 +63,6 @@ impl CharacterBehavior for Data {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
let ori_rate = self.static_data.ori_rate;
|
||||
if self.static_data.orientation_behavior == OrientationBehavior::Turret {
|
||||
update.ori = Ori::from(data.inputs.look_dir);
|
||||
}
|
||||
|
||||
handle_orientation(data, &mut update, ori_rate);
|
||||
handle_move(data, &mut update, 0.4);
|
||||
@ -135,41 +131,59 @@ impl CharacterBehavior for Data {
|
||||
owner: Some(*data.uid),
|
||||
specifier: self.static_data.specifier,
|
||||
};
|
||||
// Gets offsets
|
||||
let body_offsets_r = data.body.radius() + 1.0;
|
||||
let body_offsets_z = match data.body {
|
||||
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,
|
||||
let beam_ori = {
|
||||
// We want Beam to use Ori of owner.
|
||||
// But we also want beam to use Z part of where owner looks.
|
||||
// This means that we need to merge this data to one Ori.
|
||||
//
|
||||
// This code just gets look_dir without Z part
|
||||
// and normalizes it. This is what `xy_dir is`.
|
||||
//
|
||||
// Then we find rotation between xy_dir and look_dir
|
||||
// which gives us quaternion how of what rotation we need
|
||||
// to do to get Z part we want.
|
||||
//
|
||||
// Then we construct Ori without Z part
|
||||
// and applying `pitch` to get needed orientation.
|
||||
let look_dir = data.inputs.look_dir;
|
||||
let xy_dir = Dir::from_unnormalized(Vec3::new(look_dir.x, look_dir.y, 0.0))
|
||||
.unwrap_or_else(Dir::default);
|
||||
let pitch = xy_dir.rotation_between(look_dir);
|
||||
|
||||
Ori::from(Vec3::new(
|
||||
update.ori.look_vec().x,
|
||||
update.ori.look_vec().y,
|
||||
0.0,
|
||||
))
|
||||
.prerotated(pitch)
|
||||
};
|
||||
let (body_offsets, ori) = match self.static_data.orientation_behavior {
|
||||
OrientationBehavior::Normal | OrientationBehavior::Turret => (
|
||||
Vec3::new(
|
||||
body_offsets_r * data.inputs.look_dir.x,
|
||||
body_offsets_r * data.inputs.look_dir.y,
|
||||
body_offsets_z,
|
||||
),
|
||||
Ori::from(data.inputs.look_dir),
|
||||
),
|
||||
OrientationBehavior::FromOri => (
|
||||
Vec3::new(
|
||||
body_offsets_r * update.ori.look_vec().x,
|
||||
body_offsets_r * update.ori.look_vec().y,
|
||||
body_offsets_z,
|
||||
),
|
||||
Ori::from(Vec3::new(
|
||||
update.ori.look_vec().x,
|
||||
update.ori.look_vec().y,
|
||||
data.inputs.look_dir.z,
|
||||
)),
|
||||
),
|
||||
// Gets offsets
|
||||
let body_offsets = {
|
||||
let body_radius = data.body.radius();
|
||||
|
||||
// TODO: make it public function to use in Agent code
|
||||
// to help with aim.
|
||||
let body_offsets_z = match data.body {
|
||||
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,
|
||||
};
|
||||
|
||||
Vec3::new(
|
||||
body_radius * update.ori.look_vec().x * 1.1,
|
||||
body_radius * update.ori.look_vec().y * 1.1,
|
||||
body_offsets_z,
|
||||
)
|
||||
};
|
||||
let pos = Pos(data.pos.0 + body_offsets);
|
||||
|
||||
// Create beam segment
|
||||
update.server_events.push_front(ServerEvent::BeamSegment {
|
||||
properties,
|
||||
pos,
|
||||
ori,
|
||||
ori: beam_ori,
|
||||
});
|
||||
update.character = CharacterState::BasicBeam(Data {
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
@ -218,15 +232,3 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub enum OrientationBehavior {
|
||||
/// Uses look_dir as direction of beam
|
||||
Normal,
|
||||
/// Uses look_dir as direction of beam, sets orientation to same direction
|
||||
/// as look_dir
|
||||
Turret,
|
||||
/// Uses orientation x and y and look_dir z as direction of beam (z from
|
||||
/// look_dir as orientation will only go through 2d rotations naturally)
|
||||
FromOri,
|
||||
}
|
||||
|
@ -1787,10 +1787,20 @@ impl<'a> AgentData<'a> {
|
||||
0.0
|
||||
};
|
||||
|
||||
// FIXME: Retrieve actual projectile speed!
|
||||
// FIXME:
|
||||
// 1) Retrieve actual projectile speed!
|
||||
// We have to assume projectiles are faster than base speed because there are
|
||||
// skills that increase it, and in most cases this will cause agents to
|
||||
// overshoot
|
||||
//
|
||||
// 2) We use eye_offset-s which isn't actually ideal.
|
||||
// Some attacks (beam for example) may use different offsets,
|
||||
// we should probably use offsets from corresponding states.
|
||||
//
|
||||
// 3) Should we even have this big switch?
|
||||
// Not all attacks may want their direction overwritten.
|
||||
// And this is quite hard to debug when you don't see it in actual
|
||||
// attack handler.
|
||||
if let Some(dir) = match tactic {
|
||||
Tactic::Bow
|
||||
| Tactic::FixedTurret
|
||||
|
@ -1264,14 +1264,15 @@ impl Floor {
|
||||
min: (tile_center - Vec2::broadcast(1 + pillar_thickness - 1))
|
||||
.with_z(floor_z),
|
||||
max: (tile_center + Vec2::broadcast(1 + pillar_thickness))
|
||||
.with_z(floor_z + 3),
|
||||
.with_z(floor_z + 1),
|
||||
}));
|
||||
|
||||
let scale = (pillar_thickness + 2) as f32 / pillar_thickness as f32;
|
||||
let mut lights =
|
||||
prim(Primitive::Scale(pillar, Vec2::broadcast(scale).with_z(1.0)));
|
||||
lights = prim(Primitive::And(lighting_plane, lights));
|
||||
// Only add the base (and shift the lights up) for boss-room pillars
|
||||
// Only add the base (and shift the lights up)
|
||||
// for boss-rooms pillars
|
||||
if room.kind == RoomKind::Boss {
|
||||
lights = prim(Primitive::Translate(lights, 3 * Vec3::unit_z()));
|
||||
pillar = prim(Primitive::Or(pillar, base));
|
||||
|
Loading…
Reference in New Issue
Block a user