Fixes railings and bot pathing (#18692)

* fixes railing bot pathing

* lol railing corners

* charlie optimisation

* AA
This commit is contained in:
S34N
2022-08-04 14:20:36 +01:00
committed by GitHub
parent b27a8e9d57
commit 3ff30d5067
2 changed files with 29 additions and 16 deletions
+23 -11
View File
@@ -8,6 +8,7 @@
pass_flags = LETPASSTHROW
climbable = TRUE
layer = ABOVE_MOB_LAYER
flags = ON_BORDER
var/currently_climbed = FALSE
var/mover_dir = null
@@ -60,6 +61,9 @@
/obj/structure/railing/corner/CanPass()
return TRUE
/obj/structure/railing/corner/CanAStarPass(ID, to_dir, caller)
return TRUE
/obj/structure/railing/corner/CheckExit()
return TRUE
@@ -76,12 +80,20 @@
return TRUE
mover_dir = get_dir(loc, target)
//Due to how the other check is done, it would always return density for ordinal directions no matter what
if(ordinal_direction_check())
if(ordinal_direction_check(mover_dir))
return FALSE
if(mover_dir != dir)
return density
return FALSE
/obj/structure/railing/CanAStarPass(ID, to_dir, caller)
if(to_dir == dir)
return FALSE
if(ordinal_direction_check(to_dir))
return FALSE
return TRUE
/obj/structure/railing/CheckExit(atom/movable/O, target)
var/mob/living/M = O
if(istype(O) && O.checkpass(PASSFENCE))
@@ -100,24 +112,24 @@
mover_dir = get_dir(O.loc, target)
if(mover_dir == dir)
return FALSE
if(ordinal_direction_check())
if(ordinal_direction_check(mover_dir))
return FALSE
return TRUE
// Checks if the direction the mob is trying to move towards would be blocked by a corner railing
/obj/structure/railing/proc/ordinal_direction_check()
/obj/structure/railing/proc/ordinal_direction_check(check_dir)
switch(dir)
if(5)
if(mover_dir == 1 || mover_dir == 4)
if(NORTHEAST)
if(check_dir == NORTH || check_dir == EAST)
return TRUE
if(6)
if(mover_dir == 2 || mover_dir == 4)
if(SOUTHEAST)
if(check_dir == SOUTH || check_dir == EAST)
return TRUE
if(9)
if(mover_dir == 1 || mover_dir == 8)
if(NORTHWEST)
if(check_dir == NORTH || check_dir == WEST)
return TRUE
if(10)
if(mover_dir == 2 || mover_dir == 8)
if(SOUTHWEST)
if(check_dir == SOUTH || check_dir == WEST)
return TRUE
return FALSE