diff --git a/code/game/objects/items/mountable_frames/buttons_switches.dm b/code/game/objects/items/mountable_frames/buttons_switches.dm index 76e4f0ecfd4..30b77ea2f33 100644 --- a/code/game/objects/items/mountable_frames/buttons_switches.dm +++ b/code/game/objects/items/mountable_frames/buttons_switches.dm @@ -21,3 +21,11 @@ /obj/item/mounted/frame/light_switch/do_build(turf/on_wall, mob/user) new /obj/machinery/light_switch(get_turf(user), get_dir(user, on_wall)) qdel(src) + +/obj/item/mounted/frame/light_switch/windowtint + name = "window tint control button frame" + desc = "Used for repairing or building window tint control buttons" + +/obj/item/mounted/frame/light_switch/windowtint/do_build(turf/on_wall, mob/user) + new /obj/machinery/button/windowtint(get_turf(user), get_dir(user, on_wall)) + qdel(src) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index c9901c8b0fe..1f8ae46083e 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -89,7 +89,10 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \ new/datum/stack_recipe/window("windoor frame", /obj/structure/windoor_assembly, 5, time = 0, on_floor = TRUE, window_checks = TRUE), \ null, \ new/datum/stack_recipe/window("directional reinforced window", /obj/structure/window/reinforced, time = 0, on_floor = TRUE, window_checks = TRUE), \ - new/datum/stack_recipe/window("fulltile reinforced window", /obj/structure/window/full/reinforced, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \ + new/datum/stack_recipe/window("fulltile reinforced window", /obj/structure/window/full/reinforced, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \ + null, \ + new/datum/stack_recipe/window("directional electrochromic window", /obj/structure/window/reinforced/polarized, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \ + new/datum/stack_recipe/window("fulltile electrochromic window", /obj/structure/window/full/reinforced/polarized, 4, time = 0, on_floor = TRUE, window_checks = TRUE) \ )) /obj/item/stack/sheet/rglass diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 92e2c4115fe..6bf4bc8051d 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -83,6 +83,7 @@ GLOBAL_LIST_INIT(metal_recipes, list( null, new /datum/stack_recipe("mass driver button frame", /obj/item/mounted/frame/driver_button, 1, time = 50, one_per_turf = 0, on_floor = 1), new /datum/stack_recipe("light switch frame", /obj/item/mounted/frame/light_switch, 1, time = 50, one_per_turf = 0, on_floor = 1), + new /datum/stack_recipe("window tint control button frame", /obj/item/mounted/frame/light_switch/windowtint, 1, time = 50, one_per_turf = 0, on_floor = 1), null, new /datum/stack_recipe("grenade casing", /obj/item/grenade/chem_grenade), new /datum/stack_recipe("light fixture frame", /obj/item/mounted/frame/light_fixture, 2), diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index a2d13ad8afb..54d617ca3e4 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -514,12 +514,35 @@ var/id = 0 var/active = 0 +/obj/machinery/button/windowtint/New(turf/loc, w_dir=null) + ..() + switch(w_dir) + if(NORTH) + pixel_y = 25 + if(SOUTH) + pixel_y = -25 + if(EAST) + pixel_x = 25 + if(WEST) + pixel_x = -25 + /obj/machinery/button/windowtint/attack_hand(mob/user) if(..()) - return 1 + return TRUE toggle_tint() +/obj/machinery/button/windowtint/attackby(obj/item/W, mob/user, params) + if(istype(W, /obj/item/wrench)) + playsound(get_turf(src), W.usesound, 50, 1) + if(do_after(user, 30 * W.toolspeed, target = src)) + to_chat(user, "You detach \the [src] from the wall.") + new/obj/item/mounted/frame/light_switch/windowtint(get_turf(src)) + qdel(src) + return TRUE + + return ..() + /obj/machinery/button/windowtint/proc/toggle_tint() use_power(5) @@ -532,6 +555,12 @@ W.toggle() return + for(var/obj/structure/window/full/reinforced/polarized/W in range(src,range)) + if(W.id == src.id || !W.id) + spawn(0) + W.toggle() + return + /obj/machinery/button/windowtint/power_change() ..() if(active && !powered(power_channel)) @@ -589,7 +618,7 @@ icon_state = "window" max_integrity = 50 smooth = SMOOTH_TRUE - canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) + canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/polarized, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) /obj/structure/window/full/plasmabasic name = "plasma window" @@ -602,7 +631,7 @@ heat_resistance = 32000 max_integrity = 300 smooth = SMOOTH_TRUE - canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) + canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/polarized, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) explosion_block = 1 armor = list("melee" = 75, "bullet" = 5, "laser" = 0, "energy" = 0, "bomb" = 45, "bio" = 100, "rad" = 100, "fire" = 99, "acid" = 100) rad_insulation = RAD_NO_INSULATION @@ -616,7 +645,7 @@ shardtype = /obj/item/shard/plasma glass_type = /obj/item/stack/sheet/plasmarglass smooth = SMOOTH_TRUE - canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) + canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/polarized, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) reinf = TRUE max_integrity = 1000 explosion_block = 2 @@ -632,7 +661,7 @@ icon = 'icons/obj/smooth_structures/reinforced_window.dmi' icon_state = "r_window" smooth = SMOOTH_TRUE - canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) + canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/polarized, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced, /turf/simulated/wall/indestructible/fakeglass) max_integrity = 100 reinf = TRUE heat_resistance = 1600 @@ -641,6 +670,19 @@ explosion_block = 1 glass_type = /obj/item/stack/sheet/rglass +/obj/structure/window/full/reinforced/polarized + name = "electrochromic window" + desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it." + var/id + +/obj/structure/window/full/reinforced/polarized/proc/toggle() + if(opacity) + animate(src, color="#FFFFFF", time=5) + set_opacity(0) + else + animate(src, color="#222222", time=5) + set_opacity(1) + /obj/structure/window/full/reinforced/tinted name = "tinted window" desc = "It looks rather strong and opaque. Might take a few good hits to shatter it."