Skip to content

Commit

Permalink
Easy remove (ParadiseSS13#23476)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGamerL authored Dec 12, 2023
1 parent 1530c16 commit 9b5f0bc
Showing 1 changed file with 0 additions and 233 deletions.
233 changes: 0 additions & 233 deletions code/datums/components/proximity_monitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,172 +248,6 @@
var/obj/checker = proximity_checkers[index++]
checker.loc = T


/**
* # Advanced Proximity Monitor
*
* This component functions similar to the basic version, however it has some extra features:
*
* First of all, if the field radius is more than 1 tile, you have the option to make a distinction between inner proximity checkers, versus ones along the edge.
* You can specifiy which type of [/obj/effect/abstract/proximity_checker] objects you want to use for both inner, and edge checkers.
*
* Secondly, the advanced proximity monitor has the ability to use processing (the `process` proc). This is optional however.
* Each proximity checker object can process itself or other things on it's turf as needed. It's up to you on how you want to use it.
* Inner and edge checkers can process thing seperately. You can turn off processing for field checkers and have only edge checkers process, and vice versa.
*/
/datum/component/proximity_monitor/advanced
name = "Advanced energy field"
field_checker_type = /obj/effect/abstract/proximity_checker/advanced/inner_field
/// The type of checker object that should be used for the field edges.
var/edge_checker_type = /obj/effect/abstract/proximity_checker/advanced/edge_field
/// Make a distinction between edge checkers and field checkers seperately.
var/uses_edge_checkers = FALSE
/// Do any of the proximity_checker objects need to process things sitting on their tile?
var/requires_processing = FALSE
/// Should the main field checkers process things on their tile?
var/process_field_checkers = FALSE
/// Should the edge field checkers process things on their tile?
var/process_edge_checkers = FALSE
/// A list of proximity_checkers in the inner field. Excludes checkers on the edge of the field.
var/list/field_checkers
/// A list of proximity_checkers on the edge of the field.
var/list/edge_checkers

/datum/component/proximity_monitor/advanced/Initialize(_radius = 1, _always_active = FALSE)
. = ..()
if(requires_processing)
START_PROCESSING(SSfields, src)

/datum/component/proximity_monitor/advanced/Destroy(force, silent)
STOP_PROCESSING(SSfields, src)
QDEL_LIST_CONTENTS(field_checkers)
QDEL_LIST_CONTENTS(edge_checkers)
return ..()

/datum/component/proximity_monitor/advanced/create_prox_checkers()
if(!uses_edge_checkers)
..() // We don't need to make a distinction between field and edge checkers, use the parent.
if(process_field_checkers)
field_checkers = proximity_checkers.Copy() // Still allows for field checkers to use processing.
return

LAZYINITLIST(proximity_checkers)
LAZYINITLIST(field_checkers)
LAZYINITLIST(edge_checkers)

var/turf/parent_turf = get_turf(parent)
for(var/T in RANGE_TURFS(radius, parent_turf))
if(get_dist(T, parent_turf) == radius)
edge_checkers += create_single_prox_checker(T, edge_checker_type)
continue
field_checkers += create_single_prox_checker(T)

/datum/component/proximity_monitor/advanced/recenter_prox_checkers()
if(!uses_edge_checkers)
return ..() // We don't need to make a distinction between field and edge checkers, use the parent.

var/turf/parent_turf = get_turf(parent)
var/inner_index = 1
var/edge_index = 1

for(var/T in RANGE_TURFS(radius, parent_turf))
var/obj/checker
if(get_dist(T, parent_turf) == radius) // If it's at this distance, it's on the edge of the field.
checker = edge_checkers[edge_index++]
checker.loc = T
continue
checker = field_checkers[inner_index++]
checker.loc = T

/datum/component/proximity_monitor/advanced/process()
if(process_field_checkers)
for(var/checker in field_checkers)
process_inner_checker(checker)
if(process_edge_checkers)
for(var/checker in field_checkers)
process_edge_checker(checker)

/**
* Base proc. All processing-related actions associated with inner proximity checkers should go here.
*
* Arguments:
* * obj/effect/abstract/proximity_checker/advanced/inner_field/F - the proximity checker to process
*/
/datum/component/proximity_monitor/advanced/proc/process_inner_checker(obj/effect/abstract/proximity_checker/advanced/inner_field/F)
return

/**
* Base proc. All processing-related actions associated with edge proximity checkers should go here.
*
* Arguments:
* * obj/effect/abstract/proximity_checker/advanced/edge_field/F - the proximity checker to process
*/
/datum/component/proximity_monitor/advanced/proc/process_edge_checker(obj/effect/abstract/proximity_checker/advanced/edge_field/F)
return

/**
* Base proc. Checks if `AM` can pass the inner field checker.
*
* Arguments:
* * atom/movable/AM - the atom trying to pass the inner field checker object
* * obj/effect/abstract/proximity_checker/advanced/inner_field/F - the proximity checker object `AM` is trying to pass
* * turf/entering - the turf `AM` is entering from
*/
/datum/component/proximity_monitor/advanced/proc/inner_field_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/inner_field/F, turf/entering)
return TRUE

/**
* Base proc. Called when something crosses an inner field checker.
*
* Arguments:
* * atom/movable/AM - the atom crossing the inner field checker object
* * obj/effect/abstract/proximity_checker/advanced/inner_field/F - the proximity checker object `AM` getting crossed
*/
/datum/component/proximity_monitor/advanced/proc/inner_field_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/inner_field/F)
return TRUE

/**
* Base proc. Called when something uncrosses an inner field checker.
*
* Arguments:
* * atom/movable/AM - the atom uncrossing the inner field checker object
* * obj/effect/abstract/proximity_checker/advanced/inner_field/F - the proximity checker object `AM` getting uncrossed
*/
/datum/component/proximity_monitor/advanced/proc/inner_field_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/inner_field/F)
return TRUE

/**
* Base proc. Checks if `AM` can pass the edge field checker.
*
* Arguments:
* * atom/movable/AM - the atom trying to pass the edge field checker object
* * obj/effect/abstract/proximity_checker/advanced/edge_field/F - the proximity checker object `AM` is trying to pass
* * turf/entering - the turf `AM` is entering from
*/
/datum/component/proximity_monitor/advanced/proc/edge_field_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/edge_field/F, turf/entering)
return TRUE

/**
* Base proc. Called when something crosses an edge field checker.
*
* Arguments:
* * atom/movable/AM - the atom crossing the edge field checker object
* * obj/effect/abstract/proximity_checker/advanced/edge_field/F - the proximity checker object `AM` getting crossed
*/
/datum/component/proximity_monitor/advanced/proc/edge_field_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/edge_field/F)
return TRUE

/**
* Base proc. Called when something uncrosses an edge field checker.
*
* Arguments:
* * atom/movable/AM - the atom uncrossing the edge field checker object
* * obj/effect/abstract/proximity_checker/advanced/edge_field/F - the proximity checker object `AM` getting uncrossed
*/
/datum/component/proximity_monitor/advanced/proc/edge_field_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/edge_field/F)
return TRUE


/**
* # Basic Proximity Checker
*
Expand Down Expand Up @@ -452,70 +286,3 @@
. = ..()
if(active && AM != monitor.hasprox_receiver && !(AM in monitor.nested_receiver_locs))
monitor.hasprox_receiver.HasProximity(AM)

/**
* # Advanced Proximity Checker
*
* Like basic proximity checkers, these objects can also detect proximity.
* However these are meant for when you need to have some additional (more advanced) behavior on top of what basic proximity checkers can do.
*/
/obj/effect/abstract/proximity_checker/advanced
name = "advanced proximity checker"
/// `hasprox_receivers`s advanced proximity monitor component.
var/datum/component/proximity_monitor/advanced/advanced_monitor

/obj/effect/abstract/proximity_checker/advanced/Initialize(mapload, datum/component/proximity_monitor/advanced/P, _always_active)
advanced_monitor = P
return ..()

/obj/effect/abstract/proximity_checker/advanced/Destroy()
advanced_monitor = null
return ..()

/**
* # Inner Field Proximity Checker
*
* An advanced proximity checker object which sits on the the inner tiles of a field.
*/
/obj/effect/abstract/proximity_checker/advanced/inner_field
name = "inner field"

/obj/effect/abstract/proximity_checker/advanced/inner_field/Destroy()
advanced_monitor.field_checkers -= src
return ..()

/obj/effect/abstract/proximity_checker/advanced/inner_field/Crossed(atom/movable/AM, oldloc)
. = ..()
return advanced_monitor.inner_field_crossed(AM, src)

/obj/effect/abstract/proximity_checker/advanced/inner_field/Uncrossed(atom/movable/AM, oldloc)
. = ..()
return advanced_monitor.inner_field_uncrossed(AM, src)

/obj/effect/abstract/proximity_checker/advanced/inner_field/CanPass(atom/movable/mover, turf/target, height)
. = ..()
return advanced_monitor.inner_field_canpass(mover, src, target)

/**
* # Edge Field Proximity Checker
*
* An advanced proximity checker object which sits on the outer edge tiles of a field.
*/
/obj/effect/abstract/proximity_checker/advanced/edge_field
name = "edge field"

/obj/effect/abstract/proximity_checker/advanced/edge_field/Destroy()
advanced_monitor.edge_checkers -= src
return ..()

/obj/effect/abstract/proximity_checker/advanced/edge_field/Crossed(atom/movable/AM, oldloc)
. = ..()
return advanced_monitor.edge_field_crossed(AM, src)

/obj/effect/abstract/proximity_checker/advanced/edge_field/Uncrossed(atom/movable/AM)
. = ..()
return advanced_monitor.edge_field_uncrossed(AM, src)

/obj/effect/abstract/proximity_checker/advanced/edge_field/CanPass(atom/movable/mover, turf/target, height)
. = ..()
return advanced_monitor.edge_field_canpass(mover, src, target)

0 comments on commit 9b5f0bc

Please sign in to comment.