Skip to content

Commit

Permalink
window dep. color + chromatic windows port (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blundir authored Apr 6, 2024
1 parent 04c4fe2 commit 2e019cf
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 4 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/{dripstation_defines}/colors.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define COLOR_CARGO_GLASS "#bd6f26"
65 changes: 64 additions & 1 deletion modular_dripstation/code/game/machinery/buttons.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/obj/machinery/button
icon = 'modular_dripstation/icons//obj/stationobjs.dmi'
icon = 'modular_dripstation/icons/obj/stationobjs.dmi'
var/light_mask
var/panel_icon = "button-open"

Expand All @@ -8,6 +8,8 @@
if(panel_open)
return
if(!(stat & BROKEN) && powered())
if(!light_mask)
return
. += emissive_appearance(icon, light_mask, src)

/obj/machinery/button/flasher
Expand Down Expand Up @@ -35,3 +37,64 @@

/obj/machinery/button/holosign
light_mask = "doorctrl_light_mask"

/obj/machinery/button/windowtint
name = "window tint control"
icon_state = "ligh-c"
desc = "A remote control switch for polarized windows."
icon = 'modular_dripstation/icons/obj/power.dmi'
panel_icon = "light-w"
skin = "ligh-c"
var/range = 7
var/active = 0
var/tint_id

/obj/machinery/button/windowtint/attack_hand(mob/user)
if(..())
return 1

toggle_tint()

/obj/machinery/button/windowtint/proc/toggle_tint()
use_power(5)

active = !active
update_icon()

for(var/obj/structure/window/reinforced/fulltile/polarized/W in range(src,range))
if(W.tint_id == src.tint_id || !W.tint_id)
spawn(0)
W.toggle()
return
for(var/obj/machinery/door/airlock/G in range(src,range))
if(G.id_tag == src.tint_id)
spawn(0)
if(G.glass)
G.airlock_material = null
G.glass = FALSE
G.update_icon()
if(G.density)
G.opacity = 1
else
G.airlock_material = "glass"
G.glass = TRUE
G.update_icon()
G.opacity = 0
return

/obj/machinery/button/windowtint/power_change()
..()
if(active && !powered(power_channel))
toggle_tint()

/obj/machinery/button/windowtint/update_overlays()
. = ..()
if(stat & (NOPOWER|BROKEN))
return
if(panel_open)
return
. += mutable_appearance(icon, "[src.active ? "light1" : "light0"]")
. += emissive_appearance(icon, "[src.active ? "light1" : "light0"]", src)

/obj/machinery/button/windowtint/update_icon_state()
. = ..()
12 changes: 12 additions & 0 deletions modular_dripstation/code/game/machinery/doors/window_door.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/obj/machinery/door/window
var/cancolor = TRUE

/obj/machinery/door/window/Initialize(mapload, set_dir, unres_sides)
. = ..()
if(!color && cancolor)
color = color_windows(src)

/obj/machinery/door/window/clockwork
cancolor = FALSE


82 changes: 82 additions & 0 deletions modular_dripstation/code/game/objects/structures/window.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
GLOBAL_LIST_INIT(wcBrig, COLOR_SECURITY_RED)
// GLOBAL_LIST_INIT(wcSci, COLOR_SCIENCE_PINK)
// GLOBAL_LIST_INIT(wcMed, COLOR_MEDICAL_BLUE)
GLOBAL_LIST_INIT(wcEng, COLOR_ENGINEERING_ORANGE)
GLOBAL_LIST_INIT(wcCar, COLOR_CARGO_GLASS)
// GLOBAL_LIST_INIT(wcCom, COLOR_COMMAND_BLUE)

/obj/proc/color_windows(obj/W)
var/list/wcBrigAreas = list(/area/security, /area/crew_quarters/heads/hos, /area/ai_monitored/security/armory)
// var/list/wcSciAreas = list(/area/science, /area/crew_quarters/heads/hor)
// var/list/wcMedAreas = list(/area/medical, /area/crew_quarters/heads/cmo)
var/list/wcEngAreas = list(/area/engine, /area/crew_quarters/heads/chief)
var/list/wcCarAreas = list(/area/quartermaster)
// var/list/wcComAreas = list(/area/bridge, /area/crew_quarters/heads/hop, /area/crew_quarters/heads/captain, /area/teleporter)


var/newcolor
var/turf/T = get_turf(W)
if(!istype(T))
return
var/area/A = T.loc

if(is_type_in_list(A,wcBrigAreas))
newcolor = GLOB.wcBrig
// else if(is_type_in_list(A,wcSciAreas))
// newcolor = GLOB.wcSci
// else if(is_type_in_list(A,wcMedAreas))
// newcolor = GLOB.wcMed
else if(is_type_in_list(A,wcEngAreas))
newcolor = GLOB.wcEng
else if(is_type_in_list(A,wcCarAreas))
newcolor = GLOB.wcCar
// else if(is_type_in_list(A,wcComAreas))
// newcolor = GLOB.wcCom
else
newcolor = null

return newcolor

/obj/structure/window/Initialize(mapload, direct)
. = ..()
if(!color && cancolor)
color = color_windows(src)

/obj/structure/window
var/cancolor = FALSE

/obj/structure/window/reinforced
cancolor = TRUE

/obj/structure/window/reinforced/bronze
cancolor = FALSE

/obj/structure/window/reinforced/tinted
cancolor = FALSE

/obj/structure/window/fulltile
cancolor = TRUE

/obj/structure/window/reinforced/clockwork
cancolor = FALSE

/obj/structure/window/paperframe
cancolor = FALSE

/obj/structure/window/reinforced/fulltile/polarized
name = "electrochromic window"
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
var/tint_id
var/original_color
var/isused

/obj/structure/window/reinforced/fulltile/polarized/proc/toggle()
if(!isused)
isused++
original_color = color
if(opacity)
animate(src, color="[original_color]", time=5)
set_opacity(0)
else
animate(src, color="#222222", time=5)
set_opacity(1)
2 changes: 2 additions & 0 deletions modular_dripstation/includes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
#include "code\game\objects\structures\crates_lockers\crates.dm"
#include "code\game\objects\structures\safe.dm"
#include "code\game\objects\structures\table_racks.dm"
#include "code\game\objects\structures\window.dm"
#include "code\game\objects\items\barriertape.dm"
#include "code\game\objects\items\candle.dm"
#include "code\game\objects\items\card_ids.dm"
Expand Down Expand Up @@ -192,6 +193,7 @@
#include "code\game\machinery\cell_charger.dm"
#include "code\game\machinery\dance_machine.dm"
#include "code\game\machinery\defibrillator_mount.dm"
#include "code\game\machinery\doors\window_door.dm"
#include "code\game\machinery\flasher.dm"
#include "code\game\machinery\gulag_item_reclaimer.dm"
#include "code\game\machinery\hologram.dm"
Expand Down
7 changes: 4 additions & 3 deletions yogstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@
#include "code\__DEFINES\traits\sources.dm"
#include "code\__DEFINES\{dripstation_defines}\blackmarket.dm"
#include "code\__DEFINES\{dripstation_defines}\cargo.dm"
#include "code\__DEFINES\{dripstation_defines}\dcs\signals\signals_transform.dm"
#include "code\__DEFINES\{dripstation_defines}\codewords.dm"
#include "code\__DEFINES\{dripstation_defines}\colors.dm"
#include "code\__DEFINES\{dripstation_defines}\traits.dm"
#include "code\__DEFINES\{dripstation_defines}\dcs\signals\signals_transform.dm"
#include "code\__DEFINES\{yogs_defines}\admin.dm"
#include "code\__DEFINES\{yogs_defines}\antagonists.dm"
#include "code\__DEFINES\{yogs_defines}\atmospherics.dm"
Expand All @@ -245,7 +247,6 @@
#include "code\__DEFINES\{yogs_defines}\telecomms.dm"
#include "code\__DEFINES\{yogs_defines}\traits.dm"
#include "code\__DEFINES\{yogs_defines}\wires.dm"
#include "code\__DEFINES\{dripstation_defines}\codewords.dm"
#include "code\__HELPERS\_extools_api.dm"
#include "code\__HELPERS\_lists.dm"
#include "code\__HELPERS\_planes.dm"
Expand Down Expand Up @@ -3995,8 +3996,8 @@
#include "yogstation\code\datums\mutations\alcohol.dm"
#include "yogstation\code\datums\mutations\extendoarm.dm"
#include "yogstation\code\datums\ruins\free_miners.dm"
#include "yogstation\code\datums\ruins\jungle_fluff.dm"
#include "yogstation\code\datums\ruins\jungle.dm"
#include "yogstation\code\datums\ruins\jungle_fluff.dm"
#include "yogstation\code\datums\ruins\station.dm"
#include "yogstation\code\datums\status_effects\buffs.dm"
#include "yogstation\code\datums\status_effects\neutral.dm"
Expand Down

0 comments on commit 2e019cf

Please sign in to comment.