diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 6b7e5bd457..c7ae138250 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -484,10 +484,12 @@ animate(src, color="#222222", time=5) SetOpacity(1) + + /obj/machinery/button/windowtint name = "window tint control" icon = 'icons/obj/power.dmi' - icon_state = "light1" + icon_state = "light0" desc = "A remote control switch for polarized windows." var/range = 7 @@ -495,13 +497,24 @@ if(..()) return 1 + toggle_tint() + +/obj/machinery/button/windowtint/proc/toggle_tint() use_power(5) active = !active - icon_state = "light[active]" + update_icon() for(var/obj/structure/window/reinforced/polarized/W in range(src,range)) if (W.id == src.id || !W.id) - spawn( 0 ) + spawn(0) W.toggle() - return + return + +/obj/machinery/button/windowtint/power_change() + ..() + if(active && !powered(power_channel)) + toggle_tint() + +/obj/machinery/button/windowtint/update_icon() + icon_state = "light[active]"