diff --git a/baystation12.dme b/baystation12.dme index 5f2d71696d..01b771266e 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -373,6 +373,7 @@ #include "code\game\machinery\doppler_array.dm" #include "code\game\machinery\flasher.dm" #include "code\game\machinery\floodlight.dm" +#include "code\game\machinery\floor_light.dm" #include "code\game\machinery\floorlayer.dm" #include "code\game\machinery\hologram.dm" #include "code\game\machinery\holosign.dm" @@ -636,8 +637,6 @@ #include "code\game\objects\items\stacks\rods.dm" #include "code\game\objects\items\stacks\stack.dm" #include "code\game\objects\items\stacks\sheets\leather.dm" -#include "code\game\objects\items\stacks\sheets\light.dm" -#include "code\game\objects\items\stacks\tiles\light.dm" #include "code\game\objects\items\stacks\tiles\tile_types.dm" #include "code\game\objects\items\weapons\AI_modules.dm" #include "code\game\objects\items\weapons\autopsy.dm" diff --git a/code/game/machinery/autolathe_datums.dm b/code/game/machinery/autolathe_datums.dm index 81f921e0fa..889a076d59 100644 --- a/code/game/machinery/autolathe_datums.dm +++ b/code/game/machinery/autolathe_datums.dm @@ -37,6 +37,11 @@ path = /obj/item/device/flashlight category = "General" +/datum/autolathe/recipe/floor_light + name = "floor light" + path = /obj/machinery/floor_light + category = "General" + /datum/autolathe/recipe/extinguisher name = "extinguisher" path = /obj/item/weapon/extinguisher diff --git a/code/game/machinery/floor_light.dm b/code/game/machinery/floor_light.dm new file mode 100644 index 0000000000..0eff1a3e3c --- /dev/null +++ b/code/game/machinery/floor_light.dm @@ -0,0 +1,154 @@ +var/list/floor_light_cache = list() + +/obj/machinery/floor_light + name = "floor light" + icon = 'icons/obj/machines/floor_light.dmi' + icon_state = "base" + desc = "A backlit floor panel." + layer = TURF_LAYER+0.001 + anchored = 0 + use_power = 2 + idle_power_usage = 2 + active_power_usage = 20 + power_channel = LIGHT + matter = list(DEFAULT_WALL_MATERIAL = 2500, "glass" = 2750) + + var/on + var/damaged + var/default_light_range = 4 + var/default_light_power = 2 + var/default_light_colour = "#FFFFFF" + +/obj/machinery/floor_light/attackby(var/obj/item/W, var/mob/user) + if(istype(W, /obj/item/weapon/screwdriver)) + anchored = !anchored + visible_message("\The [user] has [anchored ? "attached" : "detached"] \the [src].") + else if(istype(W, /obj/item/weapon/weldingtool) && (damaged || (stat & BROKEN))) + var/obj/item/weapon/weldingtool/WT = W + if(!WT.remove_fuel(0, user)) + user << "\The [src] must be on to complete this task." + return + playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) + if(!do_after(user, 20)) + return + if(!src || !WT.isOn()) + return + visible_message("\The [user] has repaired \the [src].") + stat &= ~BROKEN + damaged = null + update_brightness() + else if(W.force && user.a_intent == "hurt") + attack_hand(user) + return + +/obj/machinery/floor_light/attack_hand(var/mob/user) + + if(user.a_intent == "hurt" && !user.small) + if(!isnull(damaged) && !(stat & BROKEN)) + visible_message("\The [user] smashes \the [src]!") + playsound(src, "shatter", 70, 1) + stat |= BROKEN + else + visible_message("\The [user] attacks \the [src]!") + playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) + if(isnull(damaged)) damaged = 0 + update_brightness() + return + else + + if(!anchored) + user << "\The [src] must be screwed down first." + return + + if(stat & BROKEN) + user << "\The [src] is too damaged to be functional." + return + + if(stat & NOPOWER) + user << "\The [src] is unpowered." + return + + on = !on + if(on) use_power = 2 + visible_message("\The [user] turns \the [src] [on ? "on" : "off"].") + update_brightness() + return + +/obj/machinery/floor_light/process() + ..() + var/need_update + if((!anchored || broken()) && on) + use_power = 0 + on = 0 + need_update = 1 + else if(use_power && !on) + use_power = 0 + need_update = 1 + if(need_update) + update_brightness() + +/obj/machinery/floor_light/proc/update_brightness() + if(on && use_power == 2) + if(light_range != default_light_range || light_power != default_light_power || light_color != default_light_colour) + set_light(default_light_range, default_light_power, default_light_colour) + else + use_power = 0 + if(light_range || light_power) + set_light(0) + + active_power_usage = ((light_range + light_power) * 10) + update_icon() + +/obj/machinery/floor_light/update_icon() + overlays.Cut() + if(use_power && !broken()) + if(isnull(damaged)) + var/cache_key = "floorlight-[default_light_colour]" + if(!floor_light_cache[cache_key]) + var/image/I = image("on") + I.color = default_light_colour + I.layer = layer+0.001 + floor_light_cache[cache_key] = I + overlays |= floor_light_cache[cache_key] + else + if(damaged == 0) //Needs init. + damaged = rand(1,4) + var/cache_key = "floorlight-broken[damaged]-[default_light_colour]" + if(!floor_light_cache[cache_key]) + var/image/I = image("flicker[damaged]") + I.color = default_light_colour + I.layer = layer+0.001 + floor_light_cache[cache_key] = I + overlays |= floor_light_cache[cache_key] + +/obj/machinery/floor_light/proc/broken() + return (stat & (BROKEN|NOPOWER)) + +/obj/machinery/floor_light/ex_act(severity) + switch(severity) + if(1) + qdel(src) + if(2) + if (prob(50)) + qdel(src) + else if(prob(20)) + stat |= BROKEN + else + if(isnull(damaged)) + damaged = 0 + if(3) + if (prob(5)) + qdel(src) + else if(isnull(damaged)) + damaged = 0 + return + +/obj/machinery/floor_light/Destroy() + var/area/A = get_area(src) + if(A) + on = 0 + ..() + +/obj/machinery/floor_light/cultify() + default_light_colour = "#FF0000" + update_brightness() \ No newline at end of file diff --git a/code/game/objects/items/stacks/sheets/light.dm b/code/game/objects/items/stacks/sheets/light.dm deleted file mode 100644 index 424eab6a03..0000000000 --- a/code/game/objects/items/stacks/sheets/light.dm +++ /dev/null @@ -1,33 +0,0 @@ -/obj/item/stack/light_w - name = "wired glass tile" - singular_name = "wired glass floor tile" - desc = "A glass tile, which is wired, somehow." - icon_state = "glass_wire" - w_class = 3.0 - force = 3.0 - throwforce = 5.0 - throw_speed = 5 - throw_range = 20 - flags = CONDUCT - max_amount = 60 - -/obj/item/stack/light_w/attackby(var/obj/item/O as obj, var/mob/user as mob) - ..() - if(istype(O,/obj/item/weapon/wirecutters)) - var/obj/item/stack/cable_coil/CC = new/obj/item/stack/cable_coil(user.loc) - CC.amount = 5 - amount-- - new/obj/item/stack/material/glass(user.loc) - if(amount <= 0) - user.drop_from_inventory(src) - qdel(src) - - if(istype(O,/obj/item/stack/material) && O.get_material_name() == DEFAULT_WALL_MATERIAL) - var/obj/item/stack/M = O - if (M.use(1)) - use(1) - new/obj/item/stack/tile/light(get_turf(user)) - user << "You make a light tile." - else - user << "You need one metal sheet to finish the light tile." - return diff --git a/code/game/objects/items/stacks/tiles/light.dm b/code/game/objects/items/stacks/tiles/light.dm deleted file mode 100644 index 9785d04bb7..0000000000 --- a/code/game/objects/items/stacks/tiles/light.dm +++ /dev/null @@ -1,36 +0,0 @@ -/obj/item/stack/tile/light - name = "light tile" - singular_name = "light floor tile" - desc = "A floor tile, made out off glass. It produces light." - icon_state = "tile_e" - w_class = 3.0 - force = 3.0 - throwforce = 5.0 - throw_speed = 5 - throw_range = 20 - flags = CONDUCT - max_amount = 60 - attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed") - var/on = 1 - var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken - -/obj/item/stack/tile/light/New(var/loc, var/amount=null) - ..() - if(prob(5)) - state = 3 //broken - else if(prob(5)) - state = 2 //breaking - else if(prob(10)) - state = 1 //flickering occasionally - else - state = 0 //fine - -/obj/item/stack/tile/light/attackby(var/obj/item/O as obj, var/mob/user as mob) - ..() - if(istype(O,/obj/item/weapon/crowbar)) - new/obj/item/stack/material/steel(user.loc) - amount-- - new/obj/item/stack/light_w(user.loc) - if(amount <= 0) - user.drop_from_inventory(src) - qdel(src) diff --git a/code/modules/materials/materials.dm b/code/modules/materials/materials.dm index 153b4313c4..769aabe8e0 100644 --- a/code/modules/materials/materials.dm +++ b/code/modules/materials/materials.dm @@ -361,7 +361,6 @@ var/list/name_to_material destruction_desc = "shatters" window_options = list("One Direction" = 1, "Full Window" = 4) created_window = /obj/structure/window/basic - wire_product = /obj/item/stack/light_w rod_product = /obj/item/stack/material/glass/reinforced /material/glass/build_windows(var/mob/living/user, var/obj/item/stack/used_stack) diff --git a/icons/obj/machines/floor_light.dmi b/icons/obj/machines/floor_light.dmi new file mode 100644 index 0000000000..c238649280 Binary files /dev/null and b/icons/obj/machines/floor_light.dmi differ diff --git a/icons/turf/flooring/light.dmi b/icons/turf/flooring/light.dmi deleted file mode 100644 index f3620f182e..0000000000 Binary files a/icons/turf/flooring/light.dmi and /dev/null differ