[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>
This commit is contained in:
SkyratBot
2021-01-28 03:07:34 +01:00
committed by GitHub
co-authored by MrMelbert
parent ae87fc7476
commit e2726d676e
+3 -3
View File
@@ -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()