pub struct EntityActionsQueue { /* private fields */ }Implementations§
Source§impl EntityActionsQueue
impl EntityActionsQueue
pub fn new(entity_id: EntityId) -> Self
pub fn push(&mut self, action_with_deadline: &ActionWithDeadline)
pub fn append_start_cast_ability_result_actions( &mut self, actions_with_deadlines: &Vec<ActionWithDeadline>, current_tick: u64, ability_id: AbilityId, ability_cooldown: u64, )
pub fn pop(&mut self, current_tick: u64) -> Option<EntityAction>
pub fn remove_start_cast_ability_action( &mut self, ability_id_to_remove: AbilityId, )
pub fn remove_cast_effect_action(&mut self, effect_id_to_remove: EffectId)
pub fn get_closest_start_cast_action_deadline(&self) -> Option<u64>
Sourcepub fn rescale_cooldowns(
&mut self,
old_speed: i64,
new_speed: i64,
current_tick: u64,
baseline_speed: u64,
)
pub fn rescale_cooldowns( &mut self, old_speed: i64, new_speed: i64, current_tick: u64, baseline_speed: u64, )
Rescales every StartCastAbility (cooldown) entry in the queue to reflect a change in
the entity’s speed attribute.
At speed S, a cooldown that was originally C ticks long elapses in C * baseline / S
game-ticks. So when speed changes from S_old to S_new, the still-remaining game-ticks
for each in-flight cooldown become (deadline - current_tick) * S_old / S_new.
baseline_speed falls in for non-positive speed values.
In-flight casts (CastAbility / CastBasicAbility cast animations) are intentionally not
touched here — speed scales cooldowns, not cast time.
Sourcepub fn stun_ability(
&mut self,
ability_id: AbilityId,
duration_ticks: u64,
full_cooldown_ticks: u64,
current_tick: u64,
)
pub fn stun_ability( &mut self, ability_id: AbilityId, duration_ticks: u64, full_cooldown_ticks: u64, current_tick: u64, )
Applies stun semantics to a single ability:
- If the ability is currently mid-cast (
CastAbility/CastBasicAbilityqueued), cancels the cast and sets the cooldown deadline tocurrent_tick + full_cooldown_ticks + duration_ticks— full cooldown plus the stun freeze on top. - Otherwise, if the ability already has a cooldown entry, extends its deadline by
duration_ticks(the cooldown effectively pauses for the stun duration). - Otherwise (off cooldown), pushes a fresh cooldown entry of
duration_ticksso the ability stays unusable while stunned.
full_cooldown_ticks is the ability’s full cooldown (already scaled for entity speed if
the caller wants speed to apply).
Sourcepub fn cancel_cast_and_set_cooldown(
&mut self,
ability_id_to_cancel: AbilityId,
new_deadline_tick: u64,
) -> bool
pub fn cancel_cast_and_set_cooldown( &mut self, ability_id_to_cancel: AbilityId, new_deadline_tick: u64, ) -> bool
Cancels any in-flight cast (CastAbility / CastBasicAbility) for ability_id_to_cancel
and replaces the cooldown entry (StartCastAbility) with a new one at new_deadline_tick.
Returns true when an in-flight cast was found and removed.
Sourcepub fn adjust_ability_cooldown(
&mut self,
ability_id_to_adjust: AbilityId,
delta_ticks: i64,
current_tick: u64,
) -> bool
pub fn adjust_ability_cooldown( &mut self, ability_id_to_adjust: AbilityId, delta_ticks: i64, current_tick: u64, ) -> bool
Adjusts the cooldown for a specific ability by delta_ticks.
Positive delta extends the cooldown, negative shortens it (saturating at current_tick,
i.e. no remaining cooldown). Returns true when an entry was found and adjusted.
pub fn view(&self) -> HashMap<ActionPriority, Vec<ActionWithDeadline>>
Trait Implementations§
Source§impl Clone for EntityActionsQueue
impl Clone for EntityActionsQueue
Source§fn clone(&self) -> EntityActionsQueue
fn clone(&self) -> EntityActionsQueue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more