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
This commit is contained in:
1080pCat
2023-04-22 17:17:35 +10:00
committed by GitHub
parent 07987bd393
commit deef459069
2 changed files with 57 additions and 43 deletions
+50 -43
View File
@@ -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("<span class='warning'>[src] shuts down due to lack of power!</span>")
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, "<span class='warning'>You remove the power cell.</span>")
if(on)
on = FALSE
visible_message("<span class='warning'>[src] shuts down due to lack of power!</span>")
@@ -73,8 +66,10 @@
set_light(0)
else
if(!cell)
to_chat(user, "<span class='warning'>You try to turn on [src] but nothing happens! Seems like it <b>lacks a power cell</b>.</span>")
return
if(cell.charge <= 0)
to_chat(user, "<span class='warning'>[src] hardly glows at all! Seems like the <b>power cell is empty</b>.</span>")
return
on = TRUE
to_chat(user, "<span class='notice'>You turn on the light.</span>")
@@ -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.", \
"<span class='notice'> You have tightened \the [src]'s casters.</span>", \
"You hear ratchet.")
anchored = TRUE
else if(anchored)
playsound(loc, W.usesound, 50, 1)
user.visible_message( \
"[user] loosens \the [src]'s casters.", \
"<span class='notice'> You have loosened \the [src]'s casters.</span>", \
"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, "<span class='warning'>There is a power cell already installed.</span>")
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, "<span class='notice'>You insert the power cell.</span>")
update_icon(UPDATE_ICON_STATE)
return
return ..()
/obj/machinery/floodlight/screwdriver_act(mob/living/user, obj/item/I)
if(open)
to_chat(user, "<span class='warning'>The screws can't reach while its open.</span>")
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, "<span class='notice'>You screw the battery panel in place.</span>")
else
to_chat(user, "You unscrew the battery panel.")
to_chat(user, "<span class='notice'>You unscrew the battery panel.</span>")
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, "<span class='notice'>The cover is screwed tightly down.</span>")
return TRUE
if(!I.use_tool(src, user, volume = I.tool_volume))
return
if(open)
to_chat(user, "<span class='notice'>You pry the panel closed.</span>")
else
to_chat(user, "<span class='notice'>You pry the panel open.</span>")
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)
. +="<span class='notice'>The panel is <b>screwed</b> shut.</span>"
else
if(open)
. +="<span class='notice'>The panel is <b>pried</b> open, looks like you could fit a cell in there.</span>"
else
. +="<span class='notice'>The panel looks like it could be <b>pried</b> open, or <b>screwed</b> shut.</span>"
@@ -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"