From e2726d676e67f68b512fdb68ca34bad062aa90c1 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 28 Jan 2021 03:07:34 +0100 Subject: [PATCH] [MIRROR] Fixes minor logging issue with hydroponics trays (#2922) * Fixes minor logging issue with hydroponics trays (#56381) Hydroponics trays have a var, lastuser, that it's supposed to use in logging as the last person who modified a tray's reagents this variable was only set if you transferred reagents to the tray via composting, so it was null 99% of the time. The var is now set when any reagents are transferred and the logging for spawning spiders now uses this var. The var is now a weakref, to prevent hydroponics trays from harddels. "null last modified a tray's contents that spawned spiderlings." Not very helpful to admins, is it. * Fixes minor logging issue with hydroponics trays Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- code/modules/hydroponics/hydroponics.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 569b62d4268..e568dc15976 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -49,7 +49,7 @@ ///Have we been visited by a bee recently, so bees dont overpollinate one plant var/recent_bee_visit = FALSE ///The last user to add a reagent to the tray, mostly for logging purposes. - var/mob/lastuser + var/datum/weakref/lastuser ///If the tray generates nutrients and water on its own var/self_sustaining = FALSE @@ -153,7 +153,7 @@ //Nutrients////////////////////////////////////////////////////////////// // Nutrients deplete at a constant rate, since new nutrients can boost stats far easier. - apply_chemicals(lastuser) + apply_chemicals(lastuser?.resolve()) if(self_sustaining) reagents.remove_any(min(0.5, nutridrain)) else @@ -567,9 +567,9 @@ H.adjustWater(round(water_amt)) reagent_source.reagents.remove_reagent(/datum/reagent/water, water_amt) reagent_source.reagents.trans_to(H.reagents, transfer_amount, transfered_by = user) + lastuser = WEAKREF(user) if(IS_EDIBLE(reagent_source) || istype(reagent_source, /obj/item/reagent_containers/pill)) qdel(reagent_source) - lastuser = user H.update_icon() return 1 H.update_icon()