Skip to content

Commit

Permalink
[MIRROR] Partially reverts ghost announcements [MDB IGNORE] (#24564)
Browse files Browse the repository at this point in the history
* Partially reverts ghost announcements (#79221)

## About The Pull Request
#79139 turned out to be quite annoying, it wasn't taken into account
that these alerts can stack (ie: spiders).

Of course, I poked around the code and found some inconsistencies in the
process. For instance, there were usages of Topic for custom action
behavior which could've been consolidated. There were other instances
where jump (the default action) doesn't give a link at all, which I
think it should anyway, since the screen toast gives you this.

I've standardized it more, meaning you can use "NOTIFY_PLAY" without
writing a custom link and topic handler (for instance, MMIs)
## Why It's Good For The Game
Fixes #79198
Fixes #79195
## Changelog
:cl:
fix: Ghost alerts have been tuned down a bit.
/:cl:

* Partially reverts ghost announcements

* Update cortical_borer_egg.dm

* Update cortical_borer_egg.dm

---------

Co-authored-by: Jeremiah <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored and FFMirrorBot committed Oct 24, 2023
1 parent 3dd52ac commit f2215bf
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 51 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/atom_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

// Notification action types
#define NOTIFY_JUMP "jump"
#define NOTIFY_ATTACK "attack"
#define NOTIFY_PLAY "play"
#define NOTIFY_ORBIT "orbit"

/// cooldown for being shown the images for any particular data hud
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
return

switch(action)
if(NOTIFY_ATTACK)
if(NOTIFY_PLAY)
target.attack_ghost(ghost_owner)
if(NOTIFY_JUMP)
var/turf/target_turf = get_turf(target)
Expand Down
8 changes: 1 addition & 7 deletions code/game/objects/items/eightball.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,7 @@
// notify ghosts that someone's shaking a haunted eightball
// and inform them of the message, (hopefully a yes/no question)
selected_message = last_message
notify_ghosts("[user] is shaking [src], hoping to get an answer to \"[selected_message]\"", source=src, enter_link="<a href=?src=[REF(src)];interact=1>(Click to help)</a>", action=NOTIFY_ATTACK, header = "Magic eightball")

/obj/item/toy/eightball/haunted/Topic(href, href_list)
. = ..()
if(href_list["interact"])
if(isobserver(usr))
interact(usr)
notify_ghosts("[user] is shaking [src], hoping to get an answer to \"[selected_message]\"", source = src, action = NOTIFY_PLAY, header = "Magic eightball")

/obj/item/toy/eightball/haunted/get_answer()
var/top_amount = 0
Expand Down
14 changes: 14 additions & 0 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(istype(target) && (target != src))
ManualFollow(target)
return

if(href_list["x"] && href_list["y"] && href_list["z"])
var/tx = text2num(href_list["x"])
var/ty = text2num(href_list["y"])
Expand All @@ -750,10 +751,23 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(istype(target))
abstract_move(target)
return

if(href_list["reenter"])
reenter_corpse()
return

if(href_list["jump"])
var/atom/movable/target = locate(href_list["jump"])
var/turf/target_turf = get_turf(target)
if(target_turf && isturf(target_turf))
abstract_move(target_turf)

if(href_list["play"])
var/atom/movable/target = locate(href_list["play"])
if(istype(target) && (target != src))
target.attack_ghost(usr)
return

//We don't want to update the current var
//But we will still carry a mind.
/mob/dead/observer/mind_initialize()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/basic/drone/drones_as_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
. = ..()
var/area/area = get_area(src)
if(area)
notify_ghosts("A drone shell has been created in \the [area.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_DRONE, notify_suiciders = FALSE)
notify_ghosts("A drone shell has been created in \the [area.name].", source = src, action = NOTIFY_PLAY, flashwindow = FALSE, ignore_key = POLL_IGNORE_DRONE, notify_suiciders = FALSE)

/obj/effect/mob_spawn/ghost_role/drone/allow_spawn(mob/user, silent = FALSE)
var/client/user_client = user.client
Expand Down
8 changes: 1 addition & 7 deletions code/modules/mob/living/brain/posibrain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@ GLOBAL_VAR(posibrain_notify_cooldown)
///List of all ckeys who has already entered this posibrain once before.
var/list/ckeys_entered = list()

/obj/item/mmi/posibrain/Topic(href, href_list)
if(href_list["activate"])
var/mob/dead/observer/ghost = usr
if(istype(ghost))
activate(ghost)

///Notify ghosts that the posibrain is up for grabs
/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)]! [ask_role ? "Personality requested: \[[ask_role]\]" : ""]", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, notify_volume = 75, 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, notify_suiciders = FALSE)
notify_ghosts("[name] [msg] in [get_area(src)]! [ask_role ? "Personality requested: \[[ask_role]\]" : ""]", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, notify_volume = 75, source = src, action = NOTIFY_PLAY, flashwindow = FALSE, ignore_key = POLL_IGNORE_POSIBRAIN, notify_suiciders = FALSE)
if(!newlymade)
GLOB.posibrain_notify_cooldown = world.time + ask_delay

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
if(..() && !ready_to_deploy)
SSpoints_of_interest.make_point_of_interest(src)
ready_to_deploy = TRUE
notify_ghosts("An anomalous crystal has been activated in [get_area(src)]! This crystal can always be used by ghosts hereafter.", enter_link = "<a href=?src=[REF(src)];ghostjoin=1>(Click to enter)</a>", ghost_sound = 'sound/effects/ghost2.ogg', source = src, action = NOTIFY_ATTACK, header = "Anomalous crystal activated")
notify_ghosts("An anomalous crystal has been activated in [get_area(src)]! This crystal can always be used by ghosts hereafter.", ghost_sound = 'sound/effects/ghost2.ogg', source = src, action = NOTIFY_PLAY, header = "Anomalous crystal activated")

/obj/machinery/anomalous_crystal/helpers/attack_ghost(mob/dead/observer/user)
. = ..()
Expand All @@ -524,13 +524,6 @@
var/mob/living/basic/lightgeist/deployable = new(get_turf(loc))
deployable.key = user.key


/obj/machinery/anomalous_crystal/helpers/Topic(href, href_list)
if(href_list["ghostjoin"])
var/mob/dead/observer/ghost = usr
if(istype(ghost))
attack_ghost(ghost)

/obj/machinery/anomalous_crystal/possessor //Allows you to bodyjack small animals, then exit them at your leisure, but you can only do this once per activation. Because they blow up. Also, if the bodyjacked animal dies, SO DO YOU.
observer_desc = "When activated, this crystal allows you to take over small animals, and then exit them at the possessors leisure. Exiting the animal kills it, and if you die while possessing the animal, you die as well."
activation_method = ACTIVATE_TOUCH
Expand Down
20 changes: 9 additions & 11 deletions code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,27 @@
if(ignore_mapload && SSatoms.initialized != INITIALIZATION_INNEW_REGULAR) //don't notify for objects created during a map load
return

var/list/viewers = list()
for(var/mob/dead/observer/ghost in GLOB.player_list)
if(!notify_suiciders && HAS_TRAIT(ghost, TRAIT_SUICIDED))
continue
if(ignore_key && (ghost.ckey in GLOB.poll_ignore[ignore_key]))
continue

viewers += ghost // This mob will see the alert

if(flashwindow)
window_flash(ghost.client)

if(ghost_sound)
SEND_SOUND(ghost, sound(ghost_sound, volume = notify_volume))

if(isnull(source))
to_chat(ghost, span_ghostalert(message))
continue

var/custom_link = enter_link ? " [enter_link]" : ""
var/link = " <a href='?src=[REF(ghost)];[action]=[REF(source)]'>([capitalize(action)])</a>"

to_chat(ghost, span_ghostalert("[message][custom_link][link]"))

var/atom/movable/screen/alert/notify_action/toast = ghost.throw_alert(
category = "[REF(source)]_notify_action",
type = /atom/movable/screen/alert/notify_action,
Expand All @@ -301,14 +307,6 @@
toast.name = header
toast.target = source

var/orbit_link
if(source && action == NOTIFY_ORBIT)
orbit_link = " <a href='?src=[REF(usr)];follow=[REF(source)]'>(Orbit)</a>"

var/text = "[message][(enter_link) ? " [enter_link]" : ""][orbit_link]"

minor_announce(text, title = header, players = viewers, html_encode = FALSE, sound_override = ghost_sound, color_override = "purple")

/// Heals a robotic limb on a mob
/proc/item_heal_robotic(mob/living/carbon/human/human, mob/user, brute_heal, burn_heal)
var/obj/item/bodypart/affecting = human.get_bodypart(check_zone(user.zone_selected))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob_spawn/ghost_roles/golem_roles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
. = ..()
var/area/init_area = get_area(src)
if(!mapload && init_area)
notify_ghosts("\A golem shell has been completed in \the [init_area.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_GOLEM)
notify_ghosts("\A golem shell has been completed in \the [init_area.name].", source = src, action = NOTIFY_PLAY, flashwindow = FALSE, ignore_key = POLL_IGNORE_GOLEM)

/obj/effect/mob_spawn/ghost_role/human/golem/name_mob(mob/living/spawned_mob, forced_name)
if(forced_name || !iscarbon(spawned_mob))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob_spawn/ghost_roles/mining_roles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
eggshell.egg = src
src.forceMove(eggshell)
if(spawner_area)
notify_ghosts("An ash walker egg is ready to hatch in \the [spawner_area.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_ASHWALKER)
notify_ghosts("An ash walker egg is ready to hatch in \the [spawner_area.name].", source = src, action = NOTIFY_PLAY, flashwindow = FALSE, ignore_key = POLL_IGNORE_ASHWALKER)

/datum/outfit/ashwalker
name = "Ash Walker"
Expand Down
12 changes: 1 addition & 11 deletions code/modules/mob_spawn/ghost_roles/venus_human_trap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,7 @@
/// Called when the attached flower bud has borne fruit (ie. is ready)
/obj/effect/mob_spawn/ghost_role/venus_human_trap/proc/bear_fruit()
ready = TRUE
notify_ghosts("[src] has borne fruit!", null, enter_link = "<a href=?src=[REF(src)];activate=1>(Click to play)</a>", source = src, action = NOTIFY_ATTACK, ignore_key = POLL_IGNORE_VENUSHUMANTRAP)

/obj/effect/mob_spawn/ghost_role/venus_human_trap/Topic(href, href_list)
. = ..()
if(.)
return
if(href_list["activate"])
var/mob/dead/observer/ghost = usr
if(istype(ghost))
ghost.ManualFollow(src)
attack_ghost(ghost)
notify_ghosts("[src] has borne fruit!", source = src, action = NOTIFY_PLAY, ignore_key = POLL_IGNORE_VENUSHUMANTRAP)

/obj/effect/mob_spawn/ghost_role/venus_human_trap/allow_spawn(mob/user, silent = FALSE)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/singularity/narsie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
var/area/area = get_area(src)
if(area)
var/mutable_appearance/alert_overlay = mutable_appearance('icons/effects/cult/effects.dmi', "ghostalertsie")
notify_ghosts("Nar'Sie has risen in [area]. Reach out to the Geometer to be given a new shell for your soul.", source = src, alert_overlay = alert_overlay, action = NOTIFY_ATTACK)
notify_ghosts("Nar'Sie has risen in [area]. Reach out to the Geometer to be given a new shell for your soul.", source = src, alert_overlay = alert_overlay, action = NOTIFY_PLAY)
narsie_spawn_animation()

GLOB.cult_narsie = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
forceMove(host_egg)
var/area/src_area = get_area(src)
if(src_area)
notify_ghosts("A cortical borer egg has been laid in \the [src_area.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE, ignore_key = POLL_IGNORE_DRONE, notify_suiciders = FALSE)
notify_ghosts("A cortical borer egg has been laid in \the [src_area.name].", source = src, action = NOTIFY_PLAY, flashwindow = FALSE, ignore_key = POLL_IGNORE_DRONE, notify_suiciders = FALSE)

/obj/item/borer_egg
name = "borer egg"
Expand Down

0 comments on commit f2215bf

Please sign in to comment.