From ad0314b4f5f6c69a99a950d965707bf23893f2e8 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 27 Mar 2020 17:07:19 +0100 Subject: [PATCH 1/6] Projectile hits regenerate energy --- common/src/comp/inventory/item.rs | 2 ++ common/src/comp/projectile.rs | 1 + common/src/sys/projectile.rs | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/common/src/comp/inventory/item.rs b/common/src/comp/inventory/item.rs index 27ced5f27b..ce7d6e936d 100644 --- a/common/src/comp/inventory/item.rs +++ b/common/src/comp/inventory/item.rs @@ -106,6 +106,7 @@ impl ToolData { cause: HealthSource::Projectile { owner: None }, }), projectile::Effect::Knockback(10.0), + projectile::Effect::RewardEnergy(100), projectile::Effect::Vanish, ], time_left: Duration::from_secs(15), @@ -146,6 +147,7 @@ impl ToolData { amount: -1, cause: HealthSource::Projectile { owner: None }, }), + projectile::Effect::RewardEnergy(100), projectile::Effect::Vanish, ], time_left: Duration::from_secs(20), diff --git a/common/src/comp/projectile.rs b/common/src/comp/projectile.rs index a4dda1ac7c..8ff384a87a 100644 --- a/common/src/comp/projectile.rs +++ b/common/src/comp/projectile.rs @@ -7,6 +7,7 @@ use std::time::Duration; pub enum Effect { Damage(comp::HealthChange), Knockback(f32), + RewardEnergy(u32), Explode { power: f32 }, Vanish, Stick, diff --git a/common/src/sys/projectile.rs b/common/src/sys/projectile.rs index 3f0ee14a04..bf0fc1064d 100644 --- a/common/src/sys/projectile.rs +++ b/common/src/sys/projectile.rs @@ -1,5 +1,7 @@ use crate::{ - comp::{projectile, HealthSource, Ori, PhysicsState, Pos, Projectile, Vel}, + comp::{ + projectile, Energy, EnergySource, HealthSource, Ori, PhysicsState, Pos, Projectile, Vel, + }, event::{EventBus, LocalEvent, ServerEvent}, state::DeltaTime, sync::UidAllocator, @@ -22,6 +24,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Vel>, WriteStorage<'a, Ori>, WriteStorage<'a, Projectile>, + WriteStorage<'a, Energy>, ); fn run( @@ -37,6 +40,7 @@ impl<'a> System<'a> for Sys { velocities, mut orientations, mut projectiles, + mut energies, ): Self::SystemData, ) { let mut local_emitter = local_bus.emitter(); @@ -108,6 +112,15 @@ impl<'a> System<'a> for Sys { }); } }, + projectile::Effect::RewardEnergy(energy) => { + if let Some(energy_mut) = projectile + .owner + .and_then(|o| uid_allocator.retrieve_entity_internal(o.into())) + .and_then(|o| energies.get_mut(o)) + { + energy_mut.change_by(energy as i32, EnergySource::HitEnemy); + } + }, projectile::Effect::Explode { power } => { server_emitter.emit(ServerEvent::Explosion { pos: pos.0, From c3a4f897da02ea7d14c5f80de7e1e340ef01715d Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Fri, 27 Mar 2020 17:50:34 +0100 Subject: [PATCH 2/6] update help screen --- assets/voxygen/element/help.png | 4 ++-- voxygen/src/settings.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/voxygen/element/help.png b/assets/voxygen/element/help.png index c399bd2d1a..558430c026 100644 --- a/assets/voxygen/element/help.png +++ b/assets/voxygen/element/help.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c71ba3a6458d00f3c6fb2820f1a83c6138a4776fdfd7167c2766b40b7bbb377 -size 14939 +oid sha256:561db05ac9702129859c6b266dd63df7e0ab5c832c6ce587afc65bc203592cd6 +size 14794 diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 85c4f8fba0..c7d4dc8ae3 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -365,7 +365,7 @@ impl Default for GameplaySettings { chat_transp: 0.4, crosshair_type: CrosshairType::Round, intro_show: Intro::Show, - xp_bar: XpBar::OnGain, + xp_bar: XpBar::Always, shortcut_numbers: ShortcutNumbers::On, bar_numbers: BarNumbers::Off, ui_scale: ScaleMode::RelativeToWindow([1920.0, 1080.0].into()), From 6fd3339b75e834ffbbf37dc831da7db64ad64ee5 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 27 Mar 2020 17:50:45 +0100 Subject: [PATCH 3/6] Make apples great again --- assets/common/items/apple.ron | 4 ++-- world/src/block/mod.rs | 6 +++++- world/src/block/natural.rs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/common/items/apple.ron b/assets/common/items/apple.ron index 0c44a094ce..7179502e22 100644 --- a/assets/common/items/apple.ron +++ b/assets/common/items/apple.ron @@ -2,11 +2,11 @@ Item( name: "Apple", description: "Red and juicy. -Restores 2 Health.", +Restores 20 Health.", kind: Consumable( kind: Apple, effect: Health(( - amount: 2, + amount: 20, cause: Item, )), ), diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 3c61e20936..a994baf712 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -628,7 +628,11 @@ pub fn block_from_structure( ) .map(|e| e as u8), )), - StructureBlock::Fruit => Some(Block::new(BlockKind::Apple, Rgb::new(194, 30, 37))), + StructureBlock::Fruit => Some(if field.get(pos + structure_pos) % 3 > 0 { + Block::empty() + } else { + Block::new(BlockKind::Apple, Rgb::new(194, 30, 37)) + }), StructureBlock::Chest => Some(if structure_seed % 10 < 7 { Block::empty() } else { diff --git a/world/src/block/natural.rs b/world/src/block/natural.rs index 8e472e53e6..c60d593d34 100644 --- a/world/src/block/natural.rs +++ b/world/src/block/natural.rs @@ -56,7 +56,7 @@ pub fn structure_gen<'a>( ForestKind::Palm => &PALMS, ForestKind::Savannah => &ACACIAS, ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 16 == 7 => &OAK_STUMPS, - ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 8 == 7 => &FRUIT_TREES, + ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 19 == 7 => &FRUIT_TREES, ForestKind::Oak if QUIRKY_RAND.get(st_seed) % 14 == 7 => &BIRCHES, ForestKind::Oak => &OAKS, ForestKind::Pine => &PINES, From 6fe5c5724c155ee0962ee15dac04640c705519dd Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 27 Mar 2020 18:17:41 +0100 Subject: [PATCH 4/6] Fix char selection not showing tools --- common/src/states/basic_ranged.rs | 2 +- voxygen/src/menu/char_selection/mod.rs | 2 +- voxygen/src/menu/char_selection/ui.rs | 28 +++++++++++++++++++++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/common/src/states/basic_ranged.rs b/common/src/states/basic_ranged.rs index 81f1485baf..3652c40e1e 100644 --- a/common/src/states/basic_ranged.rs +++ b/common/src/states/basic_ranged.rs @@ -28,7 +28,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_move(data, &mut update, 0.2); + handle_move(data, &mut update, 0.3); handle_jump(data, &mut update); if self.prepare_timer < self.prepare_duration diff --git a/voxygen/src/menu/char_selection/mod.rs b/voxygen/src/menu/char_selection/mod.rs index a8c767c9fc..3ca05435d4 100644 --- a/voxygen/src/menu/char_selection/mod.rs +++ b/voxygen/src/menu/char_selection/mod.rs @@ -117,7 +117,7 @@ impl PlayState for CharSelectionState { global_state.window.renderer_mut(), self.client.borrow().get_tick(), humanoid_body.clone(), - loadout, + loadout.as_ref(), ); // Draw the UI to the screen. diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index a1ff30d842..2c8d7ac104 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -333,9 +333,31 @@ impl CharSelectionUi { } } - pub fn get_loadout(&mut self) -> Option<&comp::Loadout> { + pub fn get_loadout(&mut self) -> Option { match &mut self.mode { - Mode::Select(_) => None, + Mode::Select(characterdata) => { + let loadout = comp::Loadout { + active_item: characterdata + .as_ref() + .and_then(|d| d.tool.as_ref()) + .map(|tool| comp::ItemConfig { + item: (*load_expect::(&tool)).clone(), + ability1: None, + ability2: None, + ability3: None, + block_ability: None, + dodge_ability: None, + }), + second_item: None, + shoulder: None, + chest: None, + belt: None, + hand: None, + pants: None, + foot: None, + }; + Some(loadout) + }, Mode::Create { loadout, tool, .. } => { loadout.active_item = tool.map(|tool| comp::ItemConfig { item: (*load_expect::(tool)).clone(), @@ -345,7 +367,7 @@ impl CharSelectionUi { block_ability: None, dodge_ability: None, }); - Some(loadout) + Some(loadout.clone()) }, } } From 0b3fb2dd3cee121a4b5f85ff13186a5a68571468 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Fri, 27 Mar 2020 18:31:45 +0100 Subject: [PATCH 5/6] fire bolt visuals --- assets/voxygen/voxel/weapon/projectile/fire-bolt-0.vox | 3 +++ assets/voxygen/voxel/weapon/projectile/fire-bolt-1.vox | 3 +++ assets/voxygen/voxel/weapon/projectile/fire-bolt-2.vox | 3 --- assets/voxygen/voxel/weapon/projectile/fire-bolt.vox | 3 --- assets/voxygen/voxel/weapon/projectile/leaf.vox | 4 ++-- assets/voxygen/voxel/weapon/projectile/nature-bolt.vox | 4 ++-- assets/voxygen/voxel/weapon/projectile/simple-arrow.vox | 4 ++-- assets/voxygen/voxel/weapon/projectile/snake-arrow.vox | 4 ++-- common/src/comp/body/object.rs | 4 +++- common/src/comp/inventory/item.rs | 2 +- voxygen/src/scene/figure/load.rs | 3 ++- 11 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 assets/voxygen/voxel/weapon/projectile/fire-bolt-0.vox create mode 100644 assets/voxygen/voxel/weapon/projectile/fire-bolt-1.vox delete mode 100644 assets/voxygen/voxel/weapon/projectile/fire-bolt-2.vox delete mode 100644 assets/voxygen/voxel/weapon/projectile/fire-bolt.vox diff --git a/assets/voxygen/voxel/weapon/projectile/fire-bolt-0.vox b/assets/voxygen/voxel/weapon/projectile/fire-bolt-0.vox new file mode 100644 index 0000000000..fed4afe7ea --- /dev/null +++ b/assets/voxygen/voxel/weapon/projectile/fire-bolt-0.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec4e54b888ffd13401966692126b944c93a50bc2dffad859e5a66f6c91b4010b +size 1804 diff --git a/assets/voxygen/voxel/weapon/projectile/fire-bolt-1.vox b/assets/voxygen/voxel/weapon/projectile/fire-bolt-1.vox new file mode 100644 index 0000000000..0ff9320b16 --- /dev/null +++ b/assets/voxygen/voxel/weapon/projectile/fire-bolt-1.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e21be7a7667ffbf0ec9c1bdcc13476cd7c6a416afff352ecd188b6e51700d990 +size 5416 diff --git a/assets/voxygen/voxel/weapon/projectile/fire-bolt-2.vox b/assets/voxygen/voxel/weapon/projectile/fire-bolt-2.vox deleted file mode 100644 index 133b9c16c7..0000000000 --- a/assets/voxygen/voxel/weapon/projectile/fire-bolt-2.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d15904841c98667bcb01da55d1d7ad2aa7fd5d3358b72d7070ee89e2a420800 -size 56123 diff --git a/assets/voxygen/voxel/weapon/projectile/fire-bolt.vox b/assets/voxygen/voxel/weapon/projectile/fire-bolt.vox deleted file mode 100644 index 385f737523..0000000000 --- a/assets/voxygen/voxel/weapon/projectile/fire-bolt.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2f57b1e7622e4af69e25010dace42b46a2b4628ecf31e438b5ed3d57c726bc72 -size 56287 diff --git a/assets/voxygen/voxel/weapon/projectile/leaf.vox b/assets/voxygen/voxel/weapon/projectile/leaf.vox index 5424426691..c8cac78836 100644 --- a/assets/voxygen/voxel/weapon/projectile/leaf.vox +++ b/assets/voxygen/voxel/weapon/projectile/leaf.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fce17a25351dd63d00de7850ca81d9a71ea93d713587bb23b3ef0cf0ba4f00a9 -size 55755 +oid sha256:7483ea5a59bf63b62cdb3d7a7c9ed7ce8d06fcc7afd8ca0c4b3fd482a0107bcb +size 1272 diff --git a/assets/voxygen/voxel/weapon/projectile/nature-bolt.vox b/assets/voxygen/voxel/weapon/projectile/nature-bolt.vox index d264912a00..621509ac91 100644 --- a/assets/voxygen/voxel/weapon/projectile/nature-bolt.vox +++ b/assets/voxygen/voxel/weapon/projectile/nature-bolt.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:477af654cf4a713e4c1128dfc64519482b8c12219c49cada4acc85e80713f5c0 -size 56123 +oid sha256:171a9e9eda4d240a86ec111c95c07d0373ab78885ba153759514a17ff08ec1b2 +size 1640 diff --git a/assets/voxygen/voxel/weapon/projectile/simple-arrow.vox b/assets/voxygen/voxel/weapon/projectile/simple-arrow.vox index 4cfe04e2da..36e4d33d25 100644 --- a/assets/voxygen/voxel/weapon/projectile/simple-arrow.vox +++ b/assets/voxygen/voxel/weapon/projectile/simple-arrow.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6cb25e13383c652a6b1cd27282db67ed86f1954e784e4d645d676df125742a9a -size 55647 +oid sha256:506e9c9675bfbd21278a9d01f44c025ae560f05ddec37412f7da394457f2fc0f +size 1164 diff --git a/assets/voxygen/voxel/weapon/projectile/snake-arrow.vox b/assets/voxygen/voxel/weapon/projectile/snake-arrow.vox index c0691fab73..ab253258cd 100644 --- a/assets/voxygen/voxel/weapon/projectile/snake-arrow.vox +++ b/assets/voxygen/voxel/weapon/projectile/snake-arrow.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:05be44bed311c4b7900e5fdcad6438bb3a0003ed4cb645c5d693f5f1a17006cd -size 55679 +oid sha256:964372054cad9962a6f0429bdb9b1ea5794e53e0e822d2a7f9cb6be268bcdf37 +size 1196 diff --git a/common/src/comp/body/object.rs b/common/src/comp/body/object.rs index 514a191bf1..d179884062 100644 --- a/common/src/comp/body/object.rs +++ b/common/src/comp/body/object.rs @@ -55,6 +55,7 @@ pub enum Body { BoltFire = 49, ArrowSnake = 50, CampfireLit = 51, + BoltFireBig = 52, } impl Body { @@ -64,7 +65,7 @@ impl Body { } } -const ALL_OBJECTS: [Body; 51] = [ +const ALL_OBJECTS: [Body; 52] = [ Body::Arrow, Body::Bomb, Body::Scarecrow, @@ -115,5 +116,6 @@ const ALL_OBJECTS: [Body; 51] = [ Body::CarpetHumanSquircle, Body::CraftingBench, Body::BoltFire, + Body::BoltFireBig, Body::ArrowSnake, ]; diff --git a/common/src/comp/inventory/item.rs b/common/src/comp/inventory/item.rs index ce7d6e936d..f29046354f 100644 --- a/common/src/comp/inventory/item.rs +++ b/common/src/comp/inventory/item.rs @@ -182,7 +182,7 @@ impl ToolData { time_left: Duration::from_secs(20), owner: None, }, - projectile_body: Body::Object(object::Body::BoltFire), + projectile_body: Body::Object(object::Body::BoltFireBig), projectile_light: Some(LightEmitter { col: (0.72, 0.11, 0.11).into(), ..Default::default() diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index a2e51c48ab..b9ea7bc49e 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -1869,7 +1869,8 @@ pub fn mesh_object(obj: object::Body) -> Mesh { Body::Pouch => ("object.pouch", Vec3::new(-5.5, -4.5, 0.0)), Body::CraftingBench => ("object.crafting_bench", Vec3::new(-9.5, -7.0, 0.0)), Body::ArrowSnake => ("weapon.projectile.snake-arrow", Vec3::new(-1.5, -6.5, 0.0)), - Body::BoltFire => ("weapon.projectile.fire-bolt", Vec3::new(-3.0, -5.5, -3.0)), + Body::BoltFire => ("weapon.projectile.fire-bolt-0", Vec3::new(-3.0, -5.5, -3.0)), + Body::BoltFireBig => ("weapon.projectile.fire-bolt-1", Vec3::new(-6.0, -6.0, -6.0)), }; load_mesh(name, offset) } From c6e635c51119ffd36dd5d181e39dc255db79d624 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 27 Mar 2020 18:38:01 +0100 Subject: [PATCH 6/6] Increase movement speed, make npcs slower than players --- common/src/comp/inventory/item.rs | 2 +- common/src/states/utils.rs | 4 ++-- server/src/events/entity_manipulation.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/comp/inventory/item.rs b/common/src/comp/inventory/item.rs index f29046354f..f1b29b8a3f 100644 --- a/common/src/comp/inventory/item.rs +++ b/common/src/comp/inventory/item.rs @@ -165,7 +165,7 @@ impl ToolData { energy_cost: 400, holdable: false, prepare_duration: Duration::from_millis(800), - recover_duration: Duration::from_millis(300), + recover_duration: Duration::from_millis(50), projectile: Projectile { hit_ground: vec![ projectile::Effect::Explode { power: 1.4 }, diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 4c635cd68e..043468c0ae 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -9,8 +9,8 @@ use vek::vec::Vec2; pub const MOVEMENT_THRESHOLD_VEL: f32 = 3.0; const BASE_HUMANOID_ACCEL: f32 = 100.0; -const BASE_HUMANOID_SPEED: f32 = 150.0; -const NPC_HUMANOID_SPEED: f32 = 150.0; +const BASE_HUMANOID_SPEED: f32 = 170.0; +const NPC_HUMANOID_SPEED: f32 = 170.0; const BASE_HUMANOID_AIR_ACCEL: f32 = 15.0; const BASE_HUMANOID_AIR_SPEED: f32 = 8.0; const BASE_HUMANOID_WATER_ACCEL: f32 = 70.0; diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 714d35933d..17231b07f1 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -194,7 +194,7 @@ pub fn handle_respawn(server: &Server, entity: EcsEntity) { pub fn handle_explosion(server: &Server, pos: Vec3, power: f32, owner: Option) { // Go through all other entities - let hit_range = 2.0 * power; + let hit_range = 3.0 * power; let ecs = &server.state.ecs(); for (pos_b, ori_b, character_b, stats_b) in ( &ecs.read_storage::(),