From f77d2f06c6231aa725c8870255c9b7765f05b3ad Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Mon, 6 Jul 2020 23:37:44 +0100 Subject: [PATCH] Fixed staff RMB, bug in ranged weapon code --- common/src/comp/agent.rs | 4 +--- common/src/comp/inventory/item/tool.rs | 12 ++++++------ common/src/states/basic_ranged.rs | 8 +++++--- common/src/sys/combat.rs | 9 +++++++-- voxygen/src/session.rs | 3 ++- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/common/src/comp/agent.rs b/common/src/comp/agent.rs index 2ae77e6ce3..d1052d1af5 100644 --- a/common/src/comp/agent.rs +++ b/common/src/comp/agent.rs @@ -44,9 +44,7 @@ impl Alignment { // TODO: Remove this hack pub fn is_friendly_to_players(&self) -> bool { match self { - Alignment::Npc - | Alignment::Tame - | Alignment::Owned(_) => true, + Alignment::Npc | Alignment::Tame | Alignment::Owned(_) => true, _ => false, } } diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index 5ad3221484..443859c859 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -331,18 +331,18 @@ impl Tool { }, BasicRanged { energy_cost: 0, - holdable: true, + holdable: false, prepare_duration: Duration::from_millis(250), - recover_duration: Duration::from_millis(200), + recover_duration: Duration::from_millis(600), projectile: Projectile { hit_solid: vec![projectile::Effect::Vanish], hit_entity: vec![ projectile::Effect::Damage(HealthChange { // TODO: This should not be fixed (?) - amount: -2, + amount: -3, cause: HealthSource::Projectile { owner: None }, }), - projectile::Effect::RewardEnergy(100), + projectile::Effect::RewardEnergy(150), projectile::Effect::Vanish, ], time_left: Duration::from_secs(20), @@ -350,7 +350,7 @@ impl Tool { }, projectile_body: Body::Object(object::Body::BoltFire), projectile_light: Some(LightEmitter { - col: (1.0, 0.8, 0.11).into(), + col: (0.85, 0.5, 0.11).into(), ..Default::default() }), @@ -375,7 +375,7 @@ impl Tool { }, projectile_body: Body::Object(object::Body::BoltFireBig), projectile_light: Some(LightEmitter { - col: (1.0, 0.8, 0.11).into(), + col: (1.0, 0.75, 0.11).into(), ..Default::default() }), diff --git a/common/src/states/basic_ranged.rs b/common/src/states/basic_ranged.rs index 3652c40e1e..70da464d13 100644 --- a/common/src/states/basic_ranged.rs +++ b/common/src/states/basic_ranged.rs @@ -31,9 +31,11 @@ impl CharacterBehavior for Data { handle_move(data, &mut update, 0.3); handle_jump(data, &mut update); - if self.prepare_timer < self.prepare_duration - || self.holdable && !self.exhausted && data.inputs.holding_ability_key() - { + if !self.exhausted && if self.holdable { + data.inputs.holding_ability_key() || self.prepare_timer < self.prepare_duration + } else { + self.prepare_timer < self.prepare_duration + } { // Prepare (draw the bow) update.character = CharacterState::BasicRanged(Data { prepare_timer: self.prepare_timer + Duration::from_secs_f32(data.dt.0), diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 9c6043ec02..5e6f3dc879 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,6 +1,7 @@ use crate::{ comp::{ - Alignment, Attacking, Body, CharacterState, HealthChange, HealthSource, Ori, Pos, Scale, Stats, + Alignment, Attacking, Body, CharacterState, HealthChange, HealthSource, Ori, Pos, Scale, + Stats, }, event::{EventBus, LocalEvent, ServerEvent}, sync::Uid, @@ -120,7 +121,11 @@ impl<'a> System<'a> for Sys { // TODO: remove this when there is a better way to target healing // Don't heal npc's hp - if alignment_b_maybe.map(|a| !a.is_friendly_to_players()).unwrap_or(true) && healthchange > 0.0 { + if alignment_b_maybe + .map(|a| !a.is_friendly_to_players()) + .unwrap_or(true) + && healthchange > 0.0 + { healthchange = 0.0; } diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index d257c4ed6f..d03907e483 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -256,7 +256,8 @@ impl PlayState for SessionState { } }; - let can_build = self.client + let can_build = self + .client .borrow() .state() .read_storage::()