From 663db0684460bd4c0b6f5f15c1cf6fba73ac2a74 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 9 Mar 2023 21:03:08 -0500 Subject: [PATCH] Made auras no longer need to be mutably accessed every tick. --- common/src/comp/ability.rs | 4 +-- common/src/comp/aura.rs | 20 ++++++++------- common/src/states/basic_aura.rs | 3 ++- common/systems/src/aura.rs | 30 ++++++++-------------- server/src/cmd.rs | 3 +++ server/src/events/entity_creation.rs | 4 +++ server/src/state_ext.rs | 2 ++ voxygen/egui/src/lib.rs | 6 +++-- voxygen/src/scene/particle.rs | 37 +++++++++++++++++++--------- 9 files changed, 64 insertions(+), 45 deletions(-) diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 8b6b5a1714..cbd243b179 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -696,7 +696,7 @@ pub enum CharacterAbility { recover_duration: f32, targets: combat::GroupTarget, auras: Vec, - aura_duration: f32, + aura_duration: f64, range: f32, energy_cost: f32, scales_with_combo: bool, @@ -2602,7 +2602,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState { recover_duration: Duration::from_secs_f32(*recover_duration), targets: *targets, auras: auras.clone(), - aura_duration: Duration::from_secs_f32(*aura_duration), + aura_duration: *aura_duration, range: *range, ability_info, scales_with_combo: *scales_with_combo, diff --git a/common/src/comp/aura.rs b/common/src/comp/aura.rs index a6d9558650..8b95bd02c0 100644 --- a/common/src/comp/aura.rs +++ b/common/src/comp/aura.rs @@ -1,12 +1,12 @@ use crate::{ combat::GroupTarget, comp::buff::{BuffCategory, BuffData, BuffKind, BuffSource}, + resources::Time, uid::Uid, }; use serde::{Deserialize, Serialize}; use slotmap::{new_key_type, SlotMap}; use specs::{Component, DerefFlaggedStorage, VecStorage}; -use std::time::Duration; new_key_type! { pub struct AuraKey; } @@ -36,8 +36,8 @@ pub struct Aura { pub aura_kind: AuraKind, /// The radius of the aura pub radius: f32, - /// How long the aura lasts. None corresponds to an indefinite length - pub duration: Option, + // None corresponds to an indefinite aura + pub end_time: Option