Skip to content

Commit

Permalink
Fixes xenos pathing to unreachable target (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doubleumc authored Aug 9, 2024
1 parent 1c527e0 commit ed6c6a1
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions code/modules/mob/living/carbon/xenomorph/ai/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

var/ai_move_delay = 0
var/path_update_period = (0.5 SECONDS)
var/no_path_found = FALSE
var/ai_range = 16
var/max_travel_distance = 24

Expand All @@ -25,9 +24,6 @@
/// The actual cooldown declaration for forceful retargeting, reference forced_retarget_time for time in between checks
COOLDOWN_DECLARE(forced_retarget_cooldown)

/// Amount of times no path found has occured
var/no_path_found_amount = 0

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

Expand Down Expand Up @@ -162,22 +158,12 @@
/mob/living/carbon/xenomorph/proc/set_path(list/path)
current_path = path
if(!path)
no_path_found = TRUE
COOLDOWN_START(src, no_path_found_cooldown, no_path_found_period)

/mob/living/carbon/xenomorph/proc/move_to_next_turf(turf/T, max_range = ai_range)
if(!T)
return FALSE

if(no_path_found)

if(no_path_found_amount > 0)
COOLDOWN_START(src, no_path_found_cooldown, no_path_found_period)
no_path_found = FALSE
no_path_found_amount++
return FALSE

no_path_found_amount = 0

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))
Expand Down

0 comments on commit ed6c6a1

Please sign in to comment.