added a white firework

This commit is contained in:
Sarra 2021-03-06 07:31:18 -05:00
parent 6cfb4bd74d
commit db3bc1b9bb
12 changed files with 102 additions and 35 deletions

View File

@ -0,0 +1,9 @@
ItemDef(
name: "Firework White",
description: "Twinkles like the stars",
kind: Throwable(
kind: Firework(White),
),
quality: Moderate,
tags: [],
)

View File

@ -100,6 +100,16 @@
(Item("common.items.crafting_tools.mortar_pestle"), 0), (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": ( "firework_yellow": (
("common.items.utility.firework_yellow", 1), ("common.items.utility.firework_yellow", 1),
[ [

View File

@ -1796,6 +1796,10 @@
"voxel.weapon.projectile.fireworks_red-0", "voxel.weapon.projectile.fireworks_red-0",
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8, (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( Throwable(Firework(Yellow)): VoxTrans(
"voxel.weapon.projectile.fireworks_yellow-0", "voxel.weapon.projectile.fireworks_yellow-0",
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8, (0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8,

View File

@ -46,19 +46,20 @@ const int FIREWORK_BLUE = 4;
const int FIREWORK_GREEN = 5; const int FIREWORK_GREEN = 5;
const int FIREWORK_PURPLE = 6; const int FIREWORK_PURPLE = 6;
const int FIREWORK_RED = 7; const int FIREWORK_RED = 7;
const int FIREWORK_YELLOW = 8; const int FIREWORK_WHITE = 8;
const int LEAF = 9; const int FIREWORK_YELLOW = 9;
const int FIREFLY = 10; const int LEAF = 10;
const int BEE = 11; const int FIREFLY = 11;
const int GROUND_SHOCKWAVE = 12; const int BEE = 12;
const int HEALING_BEAM = 13; const int GROUND_SHOCKWAVE = 13;
const int ENERGY_NATURE = 14; const int HEALING_BEAM = 14;
const int FLAMETHROWER = 15; const int ENERGY_NATURE = 15;
const int FIRE_SHOCKWAVE = 16; const int FLAMETHROWER = 16;
const int FIRE_BOWL = 17; const int FIRE_SHOCKWAVE = 17;
const int SNOW = 18; const int FIRE_BOWL = 18;
const int EXPLOSION = 19; const int SNOW = 19;
const int ICE = 20; const int EXPLOSION = 20;
const int ICE = 21;
// meters per second squared (acceleration) // meters per second squared (acceleration)
const float earth_gravity = 9.807; const float earth_gravity = 9.807;
@ -257,6 +258,17 @@ void main() {
vec4(vec3(2, 0, 0), 1), vec4(vec3(2, 0, 0), 1),
identity() 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) { } else if (inst_mode == FIREWORK_YELLOW) {
f_reflect = 0.0; // Fire doesn't reflect light, it emits it f_reflect = 0.0; // Fire doesn't reflect light, it emits it
attr = Attr( attr = Attr(

View File

@ -59,6 +59,16 @@
central: ("armor.empty"), 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: ( FireworkYellow: (
bone0: ( bone0: (
offset: (0.0, 0.0, 0.0), offset: (0.0, 0.0, 0.0),

BIN
assets/voxygen/voxel/weapon/projectile/fireworks_white-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -65,14 +65,15 @@ make_case_elim!(
FireworkGreen = 55, FireworkGreen = 55,
FireworkPurple = 56, FireworkPurple = 56,
FireworkRed = 57, FireworkRed = 57,
FireworkYellow = 58, FireworkWhite = 58,
MultiArrow = 59, FireworkYellow = 59,
BoltNature = 60, MultiArrow = 60,
MeatDrop = 61, BoltNature = 61,
Steak = 62, MeatDrop = 62,
Crossbow = 63, Steak = 63,
ArrowTurret = 64, Crossbow = 64,
Coins = 65, 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::Arrow,
Body::Bomb, Body::Bomb,
Body::Scarecrow, Body::Scarecrow,
@ -142,6 +143,7 @@ pub const ALL_OBJECTS: [Body; 66] = [
Body::FireworkGreen, Body::FireworkGreen,
Body::FireworkPurple, Body::FireworkPurple,
Body::FireworkRed, Body::FireworkRed,
Body::FireworkWhite,
Body::FireworkYellow, Body::FireworkYellow,
Body::MultiArrow, Body::MultiArrow,
Body::BoltNature, Body::BoltNature,
@ -217,6 +219,7 @@ impl Body {
Body::FireworkGreen => "firework_green", Body::FireworkGreen => "firework_green",
Body::FireworkPurple => "firework_purple", Body::FireworkPurple => "firework_purple",
Body::FireworkRed => "firework_red", Body::FireworkRed => "firework_red",
Body::FireworkWhite => "firework_white",
Body::FireworkYellow => "firework_yellow", Body::FireworkYellow => "firework_yellow",
Body::MultiArrow => "multi_arrow", Body::MultiArrow => "multi_arrow",
Body::BoltNature => "bolt_nature", Body::BoltNature => "bolt_nature",

View File

@ -42,6 +42,7 @@ pub enum Reagent {
Green, Green,
Purple, Purple,
Red, Red,
White,
Yellow, Yellow,
} }

View File

@ -644,7 +644,18 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
let mut new_entity = state let mut new_entity = state
.create_object(Default::default(), match kind { .create_object(Default::default(), match kind {
item::Throwable::Bomb => comp::object::Body::Bomb, item::Throwable::Bomb => comp::object::Body::Bomb,
<<<<<<< HEAD
item::Throwable::Firework(reagent) => comp::object::Body::for_firework(reagent), 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, item::Throwable::TrainingDummy => comp::object::Body::TrainingDummy,
}) })
.with(comp::Pos(pos.0 + Vec3::unit_z() * 0.25)) .with(comp::Pos(pos.0 + Vec3::unit_z() * 0.25))

View File

@ -104,19 +104,20 @@ pub enum ParticleMode {
FireworkGreen = 5, FireworkGreen = 5,
FireworkPurple = 6, FireworkPurple = 6,
FireworkRed = 7, FireworkRed = 7,
FireworkYellow = 8, FireworkWhite = 8,
Leaf = 9, FireworkYellow = 9,
Firefly = 10, Leaf = 10,
Bee = 11, Firefly = 11,
GroundShockwave = 12, Bee = 12,
HealingBeam = 13, GroundShockwave = 13,
EnergyNature = 14, HealingBeam = 14,
FlameThrower = 15, EnergyNature = 15,
FireShockwave = 16, FlameThrower = 16,
FireBowl = 17, FireShockwave = 17,
Snow = 18, FireBowl = 18,
Explosion = 19, Snow = 19,
Ice = 20, Explosion = 20,
Ice = 21,
} }
impl ParticleMode { impl ParticleMode {

View File

@ -423,6 +423,7 @@ impl Scene {
Rgb::new(1.0, 0.0, 0.0) 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), Some(Reagent::Yellow) => Rgb::new(1.0, 1.0, 0.0),
None => Rgb::new(1.0, 0.5, 0.0), None => Rgb::new(1.0, 0.5, 0.0),
}, },

View File

@ -128,6 +128,7 @@ impl ParticleMgr {
Some(Reagent::Green) => ParticleMode::FireworkGreen, Some(Reagent::Green) => ParticleMode::FireworkGreen,
Some(Reagent::Purple) => ParticleMode::FireworkPurple, Some(Reagent::Purple) => ParticleMode::FireworkPurple,
Some(Reagent::Red) => ParticleMode::FireworkRed, Some(Reagent::Red) => ParticleMode::FireworkRed,
Some(Reagent::White) => ParticleMode::FireworkWhite,
Some(Reagent::Yellow) => ParticleMode::FireworkYellow, Some(Reagent::Yellow) => ParticleMode::FireworkYellow,
None => ParticleMode::Shrapnel, None => ParticleMode::Shrapnel,
}, },
@ -217,6 +218,7 @@ impl ParticleMgr {
| object::Body::FireworkGreen | object::Body::FireworkGreen
| object::Body::FireworkPurple | object::Body::FireworkPurple
| object::Body::FireworkRed | object::Body::FireworkRed
| object::Body::FireworkWhite
| object::Body::FireworkYellow, | object::Body::FireworkYellow,
) => self.maintain_bomb_particles(scene_data, pos), ) => self.maintain_bomb_particles(scene_data, pos),
_ => {}, _ => {},