Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Nov 20, 2023
1 parent fd1373b commit 1bd8b4f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/ai/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var/turf/current_target_turf

var/ai_move_delay = 0
var/path_update_period = 0.5 SECONDS
var/path_update_period = (0.5 SECONDS)
var/no_path_found = FALSE
var/ai_range = 16
var/max_travel_distance = 24
Expand All @@ -25,6 +25,12 @@
/// The actual cooldown declaration for forceful retargeting, reference forced_retarget_time for time in between checks
COOLDOWN_DECLARE(forced_retarget_cooldown)

/// The time interval between calculating new paths if we cannot find a path
var/no_path_found_period = (2.5 SECONDS)

/// Cooldown declaration for delaying finding a new path if no path was found
COOLDOWN_DECLARE(no_path_found_cooldown)

/mob/living/carbon/xenomorph/Destroy()
QDEL_NULL(ai_movement_handler)
return ..()
Expand Down Expand Up @@ -166,10 +172,11 @@
return FALSE

if(no_path_found)
COOLDOWN_START(src, no_path_found_cooldown, no_path_found_period)
no_path_found = FALSE
return FALSE

if(!current_path || (next_path_generation < world.time && current_target_turf != T))
if((!current_path || (next_path_generation < world.time && current_target_turf != T)) && COOLDOWN_FINISHED(src, no_path_found_cooldown))
if(!XENO_CALCULATING_PATH(src) || current_target_turf != T)
SSxeno_pathfinding.calculate_path(src, T, max_range, src, CALLBACK(src, PROC_REF(set_path)), list(src, current_target))
current_target_turf = T
Expand Down

0 comments on commit 1bd8b4f

Please sign in to comment.