From deef459069150fbecf4b6d099a67dd297950702a Mon Sep 17 00:00:00 2001 From: 1080pCat <96908085+1080pCat@users.noreply.github.com> Date: Sat, 22 Apr 2023 17:17:35 +1000 Subject: [PATCH] Freshens up floodlights to not be 10 years old (#20727) * Flood lights! * gramma! my enemy!! (and a forgotten span) * gramma AGAIN! * more spans * runtime issue, wording, and simpler crowbar * changes a 1, to a TRUE --- code/game/machinery/floodlight.dm | 93 ++++++++++--------- .../supply/supply_packs/pack_emergency.dm | 7 ++ 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm index b780768ad90..6bb1f59537b 100644 --- a/code/game/machinery/floodlight.dm +++ b/code/game/machinery/floodlight.dm @@ -6,10 +6,10 @@ density = TRUE max_integrity = 100 integrity_failure = 80 - light_power = 20 + light_power = 10 var/on = FALSE var/obj/item/stock_parts/cell/high/cell = null - var/use = 5 + var/use = 30 var/unlocked = FALSE var/open = FALSE var/brightness_on = 14 @@ -30,15 +30,8 @@ icon_state = "flood[open ? "o" : ""][open && cell ? "b" : ""]0[on]" /obj/machinery/floodlight/process() - if(!cell && on) - on = FALSE - visible_message("[src] shuts down due to lack of power!") - update_icon(UPDATE_ICON_STATE) - set_light(0) - return if(on) - cell.charge -= use - if(cell.charge <= 0) + if(cell && !cell.use(use)) on = FALSE update_icon(UPDATE_ICON_STATE) set_light(0) @@ -59,7 +52,7 @@ cell.update_icon(UPDATE_ICON_STATE) cell = null - to_chat(user, "You remove the power cell.") + to_chat(user, "You remove the power cell.") if(on) on = FALSE visible_message("[src] shuts down due to lack of power!") @@ -73,8 +66,10 @@ set_light(0) else if(!cell) + to_chat(user, "You try to turn on [src] but nothing happens! Seems like it lacks a power cell.") return if(cell.charge <= 0) + to_chat(user, "[src] hardly glows at all! Seems like the power cell is empty.") return on = TRUE to_chat(user, "You turn on the light.") @@ -92,60 +87,72 @@ update_icon(UPDATE_ICON_STATE) /obj/machinery/floodlight/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/wrench)) - if(!anchored && !isinspace()) - playsound(loc, W.usesound, 50, 1) - user.visible_message( \ - "[user] tightens \the [src]'s casters.", \ - " You have tightened \the [src]'s casters.", \ - "You hear ratchet.") - anchored = TRUE - else if(anchored) - playsound(loc, W.usesound, 50, 1) - user.visible_message( \ - "[user] loosens \the [src]'s casters.", \ - " You have loosened \the [src]'s casters.", \ - "You hear ratchet.") - anchored = FALSE - update_icon(UPDATE_ICON_STATE) - return - if(istype(W, /obj/item/crowbar)) - if(unlocked) - if(open) - open = FALSE - to_chat(user, "You crowbar the battery panel in place.") - else - if(unlocked) - open = TRUE - to_chat(user, "You remove the battery panel.") - update_icon(UPDATE_ICON_STATE) - return if(istype(W, /obj/item/stock_parts/cell)) if(open) if(cell) - to_chat(user, "There is a power cell already installed.") + to_chat(user, "There is a power cell already installed.") else + playsound(loc, W.usesound, 50, TRUE) user.drop_item() W.loc = src cell = W - to_chat(user, "You insert the power cell.") + to_chat(user, "You insert the power cell.") update_icon(UPDATE_ICON_STATE) return return ..() /obj/machinery/floodlight/screwdriver_act(mob/living/user, obj/item/I) + if(open) + to_chat(user, "The screws can't reach while its open.") + return TRUE + + if(!I.use_tool(src, user, volume = I.tool_volume)) + return + if(open) return if(unlocked) - to_chat(user, "You screw the battery panel in place.") + to_chat(user, "You screw the battery panel in place.") else - to_chat(user, "You unscrew the battery panel.") + to_chat(user, "You unscrew the battery panel.") unlocked = !unlocked update_icon(UPDATE_ICON_STATE) return TRUE +/obj/machinery/floodlight/crowbar_act(mob/living/user, obj/item/I) + if(!unlocked) + to_chat(user, "The cover is screwed tightly down.") + return TRUE + + if(!I.use_tool(src, user, volume = I.tool_volume)) + return + + if(open) + to_chat(user, "You pry the panel closed.") + else + to_chat(user, "You pry the panel open.") + open = !open + update_icon(UPDATE_ICON_STATE) + return TRUE + +/obj/machinery/floodlight/wrench_act(mob/living/user, obj/item/I) + . = TRUE + if(!I.tool_use_check(user, 0)) + return + default_unfasten_wrench(user, I) + /obj/machinery/floodlight/extinguish_light(force = FALSE) on = FALSE set_light(0) update_icon(UPDATE_ICON_STATE) + +/obj/machinery/floodlight/examine(mob/user) + . = ..() + if(!unlocked) + . +="The panel is screwed shut." + else + if(open) + . +="The panel is pried open, looks like you could fit a cell in there." + else + . +="The panel looks like it could be pried open, or screwed shut." diff --git a/code/modules/supply/supply_packs/pack_emergency.dm b/code/modules/supply/supply_packs/pack_emergency.dm index a0a93a764cd..3957f94e939 100644 --- a/code/modules/supply/supply_packs/pack_emergency.dm +++ b/code/modules/supply/supply_packs/pack_emergency.dm @@ -113,3 +113,10 @@ containertype = /obj/structure/closet/crate containername = "special ops crate" hidden = TRUE + +/datum/supply_packs/emergency/floodlight + name = "Emergency Flood Light" + contains = list(/obj/machinery/floodlight) + cost = 250 + containertype = /obj/structure/largecrate + containername = "emergency flood light"