Skip to content

Commit

Permalink
tweak: crew monitor don`t work while commbrake
Browse files Browse the repository at this point in the history
  • Loading branch information
ROdenFL committed Nov 9, 2023
1 parent e14d3bc commit 0101536
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ GLOBAL_LIST_INIT(pipe_colors, list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_
GLOBAL_VAR(genname) //Nanotrasen officer name for fax send via fax panel, randoms every round

GLOBAL_VAR_INIT(pacifism_after_gt, FALSE)

GLOBAL_VAR_INIT(communications_blackout, FALSE)
9 changes: 8 additions & 1 deletion code/modules/events/communications_blackout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
GLOB.event_announcement.Announce(alert)

/datum/event/communications_blackout/start()
var/time = rand(1800, 3000)
// This only affects the cores, relays should be unaffected imo
for(var/obj/machinery/tcomms/core/T in GLOB.tcomms_machines)
T.start_ion()
// Bring it back sometime between 3-5 minutes. This uses deciseconds, so 1800 and 3000 respecticely.
// The AI cannot disable this, it must be waited for
addtimer(CALLBACK(T, TYPE_PROC_REF(/obj/machinery/tcomms, end_ion)), rand(1800, 3000))
addtimer(CALLBACK(T, TYPE_PROC_REF(/obj/machinery/tcomms, end_ion)), time)
addtimer(CALLBACK(src, PROC_REF(toggle_monitors)), time)
GLOB.communications_blackout = TRUE

/datum/event/communications_blackout/proc/toggle_monitors()
GLOB.communications_blackout = FALSE
return
7 changes: 7 additions & 0 deletions code/modules/tgui/modules/crew_monitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@

/datum/ui_module/crew_monitor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)

if(GLOB.communications_blackout)
to_chat(user, span_warning("Monitor shows strange symbols. There is no useful information, because of noise."))
if(ui)
ui.close()
return

if(!ui)
ui = new(user, src, ui_key, "CrewMonitor", name, 800, 600, master_ui, state)

Expand Down

0 comments on commit 0101536

Please sign in to comment.