From d6c12e331d65e074e4efabbd12b2a38313853ae6 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 25 Nov 2020 01:00:09 +0100 Subject: [PATCH] [MIRROR] Fixes lightbulb injections (#1821) * Fixes lightbulb injections (#55132) Co-authored-by: itseasytosee <55666666+itseasytosee@ users.noreply.github.com> Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@ users.noreply.github.com> * Fixes lightbulb injections Co-authored-by: Coffee Co-authored-by: itseasytosee <55666666+itseasytosee@ users.noreply.github.com> Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@ users.noreply.github.com> --- code/modules/power/lighting.dm | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index dacaba17085..564173d14ee 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -15,6 +15,9 @@ #define LIGHT_DRAIN_TIME 25 #define LIGHT_POWER_GAIN 35 +//How many reagents the lights can hold +#define LIGHT_REAGENT_CAPACITY 5 + /obj/item/wallframe/light_fixture name = "light fixture frame" desc = "Used for building lights." @@ -883,6 +886,7 @@ /obj/item/light/Initialize() . = ..() + create_reagents(LIGHT_REAGENT_CAPACITY, INJECTABLE | DRAINABLE) update() /obj/item/light/ComponentInitialize() @@ -901,21 +905,11 @@ // attack bulb/tube with object // if a syringe, can inject plasma to make it explode -/obj/item/light/attackby(obj/item/I, mob/user, params) - ..() - if(istype(I, /obj/item/reagent_containers/syringe)) - var/obj/item/reagent_containers/syringe/S = I - - to_chat(user, "You inject the solution into \the [src].") - - if(S.reagents.has_reagent(/datum/reagent/toxin/plasma, 5)) - - rigged = TRUE - - S.reagents.clear_reagents() - else - ..() - return +/obj/item/light/on_reagent_change(changetype) + rigged = (reagents.has_reagent(/datum/reagent/toxin/plasma, LIGHT_REAGENT_CAPACITY)) //has_reagent returns the reagent datum + return ..() + +#undef LIGHT_REAGENT_CAPACITY /obj/item/light/attack(mob/living/M, mob/living/user, def_zone) ..()