From c0d3855d53dee96589584da30a4690d6e63282e3 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Mon, 6 Feb 2017 12:19:33 -0800 Subject: [PATCH] Goonchat Admin Filters This adds Message filters to Goonchat (only for mentors + administrators). There is a new option in the settings dropdown of Goonchat to access these. They are temporary, non-destructive filters which will hide all messages matching them that are already in your chat, as well as any new messages matching them. There are 5 filters currently: - Admin; Filters out most admin logs. - Combat; Filters out a limited subset of combat messages- Specifically, any message with the 'combat' span class. Currently, this has only been added to the central /attack and /attacked_by procs, so a large considerable amount of hostile actions taken against a player are still not going to be filtered out. We can work on adding the identifier to more stuff later. - Radios: Filters out all radio messages. - Speech: Filters out all mob speech. - OOC: Filters out OOC chat. There is also an "All" option, which just turns off all messages that are not internal to Goonchat. --- code/_onclick/item_attack.dm | 6 +- code/modules/admin/admin_verbs.dm | 6 +- code/modules/admin/holder2.dm | 1 + code/modules/client/client procs.dm | 1 + .../mob/living/carbon/human/human_defense.dm | 16 +-- goon/browserassets/html/adminOutput.html | 104 ++++++++++++++++++ goon/browserassets/js/browserOutput.js | 2 +- goon/code/datums/browserOutput.dm | 5 + 8 files changed, 128 insertions(+), 13 deletions(-) create mode 100644 goon/browserassets/html/adminOutput.html diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 46368def984..4c9f57d4e4e 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -161,13 +161,13 @@ for(var/mob/O in viewers(messagesource, null)) if(attack_verb.len) - O.show_message("[M] has been [pick(attack_verb)] with [src][showname] ", 1) + O.show_message("[M] has been [pick(attack_verb)] with [src][showname] ", 1) else - O.show_message("[M] has been attacked with [src][showname] ", 1) + O.show_message("[M] has been attacked with [src][showname] ", 1) if(!showname && user) if(user.client) - to_chat(user, "You attack [M] with [src]. ") + to_chat(user, "You attack [M] with [src]. ") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 6b2224962f5..ac419bcb592 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -166,7 +166,7 @@ var/list/admin_verbs_debug = list( /client/proc/admin_serialize, /client/proc/admin_deserialize, /client/proc/jump_to_ruin, - /client/proc/toggle_medal_disable + /client/proc/toggle_medal_disable ) var/list/admin_verbs_possess = list( /proc/possess, @@ -213,6 +213,10 @@ var/list/admin_verbs_snpc = list( /client/proc/hide_snpc_verbs ) +/client/proc/on_holder_add() + if(chatOutput && chatOutput.loaded) + chatOutput.loadAdmin() + /client/proc/add_admin_verbs() if(holder) verbs += admin_verbs_default diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 7ee714090cc..de22d5ea098 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -32,6 +32,7 @@ var/list/admin_datums = list() if(istype(C)) owner = C owner.holder = src + owner.on_holder_add() owner.add_admin_verbs() //TODO owner.verbs -= /client/proc/readmin admins |= C diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 6e1fe9126fd..a701727f174 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -331,6 +331,7 @@ world.update_status() if(holder) + on_holder_add() add_admin_verbs() admin_memo_output("Show", 0, 1) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 986a3ffb9c4..65361960042 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -57,7 +57,7 @@ emp_act organ.add_autopsy_data(P.name, P.damage) // Add the bullet's name to the autopsy data return (..(P , def_zone)) - + /mob/living/carbon/human/check_projectile_dismemberment(obj/item/projectile/P, def_zone) var/obj/item/organ/external/affecting = get_organ(check_zone(def_zone)) if(affecting && !affecting.cannot_amputate && affecting.get_damage() >= (affecting.max_damage - P.dismemberment)) @@ -67,7 +67,7 @@ emp_act damtype = DROPLIMB_BLUNT if(BURN) damtype = DROPLIMB_BURN - + affecting.droplimb(FALSE, damtype) /mob/living/carbon/human/getarmor(var/def_zone, var/type) @@ -226,9 +226,9 @@ emp_act if(! I.discrete) if(I.attack_verb.len) - visible_message("[src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!") + visible_message("[src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!") else - visible_message("[src] has been attacked in the [hit_area] with [I.name] by [user]!") + visible_message("[src] has been attacked in the [hit_area] with [I.name] by [user]!") var/armor = run_armor_check(affecting, "melee", "Your armor has protected your [hit_area].", "Your armor has softened hit to your [hit_area].", armour_penetration = I.armour_penetration) var/weapon_sharp = is_sharp(I) @@ -264,8 +264,8 @@ emp_act if("head")//Harder to score a stun but if you do it lasts a bit longer if(stat == CONSCIOUS && armor < 50) if(prob(I.force)) - visible_message("[src] has been knocked down!", \ - "[src] has been knocked down!") + visible_message("[src] has been knocked down!", \ + "[src] has been knocked down!") apply_effect(5, WEAKEN, armor) AdjustConfused(15) if(prob(I.force + ((100 - health)/2)) && src != user && I.damtype == BRUTE) @@ -284,8 +284,8 @@ emp_act if("upper body")//Easier to score a stun but lasts less time if(stat == CONSCIOUS && I.force && prob(I.force + 10)) - visible_message("[src] has been knocked down!", \ - "[src] has been knocked down!") + visible_message("[src] has been knocked down!", \ + "[src] has been knocked down!") apply_effect(5, WEAKEN, armor) if(bloody) diff --git a/goon/browserassets/html/adminOutput.html b/goon/browserassets/html/adminOutput.html new file mode 100644 index 00000000000..baf8bc00b3b --- /dev/null +++ b/goon/browserassets/html/adminOutput.html @@ -0,0 +1,104 @@ + \ No newline at end of file diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 538452dc472..88b9a5425af 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -396,7 +396,7 @@ function ehjaxCallback(data) { dataJ = $.parseJSON(data); } catch (e) { //But...incorrect :sadtrombone: - window.onerror('JSON: '+e+'. '+data, 'browserOutput.html', 327); + window.onerror('JSON: '+e+'. '+data+'; data.length = '+data.length, 'browserOutput.html', 327); return; } data = dataJ; diff --git a/goon/code/datums/browserOutput.dm b/goon/code/datums/browserOutput.dm index aefb719afa4..27307cbccdb 100644 --- a/goon/code/datums/browserOutput.dm +++ b/goon/code/datums/browserOutput.dm @@ -99,6 +99,8 @@ var/list/chatResources = list( loaded = TRUE winset(owner, "browseroutput", "is-disabled=false") + if(owner.holder) + loadAdmin() for(var/message in messageQueue) to_chat(owner, message) @@ -119,6 +121,9 @@ var/list/chatResources = list( data = json_encode(data) C << output("[data]", "[window]:ehjaxCallback") +/datum/chatOutput/proc/loadAdmin() + var/data = json_encode(list("loadAdminCode" = replacetext(replacetext(file2text("goon/browserassets/html/adminOutput.html"), "\n", ""), "\t", ""))) + ehjax_send(data = url_encode(data)) /datum/chatOutput/proc/sendClientData() var/list/deets = list("clientData" = list())