Skip to content

Commit

Permalink
PDA Messages are once again shown to non-observing dead mobs (tgstati…
Browse files Browse the repository at this point in the history
…on#77750)

Current implementation uses isobserver for checking if we should send to
the player but dead players (who are still in their body) are not
observers and will fail that check.
  • Loading branch information
ZephyrTFA authored Aug 22, 2023
1 parent ea3ea6c commit 3923814
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
1 change: 0 additions & 1 deletion code/game/machinery/telecomms/machines/message_server.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
for (var/datum/computer_file/program/messenger/app in data["targets"])
if(!QDELETED(app))
app.receive_message(src)
data["targets"] = null

// Request Console signal datum
/datum/signal/subspace/messaging/rc/broadcast()
Expand Down
20 changes: 13 additions & 7 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,20 @@ GLOBAL_LIST_EMPTY(preferences_datums)
* Arguments:
* * client/prefs_holder - the client to get the chat_toggles pref from.
*/
/proc/get_chat_toggles(client/prefs_holder)
if(!prefs_holder)
return FALSE
if(prefs_holder && !prefs_holder?.prefs)
stack_trace("[prefs_holder?.mob] ([prefs_holder?.ckey]) had null prefs, which shouldn't be possible!")
return FALSE
/proc/get_chat_toggles(client/target)
if(ismob(target))
var/mob/target_mob = target
target = target_mob.client

if(isnull(target))
return NONE

var/datum/preferences/preferences = target.prefs
if(isnull(preferences))
stack_trace("[key_name(target)] preference datum was null")
return NONE

return prefs_holder?.prefs.chat_toggles
return preferences.chat_toggles

/// Sanitizes the preferences, applies the randomization prefs, and then applies the preference to the human mob.
/datum/preferences/proc/safe_transfer_prefs_to(mob/living/carbon/human/character, icon_updates = TRUE, is_antag = FALSE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,11 @@

// Show it to ghosts
var/ghost_message = span_game_say("[span_name("[sender]")] [rigged ? "(as [span_name(fake_name)]) Rigged " : ""]PDA Message --> [span_name("[signal.format_target()]")]: \"[signal.format_message()]\"")
var/list/ghosts = GLOB.dead_player_list + GLOB.current_observers_list
for(var/mob/player_mob as anything in ghosts)
if(isobserver(player_mob) && (get_chat_toggles(player_mob.client) & CHAT_GHOSTPDA))
to_chat(player_mob, "[FOLLOW_LINK(player_mob, sender)] [ghost_message]")
var/list/message_listeners = GLOB.dead_player_list + GLOB.current_observers_list
for(var/mob/listener as anything in message_listeners)
if(!(get_chat_toggles(listener) & CHAT_GHOSTPDA))
continue
to_chat(listener, "[FOLLOW_LINK(listener, sender)] [ghost_message]")

to_chat(sender, span_info("PDA message sent to [signal.format_target()]: \"[message]\""))

Expand Down

0 comments on commit 3923814

Please sign in to comment.