mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Started to add particles.
This commit is contained in:
@ -51,6 +51,7 @@ const int BEE = 11;
|
|||||||
const int GROUND_SHOCKWAVE = 12;
|
const int GROUND_SHOCKWAVE = 12;
|
||||||
const int HEALING_BEAM = 13;
|
const int HEALING_BEAM = 13;
|
||||||
const int ENERGY_NATURE = 14;
|
const int ENERGY_NATURE = 14;
|
||||||
|
const int FLAMETHROWER = 15;
|
||||||
|
|
||||||
// meters per second squared (acceleration)
|
// meters per second squared (acceleration)
|
||||||
const float earth_gravity = 9.807;
|
const float earth_gravity = 9.807;
|
||||||
@ -286,6 +287,13 @@ void main() {
|
|||||||
vec4(vec3(0, 1, 0), 1),
|
vec4(vec3(0, 1, 0), 1),
|
||||||
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
||||||
);
|
);
|
||||||
|
} else if (inst_mode == FLAMETHROWER) {
|
||||||
|
attr = Attr(
|
||||||
|
inst_dir * lifetime / inst_lifespan,
|
||||||
|
vec3(1),
|
||||||
|
vec4(1, 0.3 + rand5 * 0.4, 0, 0.4),
|
||||||
|
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
attr = Attr(
|
attr = Attr(
|
||||||
linear_motion(
|
linear_motion(
|
||||||
|
@ -413,12 +413,12 @@ impl Tool {
|
|||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: Duration::from_millis(250),
|
buildup_duration: Duration::from_millis(250),
|
||||||
recover_duration: Duration::from_millis(250),
|
recover_duration: Duration::from_millis(250),
|
||||||
beam_duration: Duration::from_secs(1),
|
beam_duration: Duration::from_millis(500),
|
||||||
base_hps: 0,
|
base_hps: 0,
|
||||||
base_dps: (100.0 * self.base_power()) as u32,
|
base_dps: (100.0 * self.base_power()) as u32,
|
||||||
tick_rate: 2.0,
|
tick_rate: 2.0,
|
||||||
range: 15.0,
|
range: 15.0,
|
||||||
max_angle: 45.0,
|
max_angle: 22.5,
|
||||||
lifesteal_eff: 0.0,
|
lifesteal_eff: 0.0,
|
||||||
energy_regen: 50,
|
energy_regen: 50,
|
||||||
energy_drain: 0,
|
energy_drain: 0,
|
||||||
|
@ -111,6 +111,7 @@ pub enum ParticleMode {
|
|||||||
GroundShockwave = 12,
|
GroundShockwave = 12,
|
||||||
HealingBeam = 13,
|
HealingBeam = 13,
|
||||||
EnergyNature = 14,
|
EnergyNature = 14,
|
||||||
|
FlameThrower = 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParticleMode {
|
impl ParticleMode {
|
||||||
|
@ -354,6 +354,7 @@ impl ParticleMgr {
|
|||||||
if let CharacterState::BasicBeam(b) = character_state {
|
if let CharacterState::BasicBeam(b) = character_state {
|
||||||
let particle_ori = b.particle_ori.unwrap_or(*ori.vec());
|
let particle_ori = b.particle_ori.unwrap_or(*ori.vec());
|
||||||
if b.stage_section == StageSection::Cast {
|
if b.stage_section == StageSection::Cast {
|
||||||
|
if b.static_data.base_hps > 0 {
|
||||||
for i in 0..self.scheduler.heartbeats(Duration::from_millis(1)) {
|
for i in 0..self.scheduler.heartbeats(Duration::from_millis(1)) {
|
||||||
self.particles.push(Particle::new_beam(
|
self.particles.push(Particle::new_beam(
|
||||||
b.static_data.beam_duration,
|
b.static_data.beam_duration,
|
||||||
@ -365,6 +366,41 @@ impl ParticleMgr {
|
|||||||
+ Vec3::new(0.0, 0.0, b.offset),
|
+ Vec3::new(0.0, 0.0, b.offset),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
let mut rng = thread_rng();
|
||||||
|
let (phi, theta) = (particle_ori.z.acos(), particle_ori.y.atan2(particle_ori.x));
|
||||||
|
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(1)) {
|
||||||
|
let phi2 = phi + rng.gen_range(-b.static_data.max_angle.to_radians(), b.static_data.max_angle.to_radians());
|
||||||
|
let theta2 = theta + rng.gen_range(-b.static_data.max_angle.to_radians(), b.static_data.max_angle.to_radians());
|
||||||
|
let random_ori = Vec3::new(phi2.sin()*theta2.cos(), phi2.sin()*theta2.sin(), phi2.cos()).try_normalized().unwrap_or(particle_ori);
|
||||||
|
self.particles.push(Particle::new_beam(
|
||||||
|
b.static_data.beam_duration,
|
||||||
|
time,
|
||||||
|
ParticleMode::FlameThrower,
|
||||||
|
pos.0 + random_ori * 0.5 + Vec3::new(0.0, 0.0, b.offset),
|
||||||
|
pos.0
|
||||||
|
+ random_ori * b.static_data.range
|
||||||
|
+ Vec3::new(0.0, 0.0, b.offset),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
/*self.particles.resize_with(
|
||||||
|
self.particles.len() + 10 * usize::from(self.scheduler.heartbeats(Duration::from_millis(1))),
|
||||||
|
|| {
|
||||||
|
let phi2 = phi + rng.gen_range(-b.static_data.max_angle.to_radians(), b.static_data.max_angle.to_radians());
|
||||||
|
let theta2 = theta + rng.gen_range(-b.static_data.max_angle.to_radians(), b.static_data.max_angle.to_radians());
|
||||||
|
let random_ori = Vec3::new(phi2.sin()*theta2.cos(), phi2.sin()*theta2.sin(), phi2.cos()).try_normalized().unwrap_or(particle_ori);
|
||||||
|
Particle::new_beam(
|
||||||
|
b.static_data.beam_duration,
|
||||||
|
time,
|
||||||
|
ParticleMode::FlameThrower,
|
||||||
|
pos.0 + random_ori * 0.5 + Vec3::new(0.0, 0.0, b.offset),
|
||||||
|
pos.0
|
||||||
|
+ random_ori * b.static_data.range
|
||||||
|
+ Vec3::new(0.0, 0.0, b.offset),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
);*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,6 +550,7 @@ impl ParticleMgr {
|
|||||||
let theta = ori.0.y.atan2(ori.0.x);
|
let theta = ori.0.y.atan2(ori.0.x);
|
||||||
let dtheta = radians / distance;
|
let dtheta = radians / distance;
|
||||||
|
|
||||||
|
if shockwave.properties.requires_ground {
|
||||||
// 1 / 3 the size of terrain voxel
|
// 1 / 3 the size of terrain voxel
|
||||||
let scale = 1.0 / 3.0;
|
let scale = 1.0 / 3.0;
|
||||||
|
|
||||||
@ -547,6 +584,9 @@ impl ParticleMgr {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user