Files
Bubberstation/code/modules/admin/admin_pda_message.dm
SpaceLoveSs13 a9ff046352 Administrator Cherrypick (#27405)
* Admin Verb Datums MkIII | Now with functional command bar (#82511)

* Modular stuffs

* Put some admin jump verbs back into the context menu | sorts area jump list again (#82647)

## About The Pull Request

See title.

## Why It's Good For The Game

Some admins wanted all the jump verbs back, aswell as making them not
AGhost you.
Also make the Jump To Area verb use a sorted list again

* Hey what if admins were allowed to use the player panel (#82682)

Re-adds the player panel verb to the verb panel.

* Controller Overview UI (#82739)

* Fixes a minor spelling mistake on the admin panel/verb list (#82747)

## About The Pull Request

Corrects `inisimin` to `invisimin`. This addresses #82728, but only
fixes one of the two issues mentioned

## Why It's Good For The Game

-1 spelling mistake

## Changelog
🆑
spellcheck: 'inisimin' verb corrected to 'invisimin'
/🆑

* Player Panel-age (#82757)

* Admin Forced Mob Rename and Preference Update (#82715)

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
Co-authored-by: chel <64568243+iliyaxox@users.noreply.github.com>
2024-04-23 20:43:45 +02:00

95 lines
2.8 KiB
Plaintext

ADMIN_VERB(message_pda, R_ADMIN, "PDA Message", "Send a message to a user's PDA.", ADMIN_CATEGORY_EVENTS)
user.holder.message_pda()
///Opens up the PDA Message Panel
/datum/admins/proc/message_pda()
if(!check_rights(R_ADMIN))
return
if(!length(GLOB.pda_messengers))
to_chat(usr, span_warning("ERROR: There are no users you can send a message to"))
return
var/datum/admin_pda_panel/ui = new(usr)
ui.ui_interact(usr)
/// Panel
/datum/admin_pda_panel
/datum/admin_pda_panel/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AdminPDA")
ui.open()
/datum/admin_pda_panel/ui_state(mob/user)
return GLOB.admin_state
/datum/admin_pda_panel/ui_static_data(mob/user)
var/list/data = list()
var/list/available_messengers = list()
for(var/messenger_ref in get_messengers_sorted_by_name())
var/datum/computer_file/program/messenger/messenger = GLOB.pda_messengers[messenger_ref]
available_messengers[REF(messenger)] = list(
ref = REF(messenger),
username = get_messenger_name(messenger),
invisible = messenger.invisible,
)
data["users"] = available_messengers
return data
/datum/admin_pda_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
if(..())
return
if(!check_rights(R_ADMIN))
return
switch(action)
if("sendMessage")
var/targets = list()
var/spam = params["spam"]
var/ref = params["ref"]
var/force = params["force"]
if(!spam && (ref in GLOB.pda_messengers))
targets += GLOB.pda_messengers[ref]
else
for(var/messenger_ref in get_messengers_sorted_by_name())
var/datum/computer_file/program/messenger/messenger = GLOB.pda_messengers[messenger_ref]
if(messenger.invisible && !params["include_invisible"])
continue
targets += messenger
if(!length(targets))
to_chat(usr, span_warning("ERROR: Target is unavailable."))
return FALSE
var/datum/signal/subspace/messaging/tablet_message/signal = new(null, list(
"fakename" = params["name"],
"fakejob" = params["job"],
"message" = params["message"],
"everyone" = spam,
"ref" = null,
"targets" = targets,
"rigged" = FALSE,
"automated" = FALSE,
))
if(force)
signal.broadcast()
else
signal.levels = SSmapping.levels_by_trait(ZTRAIT_STATION)
signal.send_to_receivers()
if(!(force || signal.data["reject"]))
to_chat(usr, span_warning("ERROR: PDA message was rejected by the telecomms setup."))
return FALSE
var/recipient = spam ? "everyone" : get_messenger_name(targets[1])
message_admins("[key_name_admin(usr)] sent a custom PDA message to [recipient].")
log_admin("[key_name(usr)] sent a custom PDA message to [recipient]. Message: [params["message"]].")
log_pda("[key_name(usr)] sent an admin custom PDA message to [recipient]. Message: [params["message"]]")
return TRUE