Turning a few components into elements. (#12325)

* Turning a few components into elements.

* eh
This commit is contained in:
Ghom
2020-05-24 22:06:27 +02:00
committed by GitHub
parent 02f467654e
commit ce1f1bdf5e
20 changed files with 116 additions and 100 deletions

View File

@@ -2,16 +2,17 @@
name = "modified gravity zone"
setup_field_turfs = TRUE
var/gravity_value = 0
var/list/grav_components = list()
var/list/modified_turfs = list()
field_shape = FIELD_SHAPE_RADIUS_SQUARE
/datum/proximity_monitor/advanced/gravity/setup_field_turf(turf/T)
. = ..()
grav_components[T] = T.AddComponent(/datum/component/forced_gravity,gravity_value)
T.AddElement(/datum/element/forced_gravity, gravity_value)
modified_turfs[T] = gravity_value
/datum/proximity_monitor/advanced/gravity/cleanup_field_turf(turf/T)
. = ..()
var/datum/component/forced_gravity/G = grav_components[T]
grav_components -= T
if(G)
qdel(G)
if(isnull(modified_turfs[T]))
return
T.RemoveElement(/datum/element/forced_gravity, modified_turfs[T])
modified_turfs -= T