Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes xenos pathing to unreachable target #354

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading