mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed staff RMB, bug in ranged weapon code
This commit is contained in:
parent
30619771af
commit
f77d2f06c6
@ -44,9 +44,7 @@ impl Alignment {
|
|||||||
// TODO: Remove this hack
|
// TODO: Remove this hack
|
||||||
pub fn is_friendly_to_players(&self) -> bool {
|
pub fn is_friendly_to_players(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Alignment::Npc
|
Alignment::Npc | Alignment::Tame | Alignment::Owned(_) => true,
|
||||||
| Alignment::Tame
|
|
||||||
| Alignment::Owned(_) => true,
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,18 +331,18 @@ impl Tool {
|
|||||||
},
|
},
|
||||||
BasicRanged {
|
BasicRanged {
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
holdable: true,
|
holdable: false,
|
||||||
prepare_duration: Duration::from_millis(250),
|
prepare_duration: Duration::from_millis(250),
|
||||||
recover_duration: Duration::from_millis(200),
|
recover_duration: Duration::from_millis(600),
|
||||||
projectile: Projectile {
|
projectile: Projectile {
|
||||||
hit_solid: vec![projectile::Effect::Vanish],
|
hit_solid: vec![projectile::Effect::Vanish],
|
||||||
hit_entity: vec![
|
hit_entity: vec![
|
||||||
projectile::Effect::Damage(HealthChange {
|
projectile::Effect::Damage(HealthChange {
|
||||||
// TODO: This should not be fixed (?)
|
// TODO: This should not be fixed (?)
|
||||||
amount: -2,
|
amount: -3,
|
||||||
cause: HealthSource::Projectile { owner: None },
|
cause: HealthSource::Projectile { owner: None },
|
||||||
}),
|
}),
|
||||||
projectile::Effect::RewardEnergy(100),
|
projectile::Effect::RewardEnergy(150),
|
||||||
projectile::Effect::Vanish,
|
projectile::Effect::Vanish,
|
||||||
],
|
],
|
||||||
time_left: Duration::from_secs(20),
|
time_left: Duration::from_secs(20),
|
||||||
@ -350,7 +350,7 @@ impl Tool {
|
|||||||
},
|
},
|
||||||
projectile_body: Body::Object(object::Body::BoltFire),
|
projectile_body: Body::Object(object::Body::BoltFire),
|
||||||
projectile_light: Some(LightEmitter {
|
projectile_light: Some(LightEmitter {
|
||||||
col: (1.0, 0.8, 0.11).into(),
|
col: (0.85, 0.5, 0.11).into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ impl Tool {
|
|||||||
},
|
},
|
||||||
projectile_body: Body::Object(object::Body::BoltFireBig),
|
projectile_body: Body::Object(object::Body::BoltFireBig),
|
||||||
projectile_light: Some(LightEmitter {
|
projectile_light: Some(LightEmitter {
|
||||||
col: (1.0, 0.8, 0.11).into(),
|
col: (1.0, 0.75, 0.11).into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -31,9 +31,11 @@ impl CharacterBehavior for Data {
|
|||||||
handle_move(data, &mut update, 0.3);
|
handle_move(data, &mut update, 0.3);
|
||||||
handle_jump(data, &mut update);
|
handle_jump(data, &mut update);
|
||||||
|
|
||||||
if self.prepare_timer < self.prepare_duration
|
if !self.exhausted && if self.holdable {
|
||||||
|| self.holdable && !self.exhausted && data.inputs.holding_ability_key()
|
data.inputs.holding_ability_key() || self.prepare_timer < self.prepare_duration
|
||||||
{
|
} else {
|
||||||
|
self.prepare_timer < self.prepare_duration
|
||||||
|
} {
|
||||||
// Prepare (draw the bow)
|
// Prepare (draw the bow)
|
||||||
update.character = CharacterState::BasicRanged(Data {
|
update.character = CharacterState::BasicRanged(Data {
|
||||||
prepare_timer: self.prepare_timer + Duration::from_secs_f32(data.dt.0),
|
prepare_timer: self.prepare_timer + Duration::from_secs_f32(data.dt.0),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
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},
|
event::{EventBus, LocalEvent, ServerEvent},
|
||||||
sync::Uid,
|
sync::Uid,
|
||||||
@ -120,7 +121,11 @@ impl<'a> System<'a> for Sys {
|
|||||||
|
|
||||||
// TODO: remove this when there is a better way to target healing
|
// TODO: remove this when there is a better way to target healing
|
||||||
// Don't heal npc's hp
|
// 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;
|
healthchange = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,8 @@ impl PlayState for SessionState {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let can_build = self.client
|
let can_build = self
|
||||||
|
.client
|
||||||
.borrow()
|
.borrow()
|
||||||
.state()
|
.state()
|
||||||
.read_storage::<comp::CanBuild>()
|
.read_storage::<comp::CanBuild>()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user