mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 00:23:29 +01:00
Make directional windows and windoors solid (#24484)
* Refactor away the useless checks of moving_diagonally. * Single-directional windows and windoors now collide properly. * Update code/game/objects/structures/window.dm Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> * Allow exiting fulltile windows to north and east again. --------- Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
This commit is contained in:
+10
-12
@@ -212,45 +212,43 @@
|
||||
else //Diagonal move, split it into cardinal moves
|
||||
moving_diagonally = FIRST_DIAG_STEP
|
||||
var/first_step_dir
|
||||
// The `&& moving_diagonally` checks are so that a forceMove taking
|
||||
// place due to a Crossed, Bumped, etc. call will interrupt
|
||||
// the second half of the diagonal movement, or the second attempt
|
||||
// at a first half if the cardinal Move() fails because we hit something.
|
||||
// For each diagonal direction, we try moving NORTH/SOUTH first, and if it fails, we try moving EAST/WEST first.
|
||||
// As long as either succeeds, we try the other.
|
||||
if(direct & NORTH)
|
||||
if(direct & EAST)
|
||||
if(Move(get_step(src, NORTH), NORTH) && moving_diagonally)
|
||||
if(Move(get_step(src, NORTH), NORTH))
|
||||
first_step_dir = NORTH
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, EAST), EAST)
|
||||
else if(moving_diagonally && Move(get_step(src, EAST), EAST))
|
||||
else if(Move(get_step(src, EAST), EAST))
|
||||
first_step_dir = EAST
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, NORTH), NORTH)
|
||||
else if(direct & WEST)
|
||||
if(Move(get_step(src, NORTH), NORTH) && moving_diagonally)
|
||||
if(Move(get_step(src, NORTH), NORTH))
|
||||
first_step_dir = NORTH
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, WEST), WEST)
|
||||
else if(moving_diagonally && Move(get_step(src, WEST), WEST))
|
||||
else if(Move(get_step(src, WEST), WEST))
|
||||
first_step_dir = WEST
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, NORTH), NORTH)
|
||||
else if(direct & SOUTH)
|
||||
if(direct & EAST)
|
||||
if(Move(get_step(src, SOUTH), SOUTH) && moving_diagonally)
|
||||
if(Move(get_step(src, SOUTH), SOUTH))
|
||||
first_step_dir = SOUTH
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, EAST), EAST)
|
||||
else if(moving_diagonally && Move(get_step(src, EAST), EAST))
|
||||
else if(Move(get_step(src, EAST), EAST))
|
||||
first_step_dir = EAST
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, SOUTH), SOUTH)
|
||||
else if(direct & WEST)
|
||||
if(Move(get_step(src, SOUTH), SOUTH) && moving_diagonally)
|
||||
if(Move(get_step(src, SOUTH), SOUTH))
|
||||
first_step_dir = SOUTH
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, WEST), WEST)
|
||||
else if(moving_diagonally && Move(get_step(src, WEST), WEST))
|
||||
else if(Move(get_step(src, WEST), WEST))
|
||||
first_step_dir = WEST
|
||||
moving_diagonally = SECOND_DIAG_STEP
|
||||
. = Move(get_step(src, SOUTH), SOUTH)
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
return 1
|
||||
if(dir == FULLTILE_WINDOW_DIR)
|
||||
return 0 //full tile window, you can't move into it!
|
||||
if(get_dir(loc, target) == dir)
|
||||
if(get_dir(loc, target) & dir)
|
||||
return !density
|
||||
if(istype(mover, /obj/structure/window))
|
||||
var/obj/structure/window/W = mover
|
||||
@@ -126,15 +126,17 @@
|
||||
|
||||
/obj/structure/window/CheckExit(atom/movable/O, target)
|
||||
if(istype(O) && O.checkpass(PASSGLASS))
|
||||
return 1
|
||||
if(get_dir(O.loc, target) == dir)
|
||||
return 0
|
||||
return 1
|
||||
return TRUE
|
||||
if(dir == FULLTILE_WINDOW_DIR)
|
||||
return TRUE
|
||||
if(get_dir(O.loc, target) & dir)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/structure/window/CanPathfindPass(obj/item/card/id/ID, to_dir, atom/movable/caller, no_id = FALSE)
|
||||
if(!density)
|
||||
return 1
|
||||
if((dir == FULLTILE_WINDOW_DIR) || (dir == to_dir) || fulltile)
|
||||
if((dir == FULLTILE_WINDOW_DIR) || (dir & to_dir) || fulltile)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
@@ -414,7 +416,7 @@
|
||||
/obj/structure/window/CanAtmosPass(turf/T)
|
||||
if(!anchored || !density)
|
||||
return TRUE
|
||||
return !(FULLTILE_WINDOW_DIR == dir || dir == get_dir(loc, T))
|
||||
return !(FULLTILE_WINDOW_DIR == dir || (dir & get_dir(loc, T)))
|
||||
|
||||
//This proc is used to update the icons of nearby windows.
|
||||
/obj/structure/window/proc/update_nearby_icons()
|
||||
|
||||
Reference in New Issue
Block a user