mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Code cleanup
This commit is contained in:
parent
e29a9f4e36
commit
c83ec87d6a
@ -54,11 +54,9 @@ pub struct Poise {
|
||||
/// Rate of poise regeneration per tick. Starts at zero and accelerates.
|
||||
pub regen_rate: f32,
|
||||
/// Time that entity was last in a poise state
|
||||
pub last_stun_time: Option<Time>,
|
||||
last_stun_time: Option<Time>,
|
||||
/// The previous poise state
|
||||
pub previous_state: PoiseState,
|
||||
/// Next threshold for the poise change
|
||||
next_threshold: f32,
|
||||
}
|
||||
|
||||
/// States to define effects of a poise change
|
||||
@ -164,9 +162,6 @@ impl Poise {
|
||||
/// Returns the current value of poise casted to a float
|
||||
pub fn current(&self) -> f32 { self.current as f32 / Self::SCALING_FACTOR_FLOAT }
|
||||
|
||||
/// Returns the next threshold of poise
|
||||
pub fn next_threshold(&self) -> f32 { self.next_threshold }
|
||||
|
||||
/// Returns the base maximum value of poise casted to a float
|
||||
pub fn base_max(&self) -> f32 { self.base_max as f32 / Self::SCALING_FACTOR_FLOAT }
|
||||
|
||||
@ -196,7 +191,6 @@ impl Poise {
|
||||
last_change: Dir::default(),
|
||||
regen_rate: 0.0,
|
||||
last_stun_time: None,
|
||||
next_threshold: self::Poise::POISE_THRESHOLDS[0],
|
||||
previous_state: PoiseState::Normal,
|
||||
}
|
||||
}
|
||||
@ -213,10 +207,6 @@ impl Poise {
|
||||
* Self::SCALING_FACTOR_FLOAT) as u32)
|
||||
.min(self.maximum);
|
||||
self.last_change = Dir::from_unnormalized(change.impulse).unwrap_or_default();
|
||||
self.next_threshold = *self::Poise::POISE_THRESHOLDS
|
||||
.iter()
|
||||
.find(|&&threshold| self.current() > threshold)
|
||||
.unwrap_or(&self::Poise::POISE_THRESHOLDS[0]);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -21,14 +21,11 @@ use i18n::Localization;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use client::{self, Client};
|
||||
use common::{
|
||||
comp::{
|
||||
self,
|
||||
ability::AbilityInput,
|
||||
item::{ItemDesc, MaterialStatManifest},
|
||||
Ability, ActiveAbilities, Body, Energy, Health, Inventory, Poise, PoiseState, SkillSet,
|
||||
},
|
||||
resources::Time,
|
||||
use common::comp::{
|
||||
self,
|
||||
ability::AbilityInput,
|
||||
item::{ItemDesc, MaterialStatManifest},
|
||||
Ability, ActiveAbilities, Body, Energy, Health, Inventory, Poise, PoiseState, SkillSet,
|
||||
};
|
||||
use conrod_core::{
|
||||
color,
|
||||
@ -485,21 +482,6 @@ impl<'a> Skillbar<'a> {
|
||||
state.ids.poise_tick_4,
|
||||
];
|
||||
|
||||
// println!(.poise
|
||||
// .last_stun_time
|
||||
// .unwrap_or(Time(self::Poise::POISE_BUFFER_TIME))
|
||||
// .0);
|
||||
// let poise_state = if self
|
||||
// .poise
|
||||
// .last_stun_time
|
||||
// .unwrap_or(Time(self::Poise::POISE_BUFFER_TIME))
|
||||
// .0
|
||||
// >= 2.0
|
||||
// {
|
||||
// self.poise.poise_state()
|
||||
// } else {
|
||||
// self.poise.previous_state
|
||||
// };
|
||||
let poise_colour = match self.poise.previous_state {
|
||||
self::PoiseState::KnockedDown => BLACK,
|
||||
self::PoiseState::Dazed => Color::Rgba(0.25, 0.0, 0.15, 1.0),
|
||||
@ -520,8 +502,6 @@ impl<'a> Skillbar<'a> {
|
||||
.color(Some(poise_colour))
|
||||
.top_left_with_margins_on(state.ids.poise_alignment, 0.0, 0.0)
|
||||
.set(state.ids.poise_filling, ui);
|
||||
// (ui.widget_graph().node(state.ids.poise_filling).unwrap().clone() as
|
||||
// Image).color(color) ;
|
||||
for (i, threshold) in self::Poise::POISE_THRESHOLDS.iter().enumerate() {
|
||||
Image::new(self.imgs.poise_tick)
|
||||
.w_h(3.0, 10.0)
|
||||
|
Loading…
Reference in New Issue
Block a user