Skip to content

Commit

Permalink
timer better resets itself
Browse files Browse the repository at this point in the history
  • Loading branch information
Halonexus committed Apr 28, 2024
1 parent 8bdced2 commit e16ebb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/modules/mob/living/simple_animal/hostile/hostile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,9 @@
if(!client && AIStatus == AI_ON && target && !attack_is_on_cooldown)
TryAttack()

/mob/living/simple_animal/hostile/proc/TryAttack()
/mob/living/simple_animal/hostile/proc/TryAttack(called_by_timer = FALSE)
if(called_by_timer)
attack_timer_id = null
if(client || stat != CONSCIOUS || AIStatus != AI_ON || incapacitated() || !targets_from || !isturf(targets_from.loc))
attack_is_on_cooldown = FALSE
if(attack_timer_id)
Expand Down Expand Up @@ -598,7 +600,7 @@
else
attack_is_on_cooldown = FALSE
if(!attack_timer_id)
attack_timer_id = addtimer(CALLBACK(src, PROC_REF(TryAttack)), attack_cooldown, TIMER_STOPPABLE)
attack_timer_id = addtimer(CALLBACK(src, PROC_REF(TryAttack), TRUE), attack_cooldown, TIMER_STOPPABLE)

// Called by automated_action and causes the AI to go idle if it returns false. This proc is pretty big.
/mob/living/simple_animal/hostile/proc/MoveToTarget(list/possible_targets)
Expand Down

0 comments on commit e16ebb8

Please sign in to comment.