Make action durations constants

This commit is contained in:
timokoesters 2019-08-26 20:05:30 +02:00
parent 869535e5a2
commit 72564cf8b4
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097
3 changed files with 12 additions and 3 deletions

View File

@ -8,6 +8,9 @@ use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage};
use std::time::Duration;
use vek::*;
pub const WIELD_DURATION: Duration = Duration::from_millis(300);
pub const ATTACK_DURATION: Duration = Duration::from_millis(300);
const BASE_DMG: i32 = 10;
const BLOCK_EFFICIENCY: f32 = 0.9;

View File

@ -1,3 +1,7 @@
use super::{
combat::{ATTACK_DURATION, WIELD_DURATION},
movement::ROLL_DURATION,
};
use crate::{
comp::{
ActionState::*, Body, CharacterState, Controller, MovementState::*, PhysicsState, Stats,
@ -97,7 +101,7 @@ impl<'a> System<'a> for Sys {
&& (character.movement == Stand || character.movement == Run)
{
character.action = Wield {
time_left: Duration::from_millis(300),
time_left: WIELD_DURATION,
};
}
@ -111,7 +115,7 @@ impl<'a> System<'a> for Sys {
if let Wield { time_left } = character.action {
if time_left == Duration::default() {
character.action = Attack {
time_left: Duration::from_millis(300),
time_left: ATTACK_DURATION,
applied: false,
};
}
@ -137,7 +141,7 @@ impl<'a> System<'a> for Sys {
&& physics.on_ground
{
character.movement = Roll {
time_left: Duration::from_millis(600),
time_left: ROLL_DURATION,
};
}

View File

@ -11,6 +11,8 @@ use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, WriteStorage}
use std::time::Duration;
use vek::*;
pub const ROLL_DURATION: Duration = Duration::from_millis(600);
const HUMANOID_ACCEL: f32 = 70.0;
const HUMANOID_SPEED: f32 = 120.0;
const WIELD_ACCEL: f32 = 70.0;