diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index c0b510111f..f849c99ec2 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -93,6 +93,8 @@ GLOBAL_LIST_EMPTY(PDAs) var/underline_flag = TRUE //flag for underline + var/list/blocked_pdas + /obj/item/pda/suicide_act(mob/living/carbon/user) var/deathMessage = msg_input(user) if (!deathMessage) @@ -387,7 +389,10 @@ GLOBAL_LIST_EMPTY(PDAs) for (var/obj/item/pda/P in sortNames(get_viewable_pdas())) if (P == src) continue - dat += "
  • [P]" + if(P.owner in blocked_pdas) + dat += "
  • (BLOCKED - CLICK TO UNBLOCK) [P]" + else + dat += "
  • [P]" if(cartridge) dat += cartridge.message_special(P) dat += "
  • " @@ -646,6 +651,15 @@ GLOBAL_LIST_EMPTY(PDAs) if("MessageAll") send_to_all(U) + if("toggle_block") + toggle_blocking(usr, href_list["target"]) + + if("block_pda") + block_pda(usr, href_list["target"]) + + if("unblock_pda") + unblock_pda(usr, href_list["target"]) + if("cart") if(cartridge) cartridge.special(U, href_list) @@ -744,9 +758,16 @@ GLOBAL_LIST_EMPTY(PDAs) message += "\nSent from my PDA" // Send the signal var/list/string_targets = list() - for (var/obj/item/pda/P in targets) - if (P.owner && P.ownjob) // != src is checked by the UI + var/list/string_blocked + for(var/obj/item/pda/P in targets) + if(owner in P.blocked_pdas) + LAZYADD(string_blocked, P.owner) + continue + if(P.owner && P.ownjob) // != src is checked by the UI string_targets += "[P.owner] ([P.ownjob])" + if(string_blocked) + string_blocked = english_list(string_blocked) + to_chat(user, "[icon2html(src, user)] The following recipients have blocked your message: [string_blocked].") for (var/obj/machinery/computer/message_monitor/M in targets) // In case of "Reply" to a message from a console, this will make the // message be logged successfully. If the console is impersonating @@ -779,12 +800,13 @@ GLOBAL_LIST_EMPTY(PDAs) tnote += "→ To [target_text]:
    [signal.format_message()]
    " // Show it to ghosts var/ghost_message = "[owner] PDA Message --> [target_text]: [signal.format_message(TRUE)]" - for(var/mob/M in GLOB.player_list) - if(isobserver(M) && M.client && (M.client.prefs.chat_toggles & CHAT_GHOSTPDA)) + for(var/i in GLOB.dead_mob_list) + var/mob/M = i + if(M?.client.prefs.chat_toggles & CHAT_GHOSTPDA) to_chat(M, "[FOLLOW_LINK(M, user)] [ghost_message]") - // Log in the talk log - user.log_talk(message, LOG_PDA, tag="PDA: [initial(name)] to [target_text]") to_chat(user, "Message sent to [target_text]: \"[emoji_message]\"") + // Log in the talk log + user.log_talk(message, LOG_PDA, tag="PDA: [initial(name)] to [target_text] (BLOCKED:[string_blocked])") if (!silent) playsound(src, 'sound/machines/terminal_success.ogg', 15, 1) // Reset the photo @@ -794,8 +816,7 @@ GLOBAL_LIST_EMPTY(PDAs) last_everyone = world.time /obj/item/pda/proc/receive_message(datum/signal/subspace/pda/signal) - tnote += "← From [signal.data["name"]] ([signal.data["job"]]):
    [signal.format_message()]
    " - + tnote += "← From [signal.data["name"]] ([signal.data["job"]]): (BLOCK/UNBLOCK)
    [signal.format_message()]
    " if (!silent) playsound(src, 'sound/machines/twobeep.ogg', 50, 1) audible_message("[icon2html(src, hearers(src))] *[ttone]*", null, 3) @@ -814,7 +835,7 @@ GLOBAL_LIST_EMPTY(PDAs) hrefstart = "" hrefend = "" - to_chat(L, "[icon2html(src)] Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], [signal.format_message(TRUE)] (Reply)") + to_chat(L, "[icon2html(src)] Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], [signal.format_message(TRUE)] (Reply) (BLOCK/UNBLOCK)") update_icon(TRUE) @@ -827,6 +848,20 @@ GLOBAL_LIST_EMPTY(PDAs) /obj/item/pda/proc/create_message(mob/living/U, obj/item/pda/P) send_message(U,list(P)) +/obj/item/pda/proc/toggle_blocking(mob/user, target) + if(target in blocked_pdas) + unblock_pda(user, target) + else + block_pda(user, target) + +/obj/item/pda/proc/block_pda(mob/user, target) + to_chat(user, "[icon2html(src, user)] [target] blocked from messages. Use the messenger PDA list to unblock.") + LAZYOR(blocked_pdas, target) + +/obj/item/pda/proc/unblock_pda(mob/user, target) + to_chat(user, "[icon2html(src, user)] [target] unblocked from messages.") + LAZYREMOVE(blocked_pdas, target) + /obj/item/pda/AltClick(mob/user) . = ..() if(id) @@ -1172,4 +1207,4 @@ GLOBAL_LIST_EMPTY(PDAs) #undef PDA_OVERLAY_ID #undef PDA_OVERLAY_ITEM #undef PDA_OVERLAY_LIGHT -#undef PDA_OVERLAY_PAI \ No newline at end of file +#undef PDA_OVERLAY_PAI