mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 04:21:42 +00:00
Enter(), Entered(), Exit() and Exited() all passed the old loc forward, but everything except a single a case cared about the direction of the movement more than about the specific source. Since moving multi-tile objects will have multiple sources of movement but a single direction, this change makes it easier to track their movement. Cleaned up a lot of code around and made proc inputs compatible. I'll add opacity support for multi-tile objects in a different PR after this is merged, as this has grown large enough and I don't want to compromise the reviewability. Tested this locally and as expected it didn't impair movement nor produced any runtimes.
71 lines
2.2 KiB
Plaintext
71 lines
2.2 KiB
Plaintext
|
|
/obj/effect/abstract/proximity_checker/advanced
|
|
name = "field"
|
|
desc = "Why can you see energy fields?!"
|
|
icon = null
|
|
icon_state = null
|
|
alpha = 0
|
|
invisibility = INVISIBILITY_ABSTRACT
|
|
flags_1 = ON_BORDER_1
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
var/datum/proximity_monitor/advanced/parent = null
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/Initialize(mapload, _monitor)
|
|
if(_monitor)
|
|
parent = _monitor
|
|
. = ..()
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/center
|
|
name = "field anchor"
|
|
desc = "No."
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_turf
|
|
name = "energy field"
|
|
desc = "Get off my turf!"
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/AM, turf/target)
|
|
. = ..()
|
|
if(parent)
|
|
return parent.field_turf_canpass(AM, src, target)
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_turf/on_entered(datum/source, atom/movable/AM)
|
|
. = ..()
|
|
if(parent)
|
|
return parent.field_turf_crossed(AM, src)
|
|
return TRUE
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_turf/on_uncrossed(datum/source, atom/movable/gone, direction)
|
|
. = ..()
|
|
if(parent)
|
|
return parent.field_turf_uncrossed(gone, src)
|
|
return TRUE
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_edge
|
|
name = "energy field edge"
|
|
desc = "Edgy description here."
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/AM, turf/target)
|
|
. = ..()
|
|
if(parent)
|
|
return parent.field_edge_canpass(AM, src, target)
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_edge/on_entered(datum/source, atom/movable/AM)
|
|
. = ..()
|
|
if(parent)
|
|
return parent.field_edge_crossed(AM, src)
|
|
return TRUE
|
|
|
|
/obj/effect/abstract/proximity_checker/advanced/field_edge/on_uncrossed(datum/source, atom/movable/gone, direction)
|
|
if(parent)
|
|
return parent.field_edge_uncrossed(gone, src)
|
|
return TRUE
|
|
|
|
/proc/is_turf_in_field(turf/T, datum/proximity_monitor/advanced/F) //Looking for ways to optimize this!
|
|
for(var/obj/effect/abstract/proximity_checker/advanced/O in T)
|
|
if(istype(O, /obj/effect/abstract/proximity_checker/advanced/field_edge))
|
|
if(O.parent == F)
|
|
return FIELD_EDGE
|
|
if(O.parent == F)
|
|
return FIELD_TURF
|
|
return FALSE
|