mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'scott-c/wield-changes' into 'master'
Scott c/wield changes See merge request veloren/veloren!1072
This commit is contained in:
commit
c22f9530e4
@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed a crash caused by certain audio devices on OSX
|
||||
- Bow animations now show held arrows
|
||||
- Fixed a bug where walk/run sfx played while a character rolled/dodged
|
||||
- Energy regen resets on last ability use instead of on wield
|
||||
- Fixed unable to use ability; Secondary and ability3 (fire rod) will now automatically wield
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -11,7 +11,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_wield(data, &mut update);
|
||||
|
||||
// Try to Fall/Stand up/Move
|
||||
if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 {
|
||||
|
@ -12,7 +12,7 @@ impl CharacterBehavior for Data {
|
||||
|
||||
handle_move(data, &mut update, 1.0);
|
||||
handle_jump(data, &mut update);
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_wield(data, &mut update);
|
||||
handle_climb(data, &mut update);
|
||||
handle_glide(data, &mut update);
|
||||
handle_dodge_input(data, &mut update);
|
||||
|
@ -11,7 +11,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_wield(data, &mut update);
|
||||
|
||||
// Try to Fall/Stand up/Move
|
||||
if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 {
|
||||
|
@ -96,10 +96,13 @@ fn swim_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||
}
|
||||
}
|
||||
|
||||
/// First checks whether `primary` input is pressed, then
|
||||
/// attempts to go into Equipping state, otherwise Idle
|
||||
pub fn handle_primary_wield(data: &JoinData, update: &mut StateUpdate) {
|
||||
if data.inputs.primary.is_pressed() {
|
||||
/// First checks whether `primary`, `secondary` or `ability3` input is pressed,
|
||||
/// then attempts to go into Equipping state, otherwise Idle
|
||||
pub fn handle_wield(data: &JoinData, update: &mut StateUpdate) {
|
||||
if data.inputs.primary.is_pressed()
|
||||
|| data.inputs.secondary.is_pressed()
|
||||
|| data.inputs.ability3.is_pressed()
|
||||
{
|
||||
attempt_wield(data, update);
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +75,15 @@ impl<'a> System<'a> for Sys {
|
||||
.set_to(stat.health.maximum(), HealthSource::LevelUp);
|
||||
}
|
||||
|
||||
// Accelerate recharging energy if not wielding.
|
||||
match character_state {
|
||||
CharacterState::Idle { .. } | CharacterState::Sit { .. } => {
|
||||
// Accelerate recharging energy.
|
||||
CharacterState::Idle { .. }
|
||||
| CharacterState::Sit { .. }
|
||||
| CharacterState::Dance { .. }
|
||||
| CharacterState::Glide { .. }
|
||||
| CharacterState::Wielding { .. }
|
||||
| CharacterState::Equipping { .. }
|
||||
| CharacterState::Boost { .. } => {
|
||||
let res = {
|
||||
let energy = energy.get_unchecked();
|
||||
energy.current() < energy.maximum()
|
||||
@ -95,13 +101,19 @@ impl<'a> System<'a> for Sys {
|
||||
(energy.regen_rate + ENERGY_REGEN_ACCEL * dt.0).min(100.0);
|
||||
}
|
||||
},
|
||||
// Wield does not regen and sets the rate back to zero.
|
||||
CharacterState::Wielding { .. } => {
|
||||
// Ability use does not regen and sets the rate back to zero.
|
||||
CharacterState::BasicMelee { .. }
|
||||
| CharacterState::DashMelee { .. }
|
||||
| CharacterState::TripleStrike { .. }
|
||||
| CharacterState::BasicRanged { .. }
|
||||
| CharacterState::BasicBlock { .. } => {
|
||||
if energy.get_unchecked().regen_rate != 0.0 {
|
||||
energy.get_mut_unchecked().regen_rate = 0.0
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
// Non-combat abilities that consume energy;
|
||||
// temporarily stall energy gain, but preserve regen_rate.
|
||||
CharacterState::Roll { .. } | CharacterState::Climb { .. } => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user