Flamethrower particles.

This commit is contained in:
Sam 2020-10-04 15:44:28 -05:00
parent c80f16ae74
commit 04dcd012da
3 changed files with 33 additions and 45 deletions

View File

@ -289,10 +289,10 @@ void main() {
);
} 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)
(inst_dir * lifetime / inst_lifespan) + vec3(rand0, rand1, rand2) * 0.3,
vec3(0.6 + rand3 * 0.5 + lifetime / inst_lifespan * 5),
vec4(1, 0.6 + rand5 * 0.3 - 0.6 * lifetime / inst_lifespan, 0, 0.8 - 0.6 * lifetime / inst_lifespan),
spin_in_axis(vec3(rand6, rand7, rand8), lifetime / inst_lifespan * 10 + 3 * rand9)
);
} else {
attr = Attr(

View File

@ -367,11 +367,11 @@ impl Tool {
recover_duration: Duration::from_millis(250),
beam_duration: Duration::from_secs(1),
base_hps: (60.0 * self.base_power()) as u32,
base_dps: (40.0 * self.base_power()) as u32,
base_dps: (60.0 * self.base_power()) as u32,
tick_rate: 2.0,
range: 25.0,
max_angle: 1.0,
lifesteal_eff: 0.25,
lifesteal_eff: 0.20,
energy_regen: 50,
energy_drain: 100,
},
@ -409,22 +409,8 @@ impl Tool {
},
],
Staff(_) => vec![
BasicBeam {
energy_cost: 0,
buildup_duration: Duration::from_millis(250),
recover_duration: Duration::from_millis(250),
beam_duration: Duration::from_millis(500),
base_hps: 0,
base_dps: (100.0 * self.base_power()) as u32,
tick_rate: 2.0,
range: 15.0,
max_angle: 22.5,
lifesteal_eff: 0.0,
energy_regen: 50,
energy_drain: 0,
},
BasicRanged {
energy_cost: 400,
energy_cost: 0,
holdable: true,
prepare_duration: Duration::from_millis(800),
recover_duration: Duration::from_millis(50),
@ -455,8 +441,22 @@ impl Tool {
projectile_gravity: Some(Gravity(0.5)),
projectile_speed: 40.0,
},
BasicBeam {
energy_cost: 0,
buildup_duration: Duration::from_millis(250),
recover_duration: Duration::from_millis(250),
beam_duration: Duration::from_millis(500),
base_hps: 0,
base_dps: (100.0 * self.base_power()) as u32,
tick_rate: 2.0,
range: 15.0,
max_angle: 22.5,
lifesteal_eff: 0.0,
energy_regen: 50,
energy_drain: 0,
},
Shockwave {
energy_cost: 750,
energy_cost: 0,
buildup_duration: Duration::from_millis(500),
recover_duration: Duration::from_millis(300),
damage: 200,

View File

@ -22,7 +22,7 @@ use dot_vox::DotVoxData;
use hashbrown::HashMap;
use rand::prelude::*;
use specs::{Join, WorldExt};
use std::time::Duration;
use std::{f32::consts::PI, time::Duration};
use vek::*;
pub struct ParticleMgr {
@ -368,27 +368,15 @@ impl ParticleMgr {
}
} 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 (from, to) = (Vec3::<f32>::unit_z(), particle_ori);
let m = Mat3::<f32>::rotation_from_to_3d(from, to);
self.particles.resize_with(
self.particles.len() + 2 * 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);
let phi: f32 = rng.gen_range(0.0, b.static_data.max_angle.to_radians());
let theta: f32 = rng.gen_range(0.0, 2.0 * PI);
let offset_z = Vec3::new(phi.sin() * theta.cos(), phi.sin() * theta.sin(), phi.cos());
let random_ori = offset_z * m * Vec3::new(-1.0, -1.0, 1.0);
Particle::new_beam(
b.static_data.beam_duration,
time,
@ -399,7 +387,7 @@ impl ParticleMgr {
+ Vec3::new(0.0, 0.0, b.offset),
)
},
);*/
);
}
}
}
@ -769,4 +757,4 @@ impl Particle {
instance: ParticleInstance::new_beam(time, lifespan.as_secs_f32(), mode, pos1, pos2),
}
}
}
}