Particle rebase fixes

This commit is contained in:
Sam 2021-02-26 14:32:22 -05:00 committed by jshipsey
parent 8d316aac8c
commit 238fcaf5f1
26 changed files with 139 additions and 148 deletions

View File

@ -11,4 +11,5 @@ BasicBeam(
energy_regen: 0,
energy_cost: 1,
energy_drain: 350,
orientation_behavior: Normal,
)

View File

@ -11,4 +11,5 @@ BasicBeam(
energy_regen: 25,
energy_cost: 50,
energy_drain: 0,
orientation_behavior: Normal,
)

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: AxeSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 500,
power: 1.8,
poise_strength: 1.00,
speed: 1.0
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Bow,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 0.7,
poise_strength: 0.8,
speed: 0.3
),
)),
)
),
quality: Moderate,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: StaffSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 0.7,
poise_strength: 0.8,
speed: 0.5
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Spear,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 0.7,
poise_strength: 0.8,
speed: 1.0
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Bow,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 0.3,
poise_strength: 0.8,
speed: 0.7
),
)),
)
),
quality: Moderate,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: StaffSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 0.3,
poise_strength: 0.8,
speed: 0.8
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Spear,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 0.3,
poise_strength: 0.8,
speed: 1.0
),
)),
)
),
quality: Low,

View File

@ -1,18 +1,16 @@
ItemDef(
name: "Adlet Bow",
description: "Strips of leather are wrapped around the handle.",
kind: Tool(
(
kind: Tool((
kind: Bow,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.6,
poise_strength: 0.8,
speed: 0.3
),
)
),
)),
)),
quality: Moderate,
tags: [],
)

View File

@ -1,18 +1,16 @@
ItemDef(
name: "Gnoll Staff",
description: "eekum bokum",
kind: Tool(
(
kind: Tool((
kind: StaffSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.8,
poise_strength: 0.8,
speed: 0.6
),
)
),
)),
)),
quality: Low,
tags: [],
)

View File

@ -1,18 +1,16 @@
ItemDef(
name: "Wooden Spear",
description: "Testing",
kind: Tool(
(
kind: Tool((
kind: Spear,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.4,
poise_strength: 0.8,
speed: 1.0
),
)
),
)),
)),
quality: Low,
tags: [],
)

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Bow,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.1,
poise_strength: 0.8,
speed: 0.5
),
)),
)
),
quality: Moderate,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: StaffSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.7,
poise_strength: 0.8,
speed: 0.7
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Spear,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.7,
poise_strength: 0.8,
speed: 1.0
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Bow,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.1,
poise_strength: 0.8,
speed: 0.3
),
)),
)
),
quality: Moderate,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: StaffSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.1,
poise_strength: 0.8,
speed: 0.8
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Spear,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 1.1,
poise_strength: 0.8,
speed: 1.0
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: HammerSimple,
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 0,
power: 2.0,
poise_strength: 1.00,
speed: 1.0
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Unique(TidalClaws),
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 500,
power: 1.00,
poise_strength: 1.00,
speed: 1.0,
),
)),
)
),
quality: Low,

View File

@ -5,12 +5,12 @@ ItemDef(
(
kind: Unique(WendigoMagic),
hands: Two,
stats: (
stats: Direct((
equip_time_millis: 500,
power: 1.00,
poise_strength: 1.00,
speed: 1.0,
),
)),
)
),
quality: Low,

View File

@ -163,20 +163,16 @@ impl CharacterBehavior for Data {
};
// Gets offsets
let body_offsets = match data.body {
Body::Humanoid(_) => {
Vec3::new(
data.body.radius() + 2.0 * data.inputs.look_dir.x,
data.body.radius() + 2.0 * data.inputs.look_dir.y,
data.body.eye_height(),
) * 0.55
},
_ => {
Vec3::new(
data.body.radius() * 3.0 * data.inputs.look_dir.x,
data.body.radius() * 3.0 * data.inputs.look_dir.y,
data.body.eye_height(),
) * 0.55
},
Body::Humanoid(_) => Vec3::new(
(data.body.radius() + 2.0) * data.inputs.look_dir.x,
(data.body.radius() + 2.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.55,
),
_ => Vec3::new(
(data.body.radius() + 3.0) * data.inputs.look_dir.x,
(data.body.radius() + 3.0) * data.inputs.look_dir.y,
data.body.eye_height() * 0.55,
),
};
let pos = Pos(data.pos.0 + body_offsets);
// Create beam segment

View File

@ -1219,7 +1219,7 @@ impl QuadrupedSmallLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.left_front.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.left_front.lateral.0, true);
(lateral, Vec3::from(spec.left_front.offset))
}
@ -1251,7 +1251,7 @@ impl QuadrupedSmallLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.left_back.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.left_back.lateral.0, true);
(lateral, Vec3::from(spec.left_back.offset))
}
@ -1511,7 +1511,7 @@ impl QuadrupedMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.leg_fl.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.leg_fl.lateral.0, true);
(lateral, Vec3::from(spec.leg_fl.offset))
}
@ -1543,7 +1543,7 @@ impl QuadrupedMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.leg_bl.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.leg_bl.lateral.0, true);
(lateral, Vec3::from(spec.leg_bl.offset))
}
@ -1575,7 +1575,7 @@ impl QuadrupedMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.foot_fl.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.foot_fl.lateral.0, true);
(lateral, Vec3::from(spec.foot_fl.offset))
}
@ -1607,7 +1607,7 @@ impl QuadrupedMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.foot_bl.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.foot_bl.lateral.0, true);
(lateral, Vec3::from(spec.foot_bl.offset))
}
@ -1771,7 +1771,7 @@ impl BirdMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.wing_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.wing_l.lateral.0, true);
(lateral, Vec3::from(spec.wing_l.offset))
}
@ -1803,7 +1803,7 @@ impl BirdMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.foot_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.foot_l.lateral.0, true);
(lateral, Vec3::from(spec.foot_l.offset))
}
@ -2052,7 +2052,7 @@ impl TheropodLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.hand_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.hand_l.lateral.0, true);
(lateral, Vec3::from(spec.hand_l.offset))
}
@ -2084,7 +2084,7 @@ impl TheropodLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.leg_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.leg_l.lateral.0, true);
(lateral, Vec3::from(spec.leg_l.offset))
}
@ -2116,7 +2116,7 @@ impl TheropodLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.foot_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.foot_l.lateral.0, true);
(lateral, Vec3::from(spec.foot_l.offset))
}
@ -2310,7 +2310,7 @@ impl FishMediumLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.fin_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.fin_l.lateral.0, true);
(lateral, Vec3::from(spec.fin_l.offset))
}
@ -2445,7 +2445,7 @@ impl FishSmallLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.fin_l.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.fin_l.lateral.0, true);
(lateral, Vec3::from(spec.fin_l.offset))
}
@ -2536,7 +2536,7 @@ make_vox_spec!(
}),
tool.and_then(|tool| tool.active.as_ref()).map(|tool| {
spec.weapon.read().0.mesh_main(
tool,
&tool.name,
false,
)
}),
@ -2662,7 +2662,7 @@ impl BipedSmallArmorHandSpec {
};
let hand_segment = if flipped {
graceful_load_segment_flipped(&spec.left.vox_spec.0)
graceful_load_segment_flipped(&spec.left.vox_spec.0, true)
} else {
graceful_load_segment(&spec.right.vox_spec.0)
};
@ -2694,7 +2694,7 @@ impl BipedSmallArmorFootSpec {
};
let foot_segment = if flipped {
graceful_load_segment_flipped(&spec.left.vox_spec.0)
graceful_load_segment_flipped(&spec.left.vox_spec.0, true)
} else {
graceful_load_segment(&spec.right.vox_spec.0)
};
@ -2723,7 +2723,7 @@ impl BipedSmallWeaponSpec {
};
let tool_kind_segment = if flipped {
graceful_load_segment_flipped(&spec.vox_spec.0)
graceful_load_segment_flipped(&spec.vox_spec.0, true)
} else {
graceful_load_segment(&spec.vox_spec.0)
};
@ -3244,7 +3244,7 @@ make_vox_spec!(
)),
tool.and_then(|tool| tool.active.as_ref()).map(|tool| {
spec.weapon.read().0.mesh_main(
tool,
&tool.name,
false,
)
}),
@ -3526,7 +3526,7 @@ impl BipedLargeWeaponSpec {
};
let tool_kind_segment = if flipped {
graceful_load_segment_flipped(&spec.vox_spec.0)
graceful_load_segment_flipped(&spec.vox_spec.0, true)
} else {
graceful_load_segment(&spec.vox_spec.0)
};
@ -4043,7 +4043,7 @@ impl QuadrupedLowLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.front_left.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.front_left.lateral.0, true);
(lateral, Vec3::from(spec.front_left.offset))
}
@ -4075,7 +4075,7 @@ impl QuadrupedLowLateralSpec {
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
},
};
let lateral = graceful_load_segment_flipped(&spec.back_left.lateral.0);
let lateral = graceful_load_segment_flipped(&spec.back_left.lateral.0, true);
(lateral, Vec3::from(spec.back_left.offset))
}

View File

@ -2548,7 +2548,7 @@ impl FigureMgr {
tick,
player_camera_mode,
player_character_state,
scene_data.thread_pool,
scene_data.runtime,
);
let state = self

View File

@ -399,7 +399,7 @@ impl ParticleMgr {
.join()
.filter(|(_, _, b)| b.creation.map_or(true, |c| (c + dt as f64) >= time))
{
//
//
let range = beam.properties.speed * beam.properties.duration.as_secs_f32();
if beam
.properties
@ -410,65 +410,64 @@ impl ParticleMgr {
// Emit a light when using healing
lights.push(Light::new(pos.0, Rgb::new(0.1, 1.0, 0.15), 1.0));
for i in 0..self.scheduler.heartbeats(Duration::from_millis(1)) {
self.particles.push(Particle::new_beam(
self.particles.push(Particle::new_directed(
beam.properties.duration,
time + i as f64 / 1000.0,
ParticleMode::HealingBeam,
pos.0,
pos.0 + *ori.look_dir() * range,
));
//
if let CharacterState::BasicBeam(b) = character_state {
let particle_ori = b.particle_ori.unwrap_or_else(|| ori.look_vec());
if b.stage_section == StageSection::Cast {
if b.static_data.base_hps > 0.0 {
// Emit a light when using healing
lights.push(Light::new(pos.0 + b.offset, Rgb::new(0.1, 1.0, 0.15), 1.0));
for i in 0..self.scheduler.heartbeats(Duration::from_millis(1)) {
self.particles.push(Particle::new_directed(
b.static_data.beam_duration,
time + i as f64 / 1000.0,
ParticleMode::HealingBeam,
pos.0 + particle_ori * 0.5 + b.offset,
pos.0 + particle_ori * b.static_data.range + b.offset,
));
}
} else {
let mut rng = thread_rng();
let (from, to) = (Vec3::<f32>::unit_z(), particle_ori);
let m = Mat3::<f32>::rotation_from_to_3d(from, to);
// Emit a light when using flames
lights.push(Light::new(
pos.0 + b.offset,
Rgb::new(1.0, 0.25, 0.05).map(|e| e * rng.gen_range(0.8..1.2)),
2.0,
));
self.particles.resize_with(
self.particles.len()
+ 2 * usize::from(
self.scheduler.heartbeats(Duration::from_millis(1)),
),
|| {
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_directed(
b.static_data.beam_duration,
time,
ParticleMode::FlameThrower,
pos.0 + random_ori * 0.5 + b.offset,
pos.0 + random_ori * b.static_data.range + b.offset,
)
},
);
}
//
/*
if let CharacterState::BasicBeam(b) = character_state {
if b.stage_section == StageSection::Cast {
if b.static_data.base_hps > 0.0 {//
// Emit a light when using healing
lights.push(Light::new(pos.0 + b.offset, Rgb::new(0.1, 1.0, 0.15), 1.0));
for i in 0..self.scheduler.heartbeats(Duration::from_millis(1)) {
self.particles.push(Particle::new_directed(
b.static_data.beam_duration,
time + i as f64 / 1000.0,
ParticleMode::HealingBeam,
pos.0 + particle_ori * 0.5 + b.offset,
pos.0 + particle_ori * b.static_data.range + b.offset,
));
}
} else {
let mut rng = thread_rng();
let (from, to) = (Vec3::<f32>::unit_z(), particle_ori);
let m = Mat3::<f32>::rotation_from_to_3d(from, to);
// Emit a light when using flames
lights.push(Light::new(
pos.0 + b.offset,
Rgb::new(1.0, 0.25, 0.05).map(|e| e * rng.gen_range(0.8..1.2)),
2.0,
));
self.particles.resize_with(
self.particles.len()
+ 2 * usize::from(
self.scheduler.heartbeats(Duration::from_millis(1)),
),
|| {
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_directed(
b.static_data.beam_duration,
time,
ParticleMode::FlameThrower,
pos.0 + random_ori * 0.5 + b.offset,
pos.0 + random_ori * b.static_data.range + b.offset,
)
},
);
}
*/
}
} else {
let mut rng = thread_rng();
@ -484,16 +483,16 @@ impl ParticleMgr {
self.particles.len()
+ 2 * usize::from(self.scheduler.heartbeats(Duration::from_millis(1))),
|| {
let phi: f32 = rng.gen_range(0.0..beam.properties.angle.to_radians());
let phi: f32 = rng.gen_range(0.0..beam.properties.angle);
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(
Particle::new_directed(
beam.properties.duration,
time,
ParticleMode::FlameThrower,
pos.0 + random_ori,
pos.0, /* + random_ori */
pos.0 + random_ori * range,
)
},

View File

@ -619,7 +619,7 @@ impl Floor {
)
.with_loot_drop(comp::Item::new_from_asset_expect(chosen))
.with_main_tool(comp::Item::new_from_asset_expect(
match dynamic_rng.gen_range(0..3) {
match dynamic_rng.gen_range(0..5) {
0 => {
"common.items.npc_weapons.biped_small.gnarling.\
adlet_bow"
@ -648,7 +648,7 @@ impl Floor {
)
.with_loot_drop(comp::Item::new_from_asset_expect(chosen))
.with_main_tool(comp::Item::new_from_asset_expect(
match dynamic_rng.gen_range(0..3) {
match dynamic_rng.gen_range(0..5) {
0 => "common.items.npc_weapons.biped_small.adlet.adlet_bow",
1 => {
"common.items.npc_weapons.biped_small.adlet.gnoll_staff"
@ -673,7 +673,7 @@ impl Floor {
)
.with_loot_drop(comp::Item::new_from_asset_expect(chosen))
.with_main_tool(comp::Item::new_from_asset_expect(
match dynamic_rng.gen_range(0..3) {
match dynamic_rng.gen_range(0..5) {
0 => {
"common.items.npc_weapons.biped_small.sahagin.adlet_bow"
},
@ -701,7 +701,7 @@ impl Floor {
)
.with_loot_drop(comp::Item::new_from_asset_expect(chosen))
.with_main_tool(comp::Item::new_from_asset_expect(
match dynamic_rng.gen_range(0..3) {
match dynamic_rng.gen_range(0..5) {
0 => {
"common.items.npc_weapons.biped_small.haniwa.adlet_bow"
},
@ -729,7 +729,7 @@ impl Floor {
)
.with_loot_drop(comp::Item::new_from_asset_expect(chosen))
.with_main_tool(comp::Item::new_from_asset_expect(
match dynamic_rng.gen_range(0..3) {
match dynamic_rng.gen_range(0..5) {
0 => {
"common.items.npc_weapons.biped_small.myrmidon.\
adlet_bow"