From 57c89e3daefb4512bf965c854b79b3adc0c0c8f2 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Mon, 13 Feb 2017 23:49:06 +0000 Subject: [PATCH] More Window Flashing (#23923) * added window flashing pref, added windowflashing to notify_ghosts, pollCandidates and similar procs * disabled window flash for golem shells, ash walker eggs, drone shells and posibrains * ignorepref var for ahelp/apm and roundstart --- code/__HELPERS/game.dm | 18 ++++++++++++------ code/controllers/subsystem/ticker.dm | 2 +- .../objects/structures/ghost_role_spawners.dm | 4 ++-- code/modules/admin/verbs/adminhelp.dm | 2 +- code/modules/admin/verbs/adminpm.dm | 4 ++-- code/modules/client/preferences.dm | 6 ++++-- code/modules/client/preferences_savefile.dm | 3 +++ code/modules/mob/dead/observer/observer.dm | 4 +++- code/modules/mob/living/brain/posibrain.dm | 2 +- .../friendly/drone/drones_as_items.dm | 2 +- code/modules/mob/mob.dm | 4 ++-- code/modules/mob/mob_helpers.dm | 4 +++- 12 files changed, 35 insertions(+), 20 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 6603a191db1..7a8103f8120 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -420,10 +420,12 @@ return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y) -/proc/showCandidatePollWindow(mob/dead/observer/G, poll_time, Question, list/candidates, ignore_category, time_passed) +/proc/showCandidatePollWindow(mob/dead/observer/G, poll_time, Question, list/candidates, ignore_category, time_passed, flashwindow = TRUE) set waitfor = 0 G << 'sound/misc/notice2.ogg' //Alerting them to their consideration + if(flashwindow) + window_flash(G.client) switch(ignore_category ? askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No","Never for this round", StealFocus=0, Timeout=poll_time) : askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No", StealFocus=0, Timeout=poll_time)) if(1) G << "Choice registered: Yes." @@ -441,7 +443,7 @@ poll_ignore[ignore_category] += G.ckey G << "Choice registered: Never for this round." -/proc/pollCandidates(var/Question, var/jobbanType, var/datum/game_mode/gametypeCheck, var/be_special_flag = 0, var/poll_time = 300, var/ignore_category = null) +/proc/pollCandidates(var/Question, var/jobbanType, var/datum/game_mode/gametypeCheck, var/be_special_flag = 0, var/poll_time = 300, var/ignore_category = null, flashwindow = TRUE) var/list/mob/dead/observer/candidates = list() var/time_passed = world.time if (!Question) @@ -460,7 +462,7 @@ if(jobban_isbanned(G, jobbanType) || jobban_isbanned(G, "Syndicate")) continue - showCandidatePollWindow(G, poll_time, Question, candidates, ignore_category, time_passed) + showCandidatePollWindow(G, poll_time, Question, candidates, ignore_category, time_passed, flashwindow) sleep(poll_time) //Check all our candidates, to make sure they didn't log off during the wait period. @@ -507,7 +509,11 @@ if(M && !isnewplayer(M)) M << thing -/proc/window_flash(var/client_or_usr) - if (!client_or_usr) +/proc/window_flash(client/C, ignorepref = FALSE) + if(ismob(C)) + var/mob/M = C + if(M.client) + C = M.client + if(!C || (!C.prefs.windowflashing && !ignorepref)) return - winset(client_or_usr, "mainwindow", "flash=5") + winset(C, "mainwindow", "flash=5") diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 83d05b52da6..be86681521f 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -75,7 +75,7 @@ var/datum/subsystem/ticker/ticker world << "Please set up your character and select \"Ready\". The game will start in [config.lobby_countdown] seconds." current_state = GAME_STATE_PREGAME for(var/client/C in clients) - window_flash(C) //let them know lobby has opened up. + window_flash(C, ignorepref = TRUE) //let them know lobby has opened up. if(GAME_STATE_PREGAME) //lobby stats for statpanels diff --git a/code/game/objects/structures/ghost_role_spawners.dm b/code/game/objects/structures/ghost_role_spawners.dm index 9ce203ce7da..571711e47e7 100644 --- a/code/game/objects/structures/ghost_role_spawners.dm +++ b/code/game/objects/structures/ghost_role_spawners.dm @@ -57,7 +57,7 @@ ..() var/area/A = get_area(src) if(A) - notify_ghosts("An ash walker egg is ready to hatch in \the [A.name].", source = src, action=NOTIFY_ATTACK) + notify_ghosts("An ash walker egg is ready to hatch in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE) //Timeless prisons: Spawns in Wish Granter prisons in lavaland. Ghosts become age-old users of the Wish Granter and are advised to seek repentance for their past. /obj/effect/mob_spawn/human/exile @@ -113,7 +113,7 @@ mob_species = species var/area/A = get_area(src) if(A) - notify_ghosts("\A [initial(species.id)] golem shell has been completed in \the [A.name].", source = src, action=NOTIFY_ATTACK) + notify_ghosts("\A [initial(species.id)] golem shell has been completed in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE) if(has_owner && creator) flavour_text = "You are a golem. You move slowly, but are highly resistant to heat and cold as well as blunt trauma. You are unable to wear clothes, but can still use most tools. \ Serve [creator], and assist [creator.p_them()] in completing [creator.p_their()] goals at any cost." diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index ee34b21e797..84b50f6dc88 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -115,7 +115,7 @@ for(var/client/X in admins) if(X.prefs.toggles & SOUND_ADMINHELP) X << 'sound/effects/adminhelp.ogg' - window_flash(X) + window_flash(X, ignorepref = TRUE) X << msg diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 5367ed782d3..3d1466766ce 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -180,7 +180,7 @@ for(var/client/X in admins) X << "PM: [key_name(src, X, 0)]->IRC: \blue [keywordparsedmsg]" //inform X else - window_flash(C) + window_flash(C, ignorepref = TRUE) log_admin("PM: [key_name(src)]->[key_name(C)]: [rawmsg]") //we don't use message_admins here because the sender/receiver might get it too for(var/client/X in admins) @@ -214,7 +214,7 @@ C << "-- Administrator private message --" C << "Admin PM from-[adminname]: [msg]" C << "Click on the administrator's name to reply." - window_flash(C) + window_flash(C, ignorepref = TRUE) //always play non-admin recipients the adminhelp sound C << 'sound/effects/adminhelp.ogg' diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 7898597a187..5f9377a2b19 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -31,6 +31,7 @@ var/list/preferences_datums = list() var/hotkeys = FALSE var/tgui_fancy = TRUE var/tgui_lock = TRUE + var/windowflashing = TRUE var/toggles = TOGGLES_DEFAULT var/chat_toggles = TOGGLES_DEFAULT_CHAT var/ghost_form = "ghost" @@ -101,7 +102,6 @@ var/list/preferences_datums = list() var/uplink_spawn_loc = UPLINK_PDA - /datum/preferences/New(client/C) parent = C custom_names["ai"] = pick(ai_names) @@ -362,6 +362,7 @@ var/list/preferences_datums = list() dat += "Keybindings: [(hotkeys) ? "Hotkeys" : "Default"]
" dat += "tgui Style: [(tgui_fancy) ? "Fancy" : "No Frills"]
" dat += "tgui Monitors: [(tgui_lock) ? "Primary" : "All"]
" + dat += "Window Flashing: [(windowflashing) ? "Yes" : "No"]
" dat += "Play admin midis: [(toggles & SOUND_MIDI) ? "Yes" : "No"]
" dat += "Play lobby music: [(toggles & SOUND_LOBBY) ? "Yes" : "No"]
" dat += "Ghost ears: [(chat_toggles & CHAT_GHOSTEARS) ? "All Speech" : "Nearest Creatures"]
" @@ -1156,7 +1157,8 @@ var/list/preferences_datums = list() tgui_fancy = !tgui_fancy if("tgui_lock") tgui_lock = !tgui_lock - + if("winflash") + windowflashing = !windowflashing if("hear_adminhelps") toggles ^= SOUND_ADMINHELP if("announce_login") diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 7765fa48c2f..245814b60c5 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -155,6 +155,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["hotkeys"] >> hotkeys S["tgui_fancy"] >> tgui_fancy S["tgui_lock"] >> tgui_lock + S["windowflash"] >> windowflashing if(islist(S["be_special"])) S["be_special"] >> be_special @@ -189,6 +190,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car hotkeys = sanitize_integer(hotkeys, 0, 1, initial(hotkeys)) tgui_fancy = sanitize_integer(tgui_fancy, 0, 1, initial(tgui_fancy)) tgui_lock = sanitize_integer(tgui_lock, 0, 1, initial(tgui_lock)) + windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing)) default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot)) toggles = sanitize_integer(toggles, 0, 65535, initial(toggles)) clientfps = sanitize_integer(clientfps, 0, 1000, 0) @@ -217,6 +219,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["hotkeys"] << hotkeys S["tgui_fancy"] << tgui_fancy S["tgui_lock"] << tgui_lock + S["windowflash"] << windowflashing S["be_special"] << be_special S["default_slot"] << default_slot S["toggles"] << toggles diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index c980f6a0f81..4f6b3e49005 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -328,7 +328,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp mind.current.key = key return 1 -/mob/dead/observer/proc/notify_cloning(var/message, var/sound, var/atom/source) +/mob/dead/observer/proc/notify_cloning(var/message, var/sound, var/atom/source, flashwindow = TRUE) + if(flashwindow) + window_flash(client) if(message) src << "[message]" if(source) diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index a812617eb7d..81143d62a56 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -37,7 +37,7 @@ var/global/posibrain_notif_cooldown = 0 /obj/item/device/mmi/posibrain/proc/ping_ghosts(msg, newlymade) if(newlymade || !posibrain_notif_cooldown) - notify_ghosts("[name] [msg] in [get_area(src)]!", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, enter_link = "(Click to enter)", source = src, action = NOTIFY_ATTACK) + notify_ghosts("[name] [msg] in [get_area(src)]!", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, enter_link = "(Click to enter)", source = src, action = NOTIFY_ATTACK, flashwindow = FALSE) if(!newlymade) posibrain_notif_cooldown = 1 addtimer(CALLBACK(src, .proc/reset_posibrain_cooldown), askDelay) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm b/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm index 5e5a15d095c..67766e42663 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm @@ -20,7 +20,7 @@ ..() var/area/A = get_area(src) if(A) - notify_ghosts("A drone shell has been created in \the [A.name].", source = src, action=NOTIFY_ATTACK) + notify_ghosts("A drone shell has been created in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE) /obj/item/drone_shell/attack_ghost(mob/user) if(jobban_isbanned(user,"drone")) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index edf39c18f1b..74c77055f4e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -731,10 +731,10 @@ var/next_mob_id = 0 if(mind) return mind.grab_ghost(force = force) -/mob/proc/notify_ghost_cloning(var/message = "Someone is trying to revive you. Re-enter your corpse if you want to be revived!", var/sound = 'sound/effects/genetics.ogg', var/atom/source = null) +/mob/proc/notify_ghost_cloning(var/message = "Someone is trying to revive you. Re-enter your corpse if you want to be revived!", var/sound = 'sound/effects/genetics.ogg', var/atom/source = null, flashwindow) var/mob/dead/observer/ghost = get_ghost() if(ghost) - ghost.notify_cloning(message, sound, source) + ghost.notify_cloning(message, sound, source, flashwindow) return ghost /mob/proc/AddSpell(obj/effect/proc_holder/spell/S) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 2624ba4deaa..9ec624c37d0 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -378,12 +378,14 @@ var/static/regex/firstname = new("^\[^\\s-\]+") //First word before whitespace o /mob/proc/reagent_check(datum/reagent/R) // utilized in the species code return 1 -/proc/notify_ghosts(var/message, var/ghost_sound = null, var/enter_link = null, var/atom/source = null, var/image/alert_overlay = null, var/action = NOTIFY_JUMP) //Easy notification of ghosts. +/proc/notify_ghosts(var/message, var/ghost_sound = null, var/enter_link = null, var/atom/source = null, var/image/alert_overlay = null, var/action = NOTIFY_JUMP, flashwindow = TRUE) //Easy notification of ghosts. for(var/mob/dead/observer/O in player_list) if(O.client) O << "[message][(enter_link) ? " [enter_link]" : ""]" if(ghost_sound) O << sound(ghost_sound) + if(flashwindow) + window_flash(O.client) if(source) var/obj/screen/alert/notify_action/A = O.throw_alert("\ref[source]_notify_action", /obj/screen/alert/notify_action) if(A)