Remove Uncross() and CheckExit(), add connect_loc element to cover the cases we used it for (#58188)

* Remove Uncross(), add create_loc element

* Update on ChangeTurf

* Explicit return

* Hold onto elements and remove TEST_FOCUS

* Remove UNIT_TESTS compile flag

* Follow my own advice.

* Comment about Uncross + CRASH

* Remove /atom/Exit ..()

* Apply suggestions from code review

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>

* Use keyed locs

* Re-add Bump()

* Superfluous check

* Correct change turf signal, remove old continue check

* Fix compile failure

* Fix tests

* Don't create element for fulltile windows

* Correctly unregister old location

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
Mothblocks
2021-04-08 15:52:00 -04:00
committed by GitHub
co-authored by Emmett Gaines
parent a7defcd22d
commit 0d24cdea3c
19 changed files with 301 additions and 101 deletions
+18 -6
View File
@@ -68,6 +68,13 @@
flags_1 |= ALLOW_DARK_PAINTS_1
RegisterSignal(src, COMSIG_OBJ_PAINTED, .proc/on_painted)
var/static/list/loc_connections = list(
COMSIG_ATOM_EXIT = .proc/on_exit,
)
if (flags_1 & ON_BORDER_1)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/window/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation))
@@ -117,13 +124,18 @@
return TRUE
/obj/structure/window/CheckExit(atom/movable/O, turf/target)
if(istype(O) && (O.pass_flags & pass_flags_self))
return TRUE
if(!fulltile && get_dir(O.loc, target) == dir)
return !density
return TRUE
/obj/structure/window/proc/on_exit(datum/source, atom/movable/leaving, atom/new_location)
SIGNAL_HANDLER
if (istype(leaving) && (leaving.pass_flags & pass_flags_self))
return
if (fulltile)
return
if(get_dir(leaving.loc, new_location) == dir && density)
leaving.Bump(src)
return COMPONENT_ATOM_BLOCK_EXIT
/obj/structure/window/attack_tk(mob/user)
user.changeNext_move(CLICK_CD_MELEE)