From acfe2a2c01cb64fa56357956f062067f0eee6a8b Mon Sep 17 00:00:00 2001 From: 81Denton <32391752+81Denton@users.noreply.github.com> Date: Fri, 5 Oct 2018 08:10:47 +0200 Subject: [PATCH] [Ready] Light bulbs shatter and hurt players when stepped on, spill plasma if rigged (#40625) * v1 * Fixes code, lights spill plasma if rigged * Yeah let's not do that --- code/modules/power/lighting.dm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index aef09e8238b..55fec5276e4 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -723,7 +723,7 @@ var/switchcount = 0 // number of times switched materials = list(MAT_GLASS=100) grind_results = list("silicon" = 5, "nitrogen" = 10) //Nitrogen is used as a cheaper alternative to argon in incandescent lighbulbs - var/rigged = 0 // true if rigged to explode + var/rigged = FALSE // true if rigged to explode var/brightness = 2 //how much light it gives off /obj/item/light/suicide_act(mob/living/carbon/user) @@ -777,11 +777,23 @@ icon_state = "[base_state]-broken" desc = "A broken [name]." - /obj/item/light/Initialize() . = ..() update() + +/obj/item/light/ComponentInitialize() + . = ..() + AddComponent(/datum/component/caltrop, force) +/obj/item/light/Crossed(mob/living/L) + . = ..() + if(istype(L) && has_gravity(loc)) + if(L.has_trait(TRAIT_LIGHT_STEP)) + playsound(loc, 'sound/effects/glass_step.ogg', 30, 1) + else + playsound(loc, 'sound/effects/glass_step.ogg', 50, 1) + if(status == LIGHT_BURNED || status == LIGHT_OK) + shatter() // attack bulb/tube with object // if a syringe, can inject plasma to make it explode @@ -794,7 +806,7 @@ if(S.reagents.has_reagent("plasma", 5)) - rigged = 1 + rigged = TRUE S.reagents.clear_reagents() else @@ -815,6 +827,8 @@ status = LIGHT_BROKEN force = 5 playsound(src.loc, 'sound/effects/glasshit.ogg', 75, 1) + if(rigged) + atmos_spawn_air("plasma=5") //5u of plasma are required to rig a light bulb/tube update()