Better Slime and Xenobiology Equipment Garbage Collection (#46961)

This commit is contained in:
Fox McCloud
2019-10-17 19:01:48 -07:00
committed by Rob Bailey
parent 47353f40e3
commit a8223c2ba3
3 changed files with 23 additions and 16 deletions
@@ -21,10 +21,11 @@ GLOBAL_LIST_EMPTY(monkey_recyclers)
GLOB.monkey_recyclers += src
/obj/machinery/monkey_recycler/Destroy()
if(src in GLOB.monkey_recyclers)
GLOB.monkey_recyclers -= src
for(var/obj/machinery/computer/camera_advanced/xenobio/console in connected)
GLOB.monkey_recyclers -= src
for(var/thing in connected)
var/obj/machinery/computer/camera_advanced/xenobio/console = thing
console.connected_recycler = null
connected.Cut()
return ..()
/obj/machinery/monkey_recycler/RefreshParts() //Ranges from 0.2 to 0.8 per monkey recycled
@@ -108,6 +108,10 @@
for (var/A in actions)
var/datum/action/AC = A
AC.Remove(src)
Target = null
Leader = null
Friends.Cut()
speech_buffer.Cut()
return ..()
/mob/living/simple_animal/slime/proc/set_colour(new_colour)
@@ -41,7 +41,7 @@
light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/camera_advanced/xenobio/Initialize()
/obj/machinery/computer/camera_advanced/xenobio/Initialize(mapload)
. = ..()
slime_place_action = new
slime_up_action = new
@@ -51,19 +51,27 @@
potion_action = new
hotkey_help = new
stored_slimes = list()
RegisterSignal(src, COMSIG_ATOM_CONTENTS_DEL, .proc/on_contents_del)
for(var/obj/machinery/monkey_recycler/recycler in GLOB.monkey_recyclers)
if(get_area(recycler.loc) == get_area(loc))
connected_recycler = recycler
connected_recycler.connected += src
/obj/machinery/computer/camera_advanced/xenobio/Destroy()
stored_slimes = null
QDEL_NULL(current_potion)
for(var/i in contents)
var/mob/living/simple_animal/slime/S = i
if(istype(S))
S.forceMove(drop_location())
for(var/thing in stored_slimes)
var/mob/living/simple_animal/slime/S = thing
S.forceMove(drop_location())
stored_slimes.Cut()
if(connected_recycler)
connected_recycler.connected -= src
connected_recycler = null
return ..()
/obj/machinery/computer/camera_advanced/xenobio/handle_atom_del(atom/A)
if(A == current_potion)
current_potion = null
if(A in stored_slimes)
stored_slimes -= A
return ..()
/obj/machinery/computer/camera_advanced/xenobio/CreateEye()
@@ -134,12 +142,6 @@
UnregisterSignal(user, COMSIG_XENO_MONKEY_CLICK_CTRL)
..()
/obj/machinery/computer/camera_advanced/xenobio/proc/on_contents_del(datum/source, atom/deleted)
if(current_potion == deleted)
current_potion = null
if(deleted in stored_slimes)
stored_slimes -= deleted
/obj/machinery/computer/camera_advanced/xenobio/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/reagent_containers/food/snacks/monkeycube))
monkeys++