mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add firework hues
This commit is contained in:
parent
9aab296264
commit
6789b7ae27
@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Add detection of entities under the cursor
|
- Add detection of entities under the cursor
|
||||||
- Functional group-system with exp-sharing and disabled damage to group members
|
- Functional group-system with exp-sharing and disabled damage to group members
|
||||||
- Some Campfire, fireball & bomb; particle, light & sound effects.
|
- Some Campfire, fireball & bomb; particle, light & sound effects.
|
||||||
|
- Added firework recipe
|
||||||
- Added setting to change resolution
|
- Added setting to change resolution
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
Item(
|
|
||||||
name: "Firework",
|
|
||||||
description: "Label: Outdoor use only!\n\n<Right-Click to use>",
|
|
||||||
kind: Throwable(
|
|
||||||
kind: Firework,
|
|
||||||
),
|
|
||||||
)
|
|
7
assets/common/items/utility/firework_blue.ron
Normal file
7
assets/common/items/utility/firework_blue.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Firework Blue",
|
||||||
|
description: "Recommended clearance: 42 chonks\n\n<Right-Click to use>",
|
||||||
|
kind: Throwable(
|
||||||
|
kind: Firework(Blue),
|
||||||
|
),
|
||||||
|
)
|
7
assets/common/items/utility/firework_green.ron
Normal file
7
assets/common/items/utility/firework_green.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Firework Green",
|
||||||
|
description: "Watch out for trees.\n\n<Right-Click to use>",
|
||||||
|
kind: Throwable(
|
||||||
|
kind: Firework(Green),
|
||||||
|
),
|
||||||
|
)
|
7
assets/common/items/utility/firework_purple.ron
Normal file
7
assets/common/items/utility/firework_purple.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Firework Purple",
|
||||||
|
description: "Cult favourite.\n\n<Right-Click to use>",
|
||||||
|
kind: Throwable(
|
||||||
|
kind: Firework(Purple),
|
||||||
|
),
|
||||||
|
)
|
7
assets/common/items/utility/firework_red.ron
Normal file
7
assets/common/items/utility/firework_red.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Firework Red",
|
||||||
|
description: "Humans sometimes use these\nas a flare in a pinch.\n\n<Right-Click to use>",
|
||||||
|
kind: Throwable(
|
||||||
|
kind: Firework(Red),
|
||||||
|
),
|
||||||
|
)
|
7
assets/common/items/utility/firework_yellow.ron
Normal file
7
assets/common/items/utility/firework_yellow.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Firework Yellow",
|
||||||
|
description: "The Great Dr. passed away after\ntesting this contraption indoors.\n\n<Right-Click to use>",
|
||||||
|
kind: Throwable(
|
||||||
|
kind: Firework(Yellow),
|
||||||
|
),
|
||||||
|
)
|
@ -9,7 +9,6 @@
|
|||||||
(0.4, "common.items.ore.velorite"),
|
(0.4, "common.items.ore.velorite"),
|
||||||
(0.6, "common.items.ore.veloritefrag"),
|
(0.6, "common.items.ore.veloritefrag"),
|
||||||
(0.1, "common.items.consumable.potion_minor"),
|
(0.1, "common.items.consumable.potion_minor"),
|
||||||
(1.0, "common.items.utility.firework"),
|
|
||||||
(0.01, "common.items.utility.collar"),
|
(0.01, "common.items.utility.collar"),
|
||||||
(0.01, "common.items.utility.bomb_pile"),
|
(0.01, "common.items.utility.bomb_pile"),
|
||||||
(0.1, "common.items.utility.bomb"),
|
(0.1, "common.items.utility.bomb"),
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
"potion_m": (("common.items.consumable.potion_med", 1), [("common.items.consumable.potion_minor", 2), ("common.items.ore.veloritefrag", 4)]),
|
"potion_m": (("common.items.consumable.potion_med", 1), [("common.items.consumable.potion_minor", 2), ("common.items.ore.veloritefrag", 4)]),
|
||||||
"collar_basic": (("common.items.utility.collar", 1), [("common.items.crafting_ing.leather_scraps", 5), ("common.items.crafting_ing.shiny_gem", 1)]),
|
"collar_basic": (("common.items.utility.collar", 1), [("common.items.crafting_ing.leather_scraps", 5), ("common.items.crafting_ing.shiny_gem", 1)]),
|
||||||
"bomb_coconut": (("common.items.utility.bomb", 1), [("common.items.crafting_ing.stones", 10), ("common.items.food.coconut", 2), ("common.items.ore.veloritefrag", 2), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
"bomb_coconut": (("common.items.utility.bomb", 1), [("common.items.crafting_ing.stones", 10), ("common.items.food.coconut", 2), ("common.items.ore.veloritefrag", 2), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
"firework": (("common.items.utility.firework", 1), [("common.items.crafting_ing.twigs", 1), ("common.items.crafting_ing.stones", 1), ("common.items.food.coconut", 2), ("common.items.ore.veloritefrag", 10), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
"firework_blue": (("common.items.utility.firework_blue", 1), [("common.items.crafting_ing.twigs", 1), ("common.items.crafting_ing.stones", 1), ("common.items.food.coconut", 1), ("common.items.ore.veloritefrag", 1), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
|
"firework_green": (("common.items.utility.firework_green", 1), [("common.items.crafting_ing.twigs", 1), ("common.items.crafting_ing.stones", 1), ("common.items.food.coconut", 1), ("common.items.ore.veloritefrag", 1), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
|
"firework_purple": (("common.items.utility.firework_purple", 1), [("common.items.crafting_ing.twigs", 1), ("common.items.crafting_ing.stones", 1), ("common.items.food.coconut", 1), ("common.items.ore.veloritefrag", 1), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
|
"firework_red": (("common.items.utility.firework_red", 1), [("common.items.crafting_ing.twigs", 1), ("common.items.crafting_ing.stones", 1), ("common.items.food.coconut", 1), ("common.items.ore.veloritefrag", 1), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
|
"firework_yellow": (("common.items.utility.firework_yellow", 1), [("common.items.crafting_ing.twigs", 1), ("common.items.crafting_ing.stones", 1), ("common.items.food.coconut", 1), ("common.items.ore.veloritefrag", 1), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
"apple_shroom_curry": (("common.items.food.apple_mushroom_curry", 1), [("common.items.food.mushroom", 10), ("common.items.food.coconut", 1), ("common.items.food.apple", 5), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
"apple_shroom_curry": (("common.items.food.apple_mushroom_curry", 1), [("common.items.food.mushroom", 10), ("common.items.food.coconut", 1), ("common.items.food.apple", 5), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
"apples_stick": (("common.items.food.apple_stick", 1),[("common.items.crafting_ing.twigs", 1), ("common.items.food.apple", 3)]),
|
"apples_stick": (("common.items.food.apple_stick", 1),[("common.items.crafting_ing.twigs", 1), ("common.items.food.apple", 3)]),
|
||||||
"mushroom_stick": (("common.items.food.mushroom_stick", 1),[("common.items.crafting_ing.twigs", 1), ("common.items.food.mushroom", 5)]),
|
"mushroom_stick": (("common.items.food.mushroom_stick", 1),[("common.items.crafting_ing.twigs", 1), ("common.items.food.mushroom", 5)]),
|
||||||
|
@ -1110,8 +1110,24 @@
|
|||||||
"voxel.object.bomb",
|
"voxel.object.bomb",
|
||||||
(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): VoxTrans(
|
Throwable(Firework(Blue)): VoxTrans(
|
||||||
"voxel.object.firework",
|
"voxel.weapon.projectile.fireworks_blue-0",
|
||||||
|
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
|
),
|
||||||
|
Throwable(Firework(Green)): VoxTrans(
|
||||||
|
"voxel.weapon.projectile.fireworks_green-0",
|
||||||
|
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
|
),
|
||||||
|
Throwable(Firework(Purple)): VoxTrans(
|
||||||
|
"voxel.weapon.projectile.fireworks_purple-0",
|
||||||
|
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
|
),
|
||||||
|
Throwable(Firework(Red)): VoxTrans(
|
||||||
|
"voxel.weapon.projectile.fireworks_red-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,
|
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
),
|
),
|
||||||
Throwable(TrainingDummy): VoxTrans(
|
Throwable(TrainingDummy): VoxTrans(
|
||||||
|
@ -26,6 +26,12 @@ const int FIRE = 1;
|
|||||||
const int GUN_POWDER_SPARK = 2;
|
const int GUN_POWDER_SPARK = 2;
|
||||||
const int SHRAPNEL = 3;
|
const int SHRAPNEL = 3;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
// meters per second squared (acceleration)
|
// meters per second squared (acceleration)
|
||||||
const float earth_gravity = 9.807;
|
const float earth_gravity = 9.807;
|
||||||
|
|
||||||
@ -97,6 +103,51 @@ void main() {
|
|||||||
3.0 + rand0,
|
3.0 + rand0,
|
||||||
vec3(0.6 + rand7 * 0.4)
|
vec3(0.6 + rand7 * 0.4)
|
||||||
);
|
);
|
||||||
|
} else if (inst_mode == FIREWORK_BLUE) {
|
||||||
|
attr = Attr(
|
||||||
|
linear_motion(
|
||||||
|
vec3(0.0, 1.0, 1.0),
|
||||||
|
vec3(rand4, rand5, rand6) * 40.0 + grav_vel(earth_gravity)
|
||||||
|
),
|
||||||
|
3.0 + rand0,
|
||||||
|
vec3(0.6 + rand7 * 0.4)
|
||||||
|
);
|
||||||
|
} else if (inst_mode == FIREWORK_GREEN) {
|
||||||
|
attr = Attr(
|
||||||
|
linear_motion(
|
||||||
|
vec3(0.0, 1.0, 0.0),
|
||||||
|
vec3(rand4, rand5, rand6) * 40.0 + grav_vel(earth_gravity)
|
||||||
|
),
|
||||||
|
3.0 + rand0,
|
||||||
|
vec3(0.6 + rand7 * 0.4)
|
||||||
|
);
|
||||||
|
} else if (inst_mode == FIREWORK_PURPLE) {
|
||||||
|
attr = Attr(
|
||||||
|
linear_motion(
|
||||||
|
vec3(1.0, 0.0, 1.0),
|
||||||
|
vec3(rand4, rand5, rand6) * 40.0 + grav_vel(earth_gravity)
|
||||||
|
),
|
||||||
|
3.0 + rand0,
|
||||||
|
vec3(0.6 + rand7 * 0.4)
|
||||||
|
);
|
||||||
|
} else if (inst_mode == FIREWORK_RED) {
|
||||||
|
attr = Attr(
|
||||||
|
linear_motion(
|
||||||
|
vec3(1.0, 0.0, 0.0),
|
||||||
|
vec3(rand4, rand5, rand6) * 40.0 + grav_vel(earth_gravity)
|
||||||
|
),
|
||||||
|
3.0 + rand0,
|
||||||
|
vec3(0.6 + rand7 * 0.4)
|
||||||
|
);
|
||||||
|
} else if (inst_mode == FIREWORK_YELLOW) {
|
||||||
|
attr = Attr(
|
||||||
|
linear_motion(
|
||||||
|
vec3(1.0, 1.0, 0.0),
|
||||||
|
vec3(rand4, rand5, rand6) * 40.0 + grav_vel(earth_gravity)
|
||||||
|
),
|
||||||
|
3.0 + rand0,
|
||||||
|
vec3(0.6 + rand7 * 0.4)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
attr = Attr(
|
attr = Attr(
|
||||||
linear_motion(
|
linear_motion(
|
||||||
|
BIN
assets/voxygen/voxel/weapon/projectile/fireworks-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/projectile/fireworks-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_blue-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_blue-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_green-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_green-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_purple-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_purple-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_red-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_red-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_yellow-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/projectile/fireworks_yellow-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -58,7 +58,11 @@ pub enum Body {
|
|||||||
CampfireLit = 51,
|
CampfireLit = 51,
|
||||||
BoltFireBig = 52,
|
BoltFireBig = 52,
|
||||||
TrainingDummy = 53,
|
TrainingDummy = 53,
|
||||||
Firework = 54,
|
FireworkBlue = 54,
|
||||||
|
FireworkGreen = 55,
|
||||||
|
FireworkPurple = 56,
|
||||||
|
FireworkRed = 57,
|
||||||
|
FireworkYellow = 58,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Body {
|
impl Body {
|
||||||
@ -68,7 +72,7 @@ impl Body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ALL_OBJECTS: [Body; 55] = [
|
pub const ALL_OBJECTS: [Body; 59] = [
|
||||||
Body::Arrow,
|
Body::Arrow,
|
||||||
Body::Bomb,
|
Body::Bomb,
|
||||||
Body::Scarecrow,
|
Body::Scarecrow,
|
||||||
@ -123,7 +127,11 @@ pub const ALL_OBJECTS: [Body; 55] = [
|
|||||||
Body::BoltFireBig,
|
Body::BoltFireBig,
|
||||||
Body::ArrowSnake,
|
Body::ArrowSnake,
|
||||||
Body::TrainingDummy,
|
Body::TrainingDummy,
|
||||||
Body::Firework,
|
Body::FireworkBlue,
|
||||||
|
Body::FireworkGreen,
|
||||||
|
Body::FireworkPurple,
|
||||||
|
Body::FireworkRed,
|
||||||
|
Body::FireworkYellow,
|
||||||
];
|
];
|
||||||
|
|
||||||
impl From<Body> for super::Body {
|
impl From<Body> for super::Body {
|
||||||
@ -187,7 +195,11 @@ impl Body {
|
|||||||
Body::BoltFireBig => "bolt_fire_big",
|
Body::BoltFireBig => "bolt_fire_big",
|
||||||
Body::ArrowSnake => "arrow_snake",
|
Body::ArrowSnake => "arrow_snake",
|
||||||
Body::TrainingDummy => "training_dummy",
|
Body::TrainingDummy => "training_dummy",
|
||||||
Body::Firework => "firework",
|
Body::FireworkBlue => "firework_blue",
|
||||||
|
Body::FireworkGreen => "firework_green",
|
||||||
|
Body::FireworkPurple => "firework_purple",
|
||||||
|
Body::FireworkRed => "firework_red",
|
||||||
|
Body::FireworkYellow => "firework_yellow",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,16 @@ use vek::Rgb;
|
|||||||
pub enum Throwable {
|
pub enum Throwable {
|
||||||
Bomb,
|
Bomb,
|
||||||
TrainingDummy,
|
TrainingDummy,
|
||||||
Firework,
|
Firework(Reagent),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
pub enum Reagent {
|
||||||
|
Blue,
|
||||||
|
Green,
|
||||||
|
Purple,
|
||||||
|
Red,
|
||||||
|
Yellow,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use super::item::Reagent;
|
||||||
use crate::sync::Uid;
|
use crate::sync::Uid;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::Component;
|
use specs::Component;
|
||||||
@ -5,8 +6,13 @@ use specs_idvs::IdvStorage;
|
|||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum Object {
|
pub enum Object {
|
||||||
Bomb { owner: Option<Uid> },
|
Bomb {
|
||||||
Firework { owner: Option<Uid> },
|
owner: Option<Uid>,
|
||||||
|
},
|
||||||
|
Firework {
|
||||||
|
owner: Option<Uid>,
|
||||||
|
reagent: Reagent,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Component for Object {
|
impl Component for Object {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{comp, sync::Uid, util::Dir};
|
use crate::{comp, sync::Uid, util::Dir};
|
||||||
use comp::item::Item;
|
use comp::item::{Item, Reagent};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use specs::Entity as EcsEntity;
|
use specs::Entity as EcsEntity;
|
||||||
use std::{collections::VecDeque, ops::DerefMut};
|
use std::{collections::VecDeque, ops::DerefMut};
|
||||||
@ -26,6 +26,7 @@ pub enum ServerEvent {
|
|||||||
power: f32,
|
power: f32,
|
||||||
owner: Option<Uid>,
|
owner: Option<Uid>,
|
||||||
friendly_damage: bool,
|
friendly_damage: bool,
|
||||||
|
reagent: Option<Reagent>,
|
||||||
},
|
},
|
||||||
Damage {
|
Damage {
|
||||||
uid: Uid,
|
uid: Uid,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use crate::comp;
|
use crate::comp;
|
||||||
|
use comp::item::Reagent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ pub enum Outcome {
|
|||||||
Explosion {
|
Explosion {
|
||||||
pos: Vec3<f32>,
|
pos: Vec3<f32>,
|
||||||
power: f32,
|
power: f32,
|
||||||
|
reagent: Option<Reagent>, // How can we better define this?
|
||||||
},
|
},
|
||||||
ProjectileShot {
|
ProjectileShot {
|
||||||
pos: Vec3<f32>,
|
pos: Vec3<f32>,
|
||||||
|
@ -71,6 +71,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
power,
|
power,
|
||||||
owner: projectile.owner,
|
owner: projectile.owner,
|
||||||
friendly_damage: false,
|
friendly_damage: false,
|
||||||
|
reagent: None,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
||||||
@ -133,6 +134,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
power,
|
power,
|
||||||
owner: projectile.owner,
|
owner: projectile.owner,
|
||||||
friendly_damage: false,
|
friendly_damage: false,
|
||||||
|
reagent: None,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
||||||
|
@ -1039,6 +1039,7 @@ fn handle_explosion(
|
|||||||
power,
|
power,
|
||||||
owner: ecs.read_storage::<Uid>().get(target).copied(),
|
owner: ecs.read_storage::<Uid>().get(target).copied(),
|
||||||
friendly_damage: true,
|
friendly_damage: true,
|
||||||
|
reagent: None,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
|
@ -13,6 +13,7 @@ use common::{
|
|||||||
terrain::{Block, TerrainGrid},
|
terrain::{Block, TerrainGrid},
|
||||||
vol::{ReadVol, Vox},
|
vol::{ReadVol, Vox},
|
||||||
};
|
};
|
||||||
|
use comp::item::Reagent;
|
||||||
use specs::{join::Join, saveload::MarkerAllocator, Entity as EcsEntity, WorldExt};
|
use specs::{join::Join, saveload::MarkerAllocator, Entity as EcsEntity, WorldExt};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
@ -284,6 +285,7 @@ pub fn handle_explosion(
|
|||||||
power: f32,
|
power: f32,
|
||||||
owner: Option<Uid>,
|
owner: Option<Uid>,
|
||||||
friendly_damage: bool,
|
friendly_damage: bool,
|
||||||
|
reagent: Option<Reagent>,
|
||||||
) {
|
) {
|
||||||
// Go through all other entities
|
// Go through all other entities
|
||||||
let hit_range = 3.0 * power;
|
let hit_range = 3.0 * power;
|
||||||
@ -291,7 +293,11 @@ pub fn handle_explosion(
|
|||||||
|
|
||||||
// Add an outcome
|
// Add an outcome
|
||||||
ecs.write_resource::<Vec<Outcome>>()
|
ecs.write_resource::<Vec<Outcome>>()
|
||||||
.push(Outcome::Explosion { pos, power });
|
.push(Outcome::Explosion {
|
||||||
|
pos,
|
||||||
|
power,
|
||||||
|
reagent,
|
||||||
|
});
|
||||||
|
|
||||||
let owner_entity = owner.and_then(|uid| {
|
let owner_entity = owner.and_then(|uid| {
|
||||||
ecs.read_resource::<UidAllocator>()
|
ecs.read_resource::<UidAllocator>()
|
||||||
|
@ -11,10 +11,11 @@ use common::{
|
|||||||
terrain::block::Block,
|
terrain::block::Block,
|
||||||
vol::{ReadVol, Vox},
|
vol::{ReadVol, Vox},
|
||||||
};
|
};
|
||||||
|
use comp::LightEmitter;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{join::Join, world::WorldExt, Builder, Entity as EcsEntity, WriteStorage};
|
use specs::{join::Join, world::WorldExt, Builder, Entity as EcsEntity, WriteStorage};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
use vek::Vec3;
|
use vek::{Rgb, Vec3};
|
||||||
|
|
||||||
pub fn swap_lantern(
|
pub fn swap_lantern(
|
||||||
storage: &mut WriteStorage<comp::LightEmitter>,
|
storage: &mut WriteStorage<comp::LightEmitter>,
|
||||||
@ -400,10 +401,16 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut rng = rand::thread_rng();
|
||||||
|
|
||||||
// Throw items
|
// Throw items
|
||||||
for (pos, vel, ori, kind) in thrown_items {
|
for (pos, vel, ori, kind) in thrown_items {
|
||||||
let vel = match kind {
|
let vel = match kind {
|
||||||
item::Throwable::Firework => Vec3::unit_z() * 200.0,
|
item::Throwable::Firework(_) => Vec3::new(
|
||||||
|
rng.gen_range(-15.0, 15.0),
|
||||||
|
rng.gen_range(-15.0, 15.0),
|
||||||
|
rng.gen_range(80.0, 110.0),
|
||||||
|
),
|
||||||
_ => {
|
_ => {
|
||||||
vel.0
|
vel.0
|
||||||
+ *ori.0 * 20.0
|
+ *ori.0 * 20.0
|
||||||
@ -417,7 +424,13 @@ 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,
|
||||||
item::Throwable::Firework => comp::object::Body::Bomb,
|
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::Yellow => comp::object::Body::FireworkYellow,
|
||||||
|
},
|
||||||
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))
|
||||||
@ -427,8 +440,18 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
|||||||
item::Throwable::Bomb => {
|
item::Throwable::Bomb => {
|
||||||
new_entity = new_entity.with(comp::Object::Bomb { owner: uid });
|
new_entity = new_entity.with(comp::Object::Bomb { owner: uid });
|
||||||
},
|
},
|
||||||
item::Throwable::Firework => {
|
item::Throwable::Firework(reagent) => {
|
||||||
new_entity = new_entity.with(comp::Object::Firework { owner: uid });
|
new_entity = new_entity
|
||||||
|
.with(comp::Object::Firework {
|
||||||
|
owner: uid,
|
||||||
|
reagent,
|
||||||
|
})
|
||||||
|
.with(LightEmitter {
|
||||||
|
animated: true,
|
||||||
|
flicker: 2.0,
|
||||||
|
strength: 2.0,
|
||||||
|
col: Rgb::new(1.0, 1.0, 0.0),
|
||||||
|
});
|
||||||
},
|
},
|
||||||
item::Throwable::TrainingDummy => {
|
item::Throwable::TrainingDummy => {
|
||||||
new_entity = new_entity.with(comp::Stats::new(
|
new_entity = new_entity.with(comp::Stats::new(
|
||||||
|
@ -55,7 +55,8 @@ impl Server {
|
|||||||
power,
|
power,
|
||||||
owner,
|
owner,
|
||||||
friendly_damage,
|
friendly_damage,
|
||||||
} => handle_explosion(&self, pos, power, owner, friendly_damage),
|
reagent,
|
||||||
|
} => handle_explosion(&self, pos, power, owner, friendly_damage, reagent),
|
||||||
ServerEvent::Shoot {
|
ServerEvent::Shoot {
|
||||||
entity,
|
entity,
|
||||||
dir,
|
dir,
|
||||||
|
@ -26,8 +26,14 @@ impl<'a> System<'a> for Sys {
|
|||||||
let mut server_emitter = server_bus.emitter();
|
let mut server_emitter = server_bus.emitter();
|
||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
for (entity, pos, vel, physics, object) in
|
for (entity, pos, vel, physics, object) in (
|
||||||
(&entities, &positions, &velocities, &physics_states, &mut objects).join()
|
&entities,
|
||||||
|
&positions,
|
||||||
|
&velocities,
|
||||||
|
&physics_states,
|
||||||
|
&mut objects,
|
||||||
|
)
|
||||||
|
.join()
|
||||||
{
|
{
|
||||||
match object {
|
match object {
|
||||||
Object::Bomb { owner } => {
|
Object::Bomb { owner } => {
|
||||||
@ -41,11 +47,12 @@ impl<'a> System<'a> for Sys {
|
|||||||
power: 4.0,
|
power: 4.0,
|
||||||
owner: *owner,
|
owner: *owner,
|
||||||
friendly_damage: true,
|
friendly_damage: true,
|
||||||
|
reagent: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Object::Firework { owner } => {
|
Object::Firework { owner, reagent } => {
|
||||||
if physics.on_surface().is_some() || vel.0.z < 0.0 {
|
if vel.0.z < 0.0 {
|
||||||
server_emitter.emit(ServerEvent::Destroy {
|
server_emitter.emit(ServerEvent::Destroy {
|
||||||
entity,
|
entity,
|
||||||
cause: HealthSource::Suicide,
|
cause: HealthSource::Suicide,
|
||||||
@ -55,6 +62,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
power: 4.0,
|
power: 4.0,
|
||||||
owner: *owner,
|
owner: *owner,
|
||||||
friendly_damage: true,
|
friendly_damage: true,
|
||||||
|
reagent: Some(*reagent),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -273,7 +273,7 @@ impl SfxMgr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match outcome {
|
match outcome {
|
||||||
Outcome::Explosion { pos, power } => {
|
Outcome::Explosion { pos, power, .. } => {
|
||||||
audio.play_sfx(
|
audio.play_sfx(
|
||||||
// TODO: from sfx triggers config
|
// TODO: from sfx triggers config
|
||||||
"voxygen.audio.sfx.explosion",
|
"voxygen.audio.sfx.explosion",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![allow(clippy::option_map_unit_fn)]
|
#![allow(clippy::option_map_unit_fn)]
|
||||||
#![feature(drain_filter, bool_to_option)]
|
#![feature(drain_filter, bool_to_option, or_patterns)]
|
||||||
#![recursion_limit = "2048"]
|
#![recursion_limit = "2048"]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -87,6 +87,11 @@ pub enum ParticleMode {
|
|||||||
CampfireFire = 1,
|
CampfireFire = 1,
|
||||||
GunPowderSpark = 2,
|
GunPowderSpark = 2,
|
||||||
Shrapnel = 3,
|
Shrapnel = 3,
|
||||||
|
FireworkBlue = 4,
|
||||||
|
FireworkGreen = 5,
|
||||||
|
FireworkPurple = 6,
|
||||||
|
FireworkRed = 7,
|
||||||
|
FireworkYellow = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParticleMode {
|
impl ParticleMode {
|
||||||
|
@ -3418,7 +3418,26 @@ pub fn mesh_object(
|
|||||||
Vec3::new(-0.5, -6.0, -1.5),
|
Vec3::new(-0.5, -6.0, -1.5),
|
||||||
),
|
),
|
||||||
Body::Bomb => ("object.bomb", Vec3::new(-5.5, -5.5, 0.0)),
|
Body::Bomb => ("object.bomb", Vec3::new(-5.5, -5.5, 0.0)),
|
||||||
Body::Firework => ("object.firework", Vec3::new(-5.5, -5.5, 0.0)),
|
Body::FireworkBlue => (
|
||||||
|
"weapon.projectile.fireworks_blue-0",
|
||||||
|
Vec3::new(0.0, 0.0, 0.0),
|
||||||
|
),
|
||||||
|
Body::FireworkGreen => (
|
||||||
|
"weapon.projectile.fireworks_green-0",
|
||||||
|
Vec3::new(0.0, 0.0, 0.0),
|
||||||
|
),
|
||||||
|
Body::FireworkPurple => (
|
||||||
|
"weapon.projectile.fireworks_purple-0",
|
||||||
|
Vec3::new(0.0, 0.0, 0.0),
|
||||||
|
),
|
||||||
|
Body::FireworkRed => (
|
||||||
|
"weapon.projectile.fireworks_red-0",
|
||||||
|
Vec3::new(0.0, 0.0, 0.0),
|
||||||
|
),
|
||||||
|
Body::FireworkYellow => (
|
||||||
|
"weapon.projectile.fireworks_yellow-0",
|
||||||
|
Vec3::new(0.0, 0.0, 0.0),
|
||||||
|
),
|
||||||
Body::Scarecrow => ("object.scarecrow", Vec3::new(-9.5, -4.0, 0.0)),
|
Body::Scarecrow => ("object.scarecrow", Vec3::new(-9.5, -4.0, 0.0)),
|
||||||
Body::Cauldron => ("object.cauldron", Vec3::new(-10.0, -10.0, 0.0)),
|
Body::Cauldron => ("object.cauldron", Vec3::new(-10.0, -10.0, 0.0)),
|
||||||
Body::ChestVines => ("object.chest_vines", Vec3::new(-7.5, -6.0, 0.0)),
|
Body::ChestVines => ("object.chest_vines", Vec3::new(-7.5, -6.0, 0.0)),
|
||||||
|
@ -26,6 +26,7 @@ use common::{
|
|||||||
terrain::{BlockKind, TerrainChunk},
|
terrain::{BlockKind, TerrainChunk},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
|
use comp::item::Reagent;
|
||||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -203,9 +204,31 @@ impl Scene {
|
|||||||
self.sfx_mgr.handle_outcome(&outcome, audio);
|
self.sfx_mgr.handle_outcome(&outcome, audio);
|
||||||
|
|
||||||
match outcome {
|
match outcome {
|
||||||
Outcome::Explosion { pos, power, .. } => self.event_lights.push(EventLight {
|
Outcome::Explosion {
|
||||||
light: Light::new(*pos, Rgb::new(1.0, 0.5, 0.0), *power * 2.5),
|
pos,
|
||||||
timeout: 0.5,
|
power,
|
||||||
|
reagent,
|
||||||
|
} => self.event_lights.push(EventLight {
|
||||||
|
light: Light::new(
|
||||||
|
*pos,
|
||||||
|
match reagent {
|
||||||
|
Some(Reagent::Blue) => Rgb::new(0.0, 0.0, 1.0),
|
||||||
|
Some(Reagent::Green) => Rgb::new(0.0, 1.0, 0.0),
|
||||||
|
Some(Reagent::Purple) => Rgb::new(1.0, 0.0, 1.0),
|
||||||
|
Some(Reagent::Red) => Rgb::new(1.0, 0.0, 0.0),
|
||||||
|
Some(Reagent::Yellow) => Rgb::new(1.0, 1.0, 0.0),
|
||||||
|
None => Rgb::new(1.0, 0.5, 0.0),
|
||||||
|
},
|
||||||
|
*power
|
||||||
|
* match reagent {
|
||||||
|
Some(_) => 5.0,
|
||||||
|
None => 2.5,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
timeout: match reagent {
|
||||||
|
Some(_) => 1.0,
|
||||||
|
None => 0.5,
|
||||||
|
},
|
||||||
fadeout: |timeout| timeout * 2.0,
|
fadeout: |timeout| timeout * 2.0,
|
||||||
}),
|
}),
|
||||||
Outcome::ProjectileShot { .. } => {},
|
Outcome::ProjectileShot { .. } => {},
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
comp::{object, Body, CharacterState, Pos},
|
comp::{item::Reagent, object, Body, CharacterState, Pos},
|
||||||
figure::Segment,
|
figure::Segment,
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
};
|
};
|
||||||
@ -48,15 +48,27 @@ impl ParticleMgr {
|
|||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
|
|
||||||
match outcome {
|
match outcome {
|
||||||
Outcome::Explosion { pos, power } => {
|
Outcome::Explosion {
|
||||||
|
pos,
|
||||||
|
power,
|
||||||
|
reagent,
|
||||||
|
} => {
|
||||||
for _ in 0..150 {
|
for _ in 0..150 {
|
||||||
self.particles.push(Particle::new(
|
self.particles.push(Particle::new(
|
||||||
Duration::from_millis(250),
|
Duration::from_millis(if reagent.is_some() { 1000 } else { 250 }),
|
||||||
time,
|
time,
|
||||||
ParticleMode::Shrapnel,
|
match reagent {
|
||||||
|
Some(Reagent::Blue) => ParticleMode::FireworkBlue,
|
||||||
|
Some(Reagent::Green) => ParticleMode::FireworkGreen,
|
||||||
|
Some(Reagent::Purple) => ParticleMode::FireworkPurple,
|
||||||
|
Some(Reagent::Red) => ParticleMode::FireworkRed,
|
||||||
|
Some(Reagent::Yellow) => ParticleMode::FireworkYellow,
|
||||||
|
None => ParticleMode::Shrapnel,
|
||||||
|
},
|
||||||
*pos,
|
*pos,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
for _ in 0..200 {
|
for _ in 0..200 {
|
||||||
self.particles.push(Particle::new(
|
self.particles.push(Particle::new(
|
||||||
Duration::from_secs(4),
|
Duration::from_secs(4),
|
||||||
@ -113,7 +125,14 @@ impl ParticleMgr {
|
|||||||
Body::Object(object::Body::BoltFireBig) => {
|
Body::Object(object::Body::BoltFireBig) => {
|
||||||
self.maintain_boltfirebig_particles(scene_data, pos)
|
self.maintain_boltfirebig_particles(scene_data, pos)
|
||||||
},
|
},
|
||||||
Body::Object(object::Body::Bomb) => self.maintain_bomb_particles(scene_data, pos),
|
Body::Object(
|
||||||
|
object::Body::Bomb
|
||||||
|
| object::Body::FireworkBlue
|
||||||
|
| object::Body::FireworkGreen
|
||||||
|
| object::Body::FireworkPurple
|
||||||
|
| object::Body::FireworkRed
|
||||||
|
| object::Body::FireworkYellow,
|
||||||
|
) => self.maintain_bomb_particles(scene_data, pos),
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user