mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
97 lines
2.0 KiB
Plaintext
97 lines
2.0 KiB
Plaintext
//these are probably broken
|
|
|
|
/obj/machinery/floodlight
|
|
name = "Emergency Floodlight"
|
|
icon = 'icons/obj/machines/floodlight.dmi'
|
|
icon_state = "flood00"
|
|
density = 1
|
|
var/on = 0
|
|
var/obj/item/weapon/cell/high/cell = null
|
|
var/use = 5
|
|
var/unlocked = 0
|
|
var/open = 0
|
|
var/brightness_on = 999 //can't remember what the maxed out value is
|
|
|
|
/obj/machinery/floodlight/New()
|
|
src.cell = new(src)
|
|
..()
|
|
|
|
/obj/machinery/floodlight/proc/updateicon()
|
|
icon_state = "flood[open ? "o" : ""][open && cell ? "b" : ""]0[on]"
|
|
|
|
/obj/machinery/floodlight/process()
|
|
if(on)
|
|
if(cell.charge >= use)
|
|
cell.use(use)
|
|
else
|
|
on = 0
|
|
updateicon()
|
|
SetLuminosity(0)
|
|
src.visible_message("<span class='warning'>[src] shuts down due to lack of power!</span>")
|
|
return
|
|
|
|
/obj/machinery/floodlight/attack_hand(mob/user as mob)
|
|
if(open && cell)
|
|
if(ishuman(user))
|
|
if(!user.get_active_hand())
|
|
user.put_in_hands(cell)
|
|
cell.loc = user.loc
|
|
else
|
|
cell.loc = loc
|
|
|
|
cell.add_fingerprint(user)
|
|
cell.updateicon()
|
|
|
|
src.cell = null
|
|
user << "You remove the power cell"
|
|
updateicon()
|
|
return
|
|
|
|
if(on)
|
|
on = 0
|
|
user << "\blue You turn off the light"
|
|
SetLuminosity(0)
|
|
else
|
|
if(!cell)
|
|
return
|
|
if(cell.charge <= 0)
|
|
return
|
|
on = 1
|
|
user << "\blue You turn on the light"
|
|
SetLuminosity(brightness_on)
|
|
|
|
updateicon()
|
|
|
|
|
|
/obj/machinery/floodlight/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
if (istype(W, /obj/item/weapon/screwdriver))
|
|
if (!open)
|
|
if(unlocked)
|
|
unlocked = 0
|
|
user << "You screw the battery panel in place."
|
|
else
|
|
unlocked = 1
|
|
user << "You unscrew the battery panel."
|
|
|
|
if (istype(W, /obj/item/weapon/crowbar))
|
|
if(unlocked)
|
|
if(open)
|
|
open = 0
|
|
overlays = null
|
|
user << "You crowbar the battery panel in place."
|
|
else
|
|
if(unlocked)
|
|
open = 1
|
|
user << "You remove the battery panel."
|
|
|
|
if (istype(W, /obj/item/weapon/cell))
|
|
if(open)
|
|
if(cell)
|
|
user << "There is a power cell already installed."
|
|
else
|
|
user.drop_item()
|
|
W.loc = src
|
|
cell = W
|
|
user << "You insert the power cell."
|
|
updateicon()
|