Allow players to un-ignore previously ignored popups for ghostroles, and ignore notifications with no ignore button (#38990)

Added a new ghost verb that lets you change your ignore settings, allowing previously ignored popups to be un-ignored and notifications without an ignore button to be ignored
This commit is contained in:
vuonojenmustaturska
2018-07-09 22:24:10 +03:00
committed by yogstation13-bot
parent 51c6eb55c9
commit df79ade176
12 changed files with 116 additions and 28 deletions

View File

@@ -5,5 +5,34 @@
#define POLL_IGNORE_ALIEN_LARVA "alien_larva"
#define POLL_IGNORE_SYNDICATE "syndicate"
#define POLL_IGNORE_HOLOPARASITE "holoparasite"
#define POLL_IGNORE_POSIBRAIN "posibrain"
#define POLL_IGNORE_SPECTRAL_BLADE "spectral_blade"
#define POLL_IGNORE_CONSTRUCT "construct"
#define POLL_IGNORE_SPIDER "spider"
#define POLL_IGNORE_ASHWALKER "ashwalker"
#define POLL_IGNORE_GOLEM "golem"
#define POLL_IGNORE_SWARMER "swarmer"
#define POLL_IGNORE_DRONE "drone"
GLOBAL_LIST_EMPTY(poll_ignore)
GLOBAL_LIST_INIT(poll_ignore_desc, list(
POLL_IGNORE_SENTIENCE_POTION = "Sentience potion",
POLL_IGNORE_POSSESSED_BLADE = "Possessed blade",
POLL_IGNORE_ALIEN_LARVA = "Xenomorph larva",
POLL_IGNORE_SYNDICATE = "Syndicate",
POLL_IGNORE_HOLOPARASITE = "Holoparasite",
POLL_IGNORE_POSIBRAIN = "Positronic brain",
POLL_IGNORE_SPECTRAL_BLADE = "Spectral blade",
POLL_IGNORE_CONSTRUCT = "Construct",
POLL_IGNORE_SPIDER = "Spiders",
POLL_IGNORE_ASHWALKER = "Ashwalker eggs",
POLL_IGNORE_GOLEM = "Golems",
POLL_IGNORE_SWARMER = "Swarmer shells",
POLL_IGNORE_DRONE = "Drone shells",
))
GLOBAL_LIST_INIT(poll_ignore, init_poll_ignore())
/proc/init_poll_ignore()
. = list()
for (var/k in GLOB.poll_ignore_desc)
.[k] = list()

View File

@@ -199,7 +199,7 @@
S.directive = directive
if(player_spiders)
S.playable_spider = TRUE
notify_ghosts("Spider [S.name] can be controlled", null, enter_link="<a href=?src=[REF(S)];activate=1>(Click to play)</a>", source=S, action=NOTIFY_ATTACK)
notify_ghosts("Spider [S.name] can be controlled", null, enter_link="<a href=?src=[REF(S)];activate=1>(Click to play)</a>", source=S, action=NOTIFY_ATTACK, ignore_key = POLL_IGNORE_SPIDER)
qdel(src)

View File

@@ -64,7 +64,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, flashwindow = FALSE)
notify_ghosts("An ash walker egg is ready to hatch in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_ASHWALKER)
/datum/outfit/ashwalker
name ="Ashwalker"
@@ -129,7 +129,7 @@
. = ..()
var/area/A = get_area(src)
if(!mapload && A)
notify_ghosts("\A [initial(species.prefix)] golem shell has been completed in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE)
notify_ghosts("\A [initial(species.prefix)] golem shell has been completed in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_GOLEM)
if(has_owner && creator)
flavour_text = "<span class='big bold'>You are a Golem.</span><b> 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.</b>"

View File

@@ -15,7 +15,7 @@
. = ..()
var/area/A = get_area(src)
if(A && construct_type)
notify_ghosts("A [construct_name] chassis has been created in [A.name]!", 'sound/magic/clockwork/fellowship_armory.ogg', source = src, action = NOTIFY_ATTACK, flashwindow = FALSE)
notify_ghosts("A [construct_name] chassis has been created in [A.name]!", 'sound/magic/clockwork/fellowship_armory.ogg', source = src, action = NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_CONSTRUCT)
GLOB.poi_list += src
LAZYADD(GLOB.mob_spawners[name], src)

View File

@@ -766,7 +766,7 @@
notify_ghosts("[user] is raising [user.p_their()] [src], calling for your help!",
enter_link="<a href=?src=[REF(src)];orbit=1>(Click to help)</a>",
source = user, action=NOTIFY_ORBIT)
source = user, action=NOTIFY_ORBIT, ignore_key = POLL_IGNORE_SPECTRAL_BLADE)
summon_cooldown = world.time + 600

View File

@@ -0,0 +1,49 @@
/mob/dead/observer/verb/show_notificationprefs()
set category = "Ghost"
set name = "Notification preferences"
set desc = "Notification preferences"
var/datum/notificationpanel/panel = new(usr)
panel.ui_interact(usr)
/datum/notificationpanel
var/client/user
/datum/notificationpanel/New(user)
if (ismob(user))
var/mob/M = user
if (!M.client)
CRASH("Ghost role notification panel attempted to open to a mob without a client")
src.user = M.client
else
src.user = user
/datum/notificationpanel/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.observer_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "notificationpanel", "Notification Preferences", 700, 700, master_ui, state)
ui.open()
/datum/notificationpanel/ui_data(mob/user)
. = list()
.["ignore"] = list()
for(var/key in GLOB.poll_ignore_desc)
.["ignore"] += list(list(
"key" = key,
"enabled" = (user.ckey in GLOB.poll_ignore[key]),
"desc" = GLOB.poll_ignore_desc[key]
))
/datum/notificationpanel/ui_act(action, params)
if(..())
return
switch (action)
if ("toggle_ignore")
var/key = params["key"]
if (key && islist(GLOB.poll_ignore[key]))
GLOB.poll_ignore[key] ^= list(user.ckey)
. = TRUE

View File

@@ -36,7 +36,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
/obj/item/mmi/posibrain/proc/ping_ghosts(msg, newlymade)
if(newlymade || GLOB.posibrain_notify_cooldown <= world.time)
notify_ghosts("[name] [msg] in [get_area(src)]!", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, enter_link = "<a href=?src=[REF(src)];activate=1>(Click to enter)</a>", source = src, action = NOTIFY_ATTACK, flashwindow = FALSE)
notify_ghosts("[name] [msg] in [get_area(src)]!", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, enter_link = "<a href=?src=[REF(src)];activate=1>(Click to enter)</a>", source = src, action = NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_POSIBRAIN)
if(!newlymade)
GLOB.posibrain_notify_cooldown = world.time + askDelay

View File

@@ -21,7 +21,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, flashwindow = FALSE)
notify_ghosts("A drone shell has been created in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_DRONE)
GLOB.poi_list |= src
if(isnull(possible_seasonal_hats))
build_seasonal_hats()

View File

@@ -375,11 +375,13 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
/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/mutable_appearance/alert_overlay = null, var/action = NOTIFY_JUMP, flashwindow = TRUE, ignore_mapload = TRUE) //Easy notification of ghosts.
/proc/notify_ghosts(var/message, var/ghost_sound = null, var/enter_link = null, var/atom/source = null, var/mutable_appearance/alert_overlay = null, var/action = NOTIFY_JUMP, flashwindow = TRUE, ignore_mapload = TRUE, ignore_key) //Easy notification of ghosts.
if(ignore_mapload && SSatoms.initialized != INITIALIZATION_INNEW_REGULAR) //don't notify for objects created during a map load
return
for(var/mob/dead/observer/O in GLOB.player_list)
if(O.client)
if (ignore_key && O.ckey in GLOB.poll_ignore[ignore_key])
continue
to_chat(O, "<span class='ghostalert'>[message][(enter_link) ? " [enter_link]" : ""]</span>")
if(ghost_sound)
SEND_SOUND(O, sound(ghost_sound))

View File

@@ -1796,6 +1796,7 @@
#include "code\modules\mob\dead\new_player\sprite_accessories.dm"
#include "code\modules\mob\dead\observer\login.dm"
#include "code\modules\mob\dead\observer\logout.dm"
#include "code\modules\mob\dead\observer\notificationprefs.dm"
#include "code\modules\mob\dead\observer\observer.dm"
#include "code\modules\mob\dead\observer\say.dm"
#include "code\modules\mob\living\blood.dm"

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
<ui-display title='Ghost roles'>
<ui-section label='Ignored roles'>
{{#each data.ignore}}
<ui-button icon='{{enabled ? "check-square-o" : "square-o"}}' style='{{enabled ? "danger" : null}}' action='toggle_ignore' params='{"key": "{{key}}"}'>{{desc}}</ui-button>
{{/each}}
</ui-section>
</ui-display>