mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
portal particles
This commit is contained in:
parent
09f7087ac6
commit
bb2034ca92
@ -83,6 +83,7 @@ const int GIGA_SNOW = 42;
|
||||
const int CYCLOPS_CHARGE = 43;
|
||||
const int PORTAL_FIZZ = 45;
|
||||
const int INK = 46;
|
||||
const int UPWARD_PORTAL_FIZZ = 47;
|
||||
|
||||
// meters per second squared (acceleration)
|
||||
const float earth_gravity = 9.807;
|
||||
@ -692,6 +693,7 @@ void main() {
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
||||
);
|
||||
break;
|
||||
<<<<<<< HEAD
|
||||
case INK:
|
||||
f_reflect = 0.0; // Magic water doesn't reflect light, it emits it
|
||||
float black_color = 0.3 + 0.2 * rand3 + 0.3 * max(floor(rand4 + 0.3), 0.0);
|
||||
@ -701,6 +703,15 @@ void main() {
|
||||
vec3(ink_size),
|
||||
vec4(0.5 * black_color, 0.75 * black_color, black_color, 1),
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), percent() * 10 + 3 * rand9)
|
||||
=======
|
||||
case UPWARD_PORTAL_FIZZ:
|
||||
f_reflect = 0.0;
|
||||
attr = Attr(
|
||||
inst_dir * percent(),
|
||||
vec3(max(1.0, 0.05 * length(start_pos + inst_dir * percent()))),
|
||||
vec4(vec3(1.23, 1.41, 1.44), 1.0),// * (1.0 - length(inst_dir) * 0.1),
|
||||
identity()//spin_in_axis(perp_axis, asin(inst_dir.z / length(inst_dir)) + PI / 2.0)
|
||||
>>>>>>> 70e6945e87 (portal particles)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
|
@ -201,7 +201,7 @@ pub struct EntityInfo {
|
||||
//Option<hashbrown::HashMap<crate::trade::Good, (f32, f32)>>, /* price and available amount */
|
||||
|
||||
// Edge cases, override everything else
|
||||
pub special_entity: Option<SpecialEntity>, // Campfire
|
||||
pub special_entity: Option<SpecialEntity>,
|
||||
}
|
||||
|
||||
impl EntityInfo {
|
||||
|
@ -129,7 +129,7 @@ impl<'a> System<'a> for Sys {
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
static_data: blink::StaticData {
|
||||
buildup_duration: Duration::from_millis((remaining * 1000.) as u64),
|
||||
buildup_duration: Duration::from_secs_f64(remaining),
|
||||
recover_duration: Duration::default(),
|
||||
max_range: 0.,
|
||||
ability_info: AbilityInfo {
|
||||
|
@ -98,6 +98,7 @@ pub enum ParticleMode {
|
||||
SnowStorm = 44,
|
||||
PortalFizz = 45,
|
||||
Ink = 46,
|
||||
UpwardPortalFizz = 47,
|
||||
}
|
||||
|
||||
impl ParticleMode {
|
||||
|
@ -499,6 +499,12 @@ impl ParticleMgr {
|
||||
| object::Body::FireworkWhite
|
||||
| object::Body::FireworkYellow,
|
||||
) => self.maintain_bomb_particles(scene_data, interpolated.pos, vel),
|
||||
Body::Object(object::Body::PortalActive) => {
|
||||
self.maintain_active_portal_particles(scene_data, interpolated.pos)
|
||||
},
|
||||
Body::Object(object::Body::Portal) => {
|
||||
self.maintain_portal_particles(scene_data, interpolated.pos)
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
@ -723,6 +729,56 @@ impl ParticleMgr {
|
||||
}
|
||||
}
|
||||
|
||||
fn maintain_active_portal_particles(&mut self, scene_data: &SceneData, pos: Vec3<f32>) {
|
||||
span!(
|
||||
_guard,
|
||||
"active_portal_particles",
|
||||
"ParticleMgr::maintain_active_portal_particles"
|
||||
);
|
||||
|
||||
let time = scene_data.state.get_time();
|
||||
let mut rng = thread_rng();
|
||||
|
||||
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(5)) {
|
||||
let outer_pos =
|
||||
pos + (Vec2::unit_x().rotated_z(rng.gen_range((0.)..PI * 2.)) * 2.7).with_z(0.);
|
||||
|
||||
self.particles.push(Particle::new_directed(
|
||||
Duration::from_secs_f32(rng.gen_range(0.2..0.5)),
|
||||
time,
|
||||
ParticleMode::UpwardPortalFizz,
|
||||
outer_pos,
|
||||
outer_pos + Vec3::unit_z() * rng.gen_range(5.0..7.0),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn maintain_portal_particles(&mut self, scene_data: &SceneData, pos: Vec3<f32>) {
|
||||
span!(
|
||||
_guard,
|
||||
"portal_particles",
|
||||
"ParticleMgr::maintain_portal_particles"
|
||||
);
|
||||
|
||||
let time = scene_data.state.get_time();
|
||||
let mut rng = thread_rng();
|
||||
|
||||
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(150)) {
|
||||
let outer_pos = pos
|
||||
+ (Vec2::unit_x().rotated_z(rng.gen_range((0.)..PI * 2.))
|
||||
* rng.gen_range(1.0..2.9))
|
||||
.with_z(0.);
|
||||
|
||||
self.particles.push(Particle::new_directed(
|
||||
Duration::from_secs_f32(rng.gen_range(0.5..3.0)),
|
||||
time,
|
||||
ParticleMode::UpwardPortalFizz,
|
||||
outer_pos,
|
||||
outer_pos + Vec3::unit_z() * rng.gen_range(3.0..4.0),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn maintain_mine_particles(&mut self, scene_data: &SceneData, pos: Vec3<f32>) {
|
||||
span!(
|
||||
_guard,
|
||||
|
Loading…
Reference in New Issue
Block a user