mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* Steals tg's span macros * Fix alphabet * Updated some more spans * Misses a conflict * Fix compile errors * Converts more spans * oops
123 lines
3.8 KiB
Plaintext
123 lines
3.8 KiB
Plaintext
|
|
/obj/structure/floodlight_frame
|
|
name = "floodlight frame"
|
|
desc = "A bare metal frame looking vaguely like a floodlight. Requires wrenching down."
|
|
max_integrity = 100
|
|
icon = 'icons/obj/lighting.dmi'
|
|
icon_state = "floodlight_c1"
|
|
density = TRUE
|
|
var/state = FLOODLIGHT_NEEDS_WRENCHING
|
|
|
|
/obj/structure/floodlight_frame/attackby(obj/item/O, mob/user, params)
|
|
if(O.tool_behaviour == TOOL_WRENCH && (state == FLOODLIGHT_NEEDS_WRENCHING))
|
|
O.play_tool_sound(src, 50)
|
|
to_chat(user, span_notice("You secure [src]."))
|
|
anchored = TRUE
|
|
state = FLOODLIGHT_NEEDS_WIRES
|
|
desc = "A bare metal frame looking vaguely like a floodlight. Requires wiring."
|
|
else if(istype(O, /obj/item/stack/cable_coil) && (state == FLOODLIGHT_NEEDS_WIRES))
|
|
var/obj/item/stack/S = O
|
|
if(S.use(5))
|
|
to_chat(user, span_notice("You wire [src]."))
|
|
name = "wired [name]"
|
|
desc = "A bare metal frame looking vaguely like a floodlight. Requires securing with a screwdriver."
|
|
icon_state = "floodlight_c2"
|
|
state = FLOODLIGHT_NEEDS_SECURING
|
|
else if(istype(O, /obj/item/light/tube) && (state == FLOODLIGHT_NEEDS_LIGHTS))
|
|
if(user.transferItemToLoc(O))
|
|
to_chat(user, span_notice("You put lights in [src]."))
|
|
var/obj/machinery/power/floodlight/light = new(src.loc)
|
|
light.connect_to_network()
|
|
qdel(src)
|
|
else if(O.tool_behaviour == TOOL_SCREWDRIVER && (state == FLOODLIGHT_NEEDS_SECURING))
|
|
O.play_tool_sound(src, 50)
|
|
to_chat(user, span_notice("You fasten the wiring and electronics in [src]."))
|
|
name = "secured [name]"
|
|
desc = "A bare metal frame that looks like a floodlight. Requires light tubes."
|
|
icon_state = "floodlight_c3"
|
|
state = FLOODLIGHT_NEEDS_LIGHTS
|
|
else
|
|
..()
|
|
|
|
/obj/machinery/power/floodlight
|
|
name = "floodlight"
|
|
desc = "A pole with powerful mounted lights on it. Due to its high power draw, it must be powered by a direct connection to a wire node."
|
|
icon = 'icons/obj/lighting.dmi'
|
|
icon_state = "floodlight"
|
|
density = TRUE
|
|
max_integrity = 100
|
|
integrity_failure = 80
|
|
idle_power_usage = 100
|
|
active_power_usage = 1000
|
|
var/list/light_setting_list = list(0, 5, 10, 15)
|
|
var/light_power_coefficient = 300
|
|
var/setting = 1
|
|
light_power = 1.75
|
|
|
|
/obj/machinery/power/floodlight/process()
|
|
if(avail(active_power_usage))
|
|
add_load(active_power_usage)
|
|
else
|
|
change_setting(1)
|
|
|
|
/obj/machinery/power/floodlight/proc/change_setting(val, mob/user)
|
|
if((val < 1) || (val > light_setting_list.len))
|
|
return
|
|
active_power_usage = light_setting_list[val]
|
|
if(active_power_usage && !avail(active_power_usage))
|
|
return change_setting(val - 1)
|
|
setting = val
|
|
set_light(light_setting_list[val])
|
|
var/setting_text = ""
|
|
if(val > 1)
|
|
icon_state = "[initial(icon_state)]_on"
|
|
else
|
|
icon_state = initial(icon_state)
|
|
switch(val)
|
|
if(1)
|
|
setting_text = "OFF"
|
|
if(2)
|
|
setting_text = "low power"
|
|
if(3)
|
|
setting_text = "standard lighting"
|
|
if(4)
|
|
setting_text = "high power"
|
|
if(user)
|
|
to_chat(user, "You set [src] to [setting_text].")
|
|
|
|
/obj/machinery/power/floodlight/attackby(obj/item/O, mob/user, params)
|
|
if(O.tool_behaviour == TOOL_WRENCH)
|
|
default_unfasten_wrench(user, O, time = 20)
|
|
change_setting(1)
|
|
if(anchored)
|
|
connect_to_network()
|
|
else
|
|
disconnect_from_network()
|
|
else
|
|
. = ..()
|
|
|
|
/obj/machinery/power/floodlight/attack_hand(mob/user)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
var/current = setting
|
|
if(current == 1)
|
|
current = light_setting_list.len
|
|
else
|
|
current--
|
|
change_setting(current, user)
|
|
..()
|
|
|
|
/obj/machinery/power/floodlight/obj_break(damage_flag)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
playsound(loc, 'sound/effects/glassbr3.ogg', 100, TRUE)
|
|
var/obj/structure/floodlight_frame/F = new(loc)
|
|
F.state = FLOODLIGHT_NEEDS_LIGHTS
|
|
new /obj/item/light/tube/broken(loc)
|
|
qdel(src)
|
|
|
|
/obj/machinery/power/floodlight/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
|
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
|