From 02b5a096dee3216e93efa27e843ef32deb209b00 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Thu, 12 Jan 2017 18:55:23 +0400 Subject: [PATCH 1/6] windowflash proc, windowflash on notify_ghosts, pollcandidates, adminhelp and adminpm --- code/__HELPERS/game.dm | 10 ++++++++-- code/modules/admin/verbs/adminhelp.dm | 1 + code/modules/admin/verbs/adminpm.dm | 1 + code/modules/mob/mob_helpers.dm | 8 +++++--- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 69ea87f8fda..e3995e91ed5 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -418,7 +418,7 @@ /proc/SecondsToTicks(var/seconds) return seconds * 10 -proc/pollCandidates(var/Question, var/be_special_type, var/antag_age_check = 0, var/poll_time = 300, var/ignore_respawnability = 0, var/min_hours = 0) +proc/pollCandidates(var/Question, var/be_special_type, var/antag_age_check = 0, var/poll_time = 300, var/ignore_respawnability = 0, var/min_hours = 0, var/flashwindow = TRUE) var/roletext = be_special_type ? get_roletext(be_special_type) : null var/list/mob/dead/observer/candidates = list() var/time_passed = world.time @@ -444,7 +444,8 @@ proc/pollCandidates(var/Question, var/be_special_type, var/antag_age_check = 0, continue spawn(0) G << 'sound/misc/notice2.ogg'//Alerting them to their consideration - + if(flashwindow) + window_flash(G.client) switch(alert(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No","Not This Round")) if("Yes") to_chat(G, "Choice registered: Yes.") @@ -471,3 +472,8 @@ proc/pollCandidates(var/Question, var/be_special_type, var/antag_age_check = 0, candidates.Remove(G) return candidates + +/proc/window_flash(var/client_or_usr) + if (!client_or_usr) + return + winset(client_or_usr, "mainwindow", "flash=5") \ No newline at end of file diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index c17671995ff..73b481bbc6b 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -119,6 +119,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," for(var/client/X in modholders + adminholders) if(X.prefs.sound & SOUND_ADMINHELP) X << 'sound/effects/adminhelp.ogg' + window_flash(X) to_chat(X, msg) //show it to the person adminhelping too diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 63241ce43c5..8cc1d0a6ec1 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -133,6 +133,7 @@ if(holder && !C.holder) recieve_message = "-- Click the [recieve_pm_type]'s name to reply --\n" if(C.adminhelped) + window_flash(C) to_chat(C, recieve_message) C.adminhelped = 0 diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 0b04647d094..65d23b648ea 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -434,12 +434,14 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HARM) lname = "[lname] " to_chat(M, "[lname][follow][message]") -/proc/notify_ghosts(var/message, var/ghost_sound = null, var/enter_link = null, var/atom/source = null, var/image/alert_overlay = null, var/attack_not_jump = 0) //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/attack_not_jump = 0, var/flashwindow = TRUE) //Easy notification of ghosts. for(var/mob/dead/observer/O in player_list) if(O.client) to_chat(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_jump/A = O.throw_alert("\ref[source]_notify_jump", /obj/screen/alert/notify_jump) if(A) @@ -586,8 +588,8 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HARM) if(5) newletter="glor" newphrase+="[newletter]";counter-=1 - return newphrase - + return newphrase + /mob/proc/get_preference(toggleflag) if(!client) return FALSE From 11c0cb73f6f5e6a8222f537d22c3a08f477d6d53 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Thu, 12 Jan 2017 19:44:18 +0400 Subject: [PATCH 2/6] added it to defib, cloning, strange reagent --- code/game/objects/items/weapons/defib.dm | 2 ++ code/modules/mob/mob.dm | 4 +++- code/modules/reagents/chemistry/reagents/medicine.dm | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index eda6d74b296..924b5e3d590 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -424,6 +424,7 @@ else if(ghost) user.visible_message("[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.") to_chat(ghost, "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)") + window_flash(ghost.client) ghost << sound('sound/effects/genetics.ogg') else user.visible_message("[defib] buzzes: Resuscitation failed.") @@ -546,6 +547,7 @@ else if(ghost) user.visible_message("[user] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.") to_chat(ghost, "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)") + window_flash(ghost.client) ghost << sound('sound/effects/genetics.ogg') else user.visible_message("[user] buzzes: Resuscitation failed.") diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6293707cdc8..1029a31ffd6 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1222,9 +1222,11 @@ mob/proc/yank_out_object() 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, var/flashwindow = TRUE) var/mob/dead/observer/ghost = get_ghost() if(ghost) + if(flashwindow) + window_flash(ghost.client) ghost.notify_cloning(message, sound, source) return ghost diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index de539ef52ba..279be3fa032 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -635,7 +635,8 @@ return var/mob/dead/observer/ghost = M.get_ghost() if(ghost) - to_chat(ghost, "Your are attempting to be revived with Strange Reagent. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)") + to_chat(ghost, "You are attempting to be revived with Strange Reagent. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)") + window_flash(ghost.client) ghost << sound('sound/effects/genetics.ogg') M.visible_message("[M] doesn't appear to respond, perhaps try again later?") if(!M.suiciding && !ghost && !(NOCLONE in M.mutations)) From 770408636f03022f4177b63288d102d6a1112c97 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Thu, 12 Jan 2017 21:20:16 +0400 Subject: [PATCH 3/6] attempt to add pref option --- SQL/paradise_schema.sql | 1 + SQL/paradise_schema_prefixed.sql | 1 + code/__HELPERS/game.dm | 8 +++++--- code/modules/client/preference/preferences.dm | 5 +++++ code/modules/client/preference/preferences_mysql.dm | 5 ++++- code/modules/mob/mob.dm | 2 +- code/modules/mob/mob_helpers.dm | 2 +- 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index 0b450df9848..ed0845ed33f 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -274,6 +274,7 @@ CREATE TABLE `player` ( `nanoui_fancy` smallint(4) DEFAULT '1', `show_ghostitem_attack` smallint(4) DEFAULT '1', `lastchangelog` varchar(32) NOT NULL DEFAULT '0', + `windowflashing` smallint(4) DEFAULT '1', `exp` mediumtext, PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index 2489e6cb325..216082157d4 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -273,6 +273,7 @@ CREATE TABLE `SS13_player` ( `nanoui_fancy` smallint(4) DEFAULT '1', `show_ghostitem_attack` smallint(4) DEFAULT '1', `lastchangelog` varchar(32) NOT NULL DEFAULT '0', + `windowflashing` smallint(4) DEFAULT '1', `exp` mediumtext, PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index e3995e91ed5..2ba83923d15 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -418,7 +418,7 @@ /proc/SecondsToTicks(var/seconds) return seconds * 10 -proc/pollCandidates(var/Question, var/be_special_type, var/antag_age_check = 0, var/poll_time = 300, var/ignore_respawnability = 0, var/min_hours = 0, var/flashwindow = TRUE) +proc/pollCandidates(Question, be_special_type, antag_age_check = 0, poll_time = 300, ignore_respawnability = 0, min_hours = 0, flashwindow = TRUE) var/roletext = be_special_type ? get_roletext(be_special_type) : null var/list/mob/dead/observer/candidates = list() var/time_passed = world.time @@ -473,7 +473,9 @@ proc/pollCandidates(var/Question, var/be_special_type, var/antag_age_check = 0, return candidates -/proc/window_flash(var/client_or_usr) - if (!client_or_usr) +/proc/window_flash(client_or_usr) + if(!client_or_usr) + return + if(!client_or_usr.client.prefs.windowflashing) return winset(client_or_usr, "mainwindow", "flash=5") \ No newline at end of file diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 09cef84894c..f15557a16e6 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -93,6 +93,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts var/show_ghostitem_attack = TRUE var/UI_style_color = "#ffffff" var/UI_style_alpha = 255 + var/windowflashing = TRUE //character preferences @@ -418,6 +419,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts dat += "

General Settings

" dat += "Fancy NanoUI: [(nanoui_fancy) ? "Yes" : "No"]
" dat += "Ghost-Item Attack Animation: [(show_ghostitem_attack) ? "Yes" : "No"]
" + dat += "Window Flashing: [(windowflashing) ? "Yes" : "No"]
" dat += "Custom UI settings:
" dat += " - UI Style: [UI_style]
" dat += " - Color: [UI_style_color]
__

" @@ -1935,6 +1937,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if("ghost_att_anim") show_ghostitem_attack = !show_ghostitem_attack + if("winflash") + windowflashing = !windowflashing + if("UIcolor") var/UI_style_color_new = input(user, "Choose your UI color, dark colors are not recommended!", UI_style_color) as color|null if(!UI_style_color_new) return diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm index 581daf222d3..63035b0e4e3 100644 --- a/code/modules/client/preference/preferences_mysql.dm +++ b/code/modules/client/preference/preferences_mysql.dm @@ -14,7 +14,8 @@ nanoui_fancy, show_ghostitem_attack, lastchangelog, - exp + exp, + windowflashing FROM [format_table_name("player")] WHERE ckey='[C.ckey]'"} ) @@ -42,6 +43,7 @@ show_ghostitem_attack = text2num(query.item[12]) lastchangelog = query.item[13] exp = query.item[14] + windowflashing = text2num(query.item[15]) //Sanitize ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor)) @@ -57,6 +59,7 @@ show_ghostitem_attack = sanitize_integer(show_ghostitem_attack, 0, 1, initial(show_ghostitem_attack)) lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog)) exp = sanitize_text(exp, initial(exp)) + windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing)) return 1 /datum/preferences/proc/save_preferences(client/C) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 1029a31ffd6..8a1a8d34302 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1222,7 +1222,7 @@ mob/proc/yank_out_object() 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, var/flashwindow = TRUE) +/mob/proc/notify_ghost_cloning(message = "Someone is trying to revive you. Re-enter your corpse if you want to be revived!", sound = 'sound/effects/genetics.ogg', atom/source = null, flashwindow = TRUE) var/mob/dead/observer/ghost = get_ghost() if(ghost) if(flashwindow) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 65d23b648ea..483b765b65e 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -434,7 +434,7 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HARM) lname = "[lname] " to_chat(M, "[lname][follow][message]") -/proc/notify_ghosts(var/message, var/ghost_sound = null, var/enter_link = null, var/atom/source = null, var/image/alert_overlay = null, var/attack_not_jump = 0, var/flashwindow = TRUE) //Easy notification of ghosts. +/proc/notify_ghosts(message, ghost_sound = null, enter_link = null, atom/source = null, image/alert_overlay = null, attack_not_jump = 0, flashwindow = TRUE) //Easy notification of ghosts. for(var/mob/dead/observer/O in player_list) if(O.client) to_chat(O, "[message][(enter_link) ? " [enter_link]" : ""]") From 50145c86a0c7659629a2a222d49858db0136eccc Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Thu, 12 Jan 2017 22:14:07 +0400 Subject: [PATCH 4/6] attempt to fix --- code/__HELPERS/game.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 2ba83923d15..4c33effc051 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -473,9 +473,10 @@ proc/pollCandidates(Question, be_special_type, antag_age_check = 0, poll_time = return candidates -/proc/window_flash(client_or_usr) - if(!client_or_usr) - return - if(!client_or_usr.client.prefs.windowflashing) - return - winset(client_or_usr, "mainwindow", "flash=5") \ No newline at end of file +/proc/window_flash(client/C) + if(ismob(C)) + var/mob/M = C + C = M.client + if(!C.prefs.windowflashing) + return + winset(C, "mainwindow", "flash=5") \ No newline at end of file From 5e7521cb799649637c48908c98a134d796334c7a Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Thu, 19 Jan 2017 18:34:08 +0400 Subject: [PATCH 5/6] check for client and check for mob client --- code/__HELPERS/game.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 4c33effc051..c645cc39624 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -474,9 +474,10 @@ proc/pollCandidates(Question, be_special_type, antag_age_check = 0, poll_time = return candidates /proc/window_flash(client/C) - if(ismob(C)) - var/mob/M = C - C = M.client - if(!C.prefs.windowflashing) - return - winset(C, "mainwindow", "flash=5") \ No newline at end of file + if(ismob(C)) + var/mob/M = C + if(M.client) + C = M.client + if(!C.prefs.windowflashing || !C) + return + winset(C, "mainwindow", "flash=5") \ No newline at end of file From 79d43f763b1dc7f0ad29e6857059d4e278bd41dc Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Thu, 26 Jan 2017 20:57:29 +0400 Subject: [PATCH 6/6] reorder check for client --- code/__HELPERS/game.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index c645cc39624..e69f724e80e 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -478,6 +478,6 @@ proc/pollCandidates(Question, be_special_type, antag_age_check = 0, poll_time = var/mob/M = C if(M.client) C = M.client - if(!C.prefs.windowflashing || !C) + if(!C || !C.prefs.windowflashing) return winset(C, "mainwindow", "flash=5") \ No newline at end of file