From db3bc1b9bbdae6fddd26f7cea1f97af76da4f7aa Mon Sep 17 00:00:00 2001 From: Sarra Date: Sat, 6 Mar 2021 07:31:18 -0500 Subject: [PATCH] added a white firework --- .../common/items/utility/firework_white.ron | 9 +++++ assets/common/recipe_book.ron | 10 +++++ assets/voxygen/item_image_manifest.ron | 4 ++ assets/voxygen/shaders/particle-vert.glsl | 38 ++++++++++++------- assets/voxygen/voxel/object_manifest.ron | 10 +++++ .../weapon/projectile/fireworks_white-0.vox | 3 ++ common/src/comp/body/object.rs | 21 +++++----- common/src/comp/inventory/item/mod.rs | 1 + server/src/events/inventory_manip.rs | 11 ++++++ voxygen/src/render/pipelines/particle.rs | 27 ++++++------- voxygen/src/scene/mod.rs | 1 + voxygen/src/scene/particle.rs | 2 + 12 files changed, 102 insertions(+), 35 deletions(-) create mode 100644 assets/common/items/utility/firework_white.ron create mode 100644 assets/voxygen/voxel/weapon/projectile/fireworks_white-0.vox diff --git a/assets/common/items/utility/firework_white.ron b/assets/common/items/utility/firework_white.ron new file mode 100644 index 0000000000..32ce33db71 --- /dev/null +++ b/assets/common/items/utility/firework_white.ron @@ -0,0 +1,9 @@ +ItemDef( + name: "Firework White", + description: "Twinkles like the stars", + kind: Throwable( + kind: Firework(White), + ), + quality: Moderate, + tags: [], +) diff --git a/assets/common/recipe_book.ron b/assets/common/recipe_book.ron index bed5fe2810..abe8561486 100644 --- a/assets/common/recipe_book.ron +++ b/assets/common/recipe_book.ron @@ -100,6 +100,16 @@ (Item("common.items.crafting_tools.mortar_pestle"), 0), ], ), + "firework_white": ( + ("common.items.utility.firework_white", 1), + [ + (Item("common.items.crafting_ing.twigs"), 1), + (Item("common.items.crafting_ing.stones"), 1), + (Item("common.items.food.coconut"), 1), + (Item("common.items.ore.veloritefrag"), 1), + (Item("common.items.crafting_tools.mortar_pestle"), 0), + ], + ), "firework_yellow": ( ("common.items.utility.firework_yellow", 1), [ diff --git a/assets/voxygen/item_image_manifest.ron b/assets/voxygen/item_image_manifest.ron index b89e10c421..63b08fcda2 100644 --- a/assets/voxygen/item_image_manifest.ron +++ b/assets/voxygen/item_image_manifest.ron @@ -1796,6 +1796,10 @@ "voxel.weapon.projectile.fireworks_red-0", (0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8, ), + Throwable(Firework(White)): VoxTrans( + "voxel.weapon.projectile.fireworks_white-0", + (0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8, + ), Throwable(Firework(Yellow)): VoxTrans( "voxel.weapon.projectile.fireworks_yellow-0", (0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8, diff --git a/assets/voxygen/shaders/particle-vert.glsl b/assets/voxygen/shaders/particle-vert.glsl index 7bf80b19c5..7bade4f998 100644 --- a/assets/voxygen/shaders/particle-vert.glsl +++ b/assets/voxygen/shaders/particle-vert.glsl @@ -46,19 +46,20 @@ const int FIREWORK_BLUE = 4; const int FIREWORK_GREEN = 5; const int FIREWORK_PURPLE = 6; const int FIREWORK_RED = 7; -const int FIREWORK_YELLOW = 8; -const int LEAF = 9; -const int FIREFLY = 10; -const int BEE = 11; -const int GROUND_SHOCKWAVE = 12; -const int HEALING_BEAM = 13; -const int ENERGY_NATURE = 14; -const int FLAMETHROWER = 15; -const int FIRE_SHOCKWAVE = 16; -const int FIRE_BOWL = 17; -const int SNOW = 18; -const int EXPLOSION = 19; -const int ICE = 20; +const int FIREWORK_WHITE = 8; +const int FIREWORK_YELLOW = 9; +const int LEAF = 10; +const int FIREFLY = 11; +const int BEE = 12; +const int GROUND_SHOCKWAVE = 13; +const int HEALING_BEAM = 14; +const int ENERGY_NATURE = 15; +const int FLAMETHROWER = 16; +const int FIRE_SHOCKWAVE = 17; +const int FIRE_BOWL = 18; +const int SNOW = 19; +const int EXPLOSION = 20; +const int ICE = 21; // meters per second squared (acceleration) const float earth_gravity = 9.807; @@ -257,6 +258,17 @@ void main() { vec4(vec3(2, 0, 0), 1), identity() ); + } else if (inst_mode == FIREWORK_WHITE) { + f_reflect = 0.0; // Fire doesn't reflect light, it emits it + attr = Attr( + linear_motion( + vec3(0), + normalize(vec3(rand1, rand2, rand3)) * 40.0 + grav_vel(earth_gravity) + ), + vec3(3.0 + rand0), + vec4(vec3(2, 2, 2), 1), + identity() + ); } else if (inst_mode == FIREWORK_YELLOW) { f_reflect = 0.0; // Fire doesn't reflect light, it emits it attr = Attr( diff --git a/assets/voxygen/voxel/object_manifest.ron b/assets/voxygen/voxel/object_manifest.ron index 4e11fead93..1c7d9175e6 100644 --- a/assets/voxygen/voxel/object_manifest.ron +++ b/assets/voxygen/voxel/object_manifest.ron @@ -59,6 +59,16 @@ central: ("armor.empty"), ) ), + FireworkWhite: ( + bone0: ( + offset: (0.0, 0.0, 0.0), + central: ("weapon.projectile.fireworks_white-0"), + ), + bone1: ( + offset: (0.0, 0.0, 0.0), + central: ("armor.empty"), + ) + ), FireworkYellow: ( bone0: ( offset: (0.0, 0.0, 0.0), diff --git a/assets/voxygen/voxel/weapon/projectile/fireworks_white-0.vox b/assets/voxygen/voxel/weapon/projectile/fireworks_white-0.vox new file mode 100644 index 0000000000..6c1befd892 --- /dev/null +++ b/assets/voxygen/voxel/weapon/projectile/fireworks_white-0.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ddd810995dc52a60b91d5eac86e118254c6573085af73cb83b9dc345c69caeb6 +size 1260 diff --git a/common/src/comp/body/object.rs b/common/src/comp/body/object.rs index af4dc75a1d..f4addede0b 100644 --- a/common/src/comp/body/object.rs +++ b/common/src/comp/body/object.rs @@ -65,14 +65,15 @@ make_case_elim!( FireworkGreen = 55, FireworkPurple = 56, FireworkRed = 57, - FireworkYellow = 58, - MultiArrow = 59, - BoltNature = 60, - MeatDrop = 61, - Steak = 62, - Crossbow = 63, - ArrowTurret = 64, - Coins = 65, + FireworkWhite = 58, + FireworkYellow = 59, + MultiArrow = 60, + BoltNature = 61, + MeatDrop = 62, + Steak = 63, + Crossbow = 64, + ArrowTurret = 65, + Coins = 66, } ); @@ -83,7 +84,7 @@ impl Body { } } -pub const ALL_OBJECTS: [Body; 66] = [ +pub const ALL_OBJECTS: [Body; 67] = [ Body::Arrow, Body::Bomb, Body::Scarecrow, @@ -142,6 +143,7 @@ pub const ALL_OBJECTS: [Body; 66] = [ Body::FireworkGreen, Body::FireworkPurple, Body::FireworkRed, + Body::FireworkWhite, Body::FireworkYellow, Body::MultiArrow, Body::BoltNature, @@ -217,6 +219,7 @@ impl Body { Body::FireworkGreen => "firework_green", Body::FireworkPurple => "firework_purple", Body::FireworkRed => "firework_red", + Body::FireworkWhite => "firework_white", Body::FireworkYellow => "firework_yellow", Body::MultiArrow => "multi_arrow", Body::BoltNature => "bolt_nature", diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index 69310a18b1..f76b099ec7 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -42,6 +42,7 @@ pub enum Reagent { Green, Purple, Red, + White, Yellow, } diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index c1c9f8f450..8ef548c367 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -644,7 +644,18 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv let mut new_entity = state .create_object(Default::default(), match kind { item::Throwable::Bomb => comp::object::Body::Bomb, +<<<<<<< HEAD item::Throwable::Firework(reagent) => comp::object::Body::for_firework(reagent), +======= + item::Throwable::Firework(reagent) => match reagent { + item::Reagent::Blue => comp::object::Body::FireworkBlue, + item::Reagent::Green => comp::object::Body::FireworkGreen, + item::Reagent::Purple => comp::object::Body::FireworkPurple, + item::Reagent::Red => comp::object::Body::FireworkRed, + item::Reagent::White => comp::object::Body::FireworkWhite, + item::Reagent::Yellow => comp::object::Body::FireworkYellow, + }, +>>>>>>> added a white firework item::Throwable::TrainingDummy => comp::object::Body::TrainingDummy, }) .with(comp::Pos(pos.0 + Vec3::unit_z() * 0.25)) diff --git a/voxygen/src/render/pipelines/particle.rs b/voxygen/src/render/pipelines/particle.rs index d5e2cee267..6100ae60df 100644 --- a/voxygen/src/render/pipelines/particle.rs +++ b/voxygen/src/render/pipelines/particle.rs @@ -104,19 +104,20 @@ pub enum ParticleMode { FireworkGreen = 5, FireworkPurple = 6, FireworkRed = 7, - FireworkYellow = 8, - Leaf = 9, - Firefly = 10, - Bee = 11, - GroundShockwave = 12, - HealingBeam = 13, - EnergyNature = 14, - FlameThrower = 15, - FireShockwave = 16, - FireBowl = 17, - Snow = 18, - Explosion = 19, - Ice = 20, + FireworkWhite = 8, + FireworkYellow = 9, + Leaf = 10, + Firefly = 11, + Bee = 12, + GroundShockwave = 13, + HealingBeam = 14, + EnergyNature = 15, + FlameThrower = 16, + FireShockwave = 17, + FireBowl = 18, + Snow = 19, + Explosion = 20, + Ice = 21, } impl ParticleMode { diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index 5e90a7c02d..43d0c9dd4e 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -423,6 +423,7 @@ impl Scene { Rgb::new(1.0, 0.0, 0.0) } }, + Some(Reagent::White) => Rgb::new(1.0, 1.0, 1.0), Some(Reagent::Yellow) => Rgb::new(1.0, 1.0, 0.0), None => Rgb::new(1.0, 0.5, 0.0), }, diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index efd3d3de8e..8411ecdbc1 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -128,6 +128,7 @@ impl ParticleMgr { Some(Reagent::Green) => ParticleMode::FireworkGreen, Some(Reagent::Purple) => ParticleMode::FireworkPurple, Some(Reagent::Red) => ParticleMode::FireworkRed, + Some(Reagent::White) => ParticleMode::FireworkWhite, Some(Reagent::Yellow) => ParticleMode::FireworkYellow, None => ParticleMode::Shrapnel, }, @@ -217,6 +218,7 @@ impl ParticleMgr { | object::Body::FireworkGreen | object::Body::FireworkPurple | object::Body::FireworkRed + | object::Body::FireworkWhite | object::Body::FireworkYellow, ) => self.maintain_bomb_particles(scene_data, pos), _ => {},