Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add Send Admin Message functionality #67874

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions code/game/machinery/telecomms/computers/message.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
var/message = "<span class='notice'>System bootup complete. Please select an option.</span>" // The message that shows on the main menu.
var/auth = FALSE // Are they authenticated?
var/optioncount = 7
// Custom Message Properties
var/customsender = "System Administrator"
var/customrecepient = null
var/customjob = "Admin"
var/custommessage = "This is a test, please ignore."



/obj/machinery/computer/message_monitor/screwdriver_act(mob/living/user, obj/item/I)
if(obj_flags & EMAGGED)
Expand Down Expand Up @@ -183,6 +190,24 @@
10010000001110100011010000110000101110100001000000111010<br>
001101001011011010110010100101110"}

//Fake messages
if(MSG_MON_SCREEN_CUSTOM_MSG)
dat += "<center><A href='?src=[REF(src)];back=1'>Back</a> - <A href='?src=[REF(src)];Reset=1'>Reset</a></center><hr>"

dat += {"<table border='1' width='100%'>
<tr><td width='20%'><A href='?src=[REF(src)];select=Sender'>Sender</a></td>
<td width='20%'><A href='?src=[REF(src)];select=RecJob'>Sender's Job</a></td>
<td width='20%'><A href='?src=[REF(src)];select=Recepient'>Recipient</a></td>
<td width='300px' word-wrap: break-word><A href='?src=[REF(src)];select=Message'>Message</a></td></tr>"}
//Sender - Sender's Job - Recepient - Message
//Al Green- Your Dad - Your Mom - WHAT UP!?

dat += {"<tr><td width='20%'>[customsender]</td>
<td width='20%'>[customjob]</td>
<td width='20%'>[customrecepient ? customrecepient : "NONE"]</td>
<td width='300px'>[custommessage]</td></tr>"}
dat += "</table><br><center><A href='?src=[REF(src)];select=Send'>Send</a>"

//Request Console Logs
if(MSG_MON_SCREEN_REQUEST_LOGS)

Expand Down Expand Up @@ -226,6 +251,12 @@
/obj/machinery/computer/message_monitor/proc/UnmagConsole()
obj_flags &= ~EMAGGED

/obj/machinery/computer/message_monitor/proc/ResetMessage()
customsender = "System Administrator"
customrecepient = null
custommessage = "This is a test, please ignore."
customjob = "Admin"

/obj/machinery/computer/message_monitor/Topic(href, href_list)
if(..())
return
Expand Down Expand Up @@ -334,6 +365,77 @@
linkedServer.rc_msgs -= locate(href_list["delete_requests"]) in linkedServer.rc_msgs
message = span_notice("NOTICE: Log Deleted!")

//Create a custom message
if (href_list["msg"])
if(LINKED_SERVER_NONRESPONSIVE)
message = noserver
else if(auth)
screen = MSG_MON_SCREEN_CUSTOM_MSG

//Fake messaging selection - KEY REQUIRED
if (href_list["select"])
if(LINKED_SERVER_NONRESPONSIVE)
message = noserver
screen = MSG_MON_SCREEN_MAIN
else
switch(href_list["select"])

//Reset
if("Reset")
ResetMessage()

//Select Your Name
if("Sender")
customsender = tgui_input_text(usr, "Please enter the sender's name.", "Sender") || customsender

//Select Receiver
if("Recepient")
// Get out list of viable tablets
var/list/viewable_tablets = list()
for (var/obj/item/modular_computer/tablet in GLOB.TabletMessengers)
if(!tablet.saved_identification || tablet.invisible)
continue
viewable_tablets += tablet
if(length(viewable_tablets) > 0)
customrecepient = tgui_input_list(usr, "Select a tablet from the list", "Tablet Selection", viewable_tablets)
else
customrecepient = null

//Enter custom job
if("RecJob")
customjob = tgui_input_text(usr, "Please enter the sender's job.", "Job") || customjob

//Enter message
if("Message")
custommessage = tgui_input_text(usr, "Please enter your message.", "Message") || custommessage

//Send message
if("Send")
if(isnull(customsender) || customsender == "")
customsender = "UNKNOWN"

if(isnull(customrecepient))
message = span_notice("NOTICE: No recepient selected!")
return attack_hand(usr)

if(isnull(custommessage) || custommessage == "")
message = span_notice("NOTICE: No message entered!")
return attack_hand(usr)

var/datum/signal/subspace/messaging/tablet_msg/signal = new(src, list(
"name" = "[customsender]",
"job" = "[customjob]",
"message" = html_decode(custommessage),
"ref" = REF(src),
"targets" = list(customrecepient),
"emojis" = FALSE,
"rigged" = FALSE,
"automated" = FALSE,
))
// this will log the signal and transmit it to the target
linkedServer.receive_information(signal, null)
usr.log_message("(Tablet: [name] | [usr.real_name]) sent \"[custommessage]\" to [signal.format_target()]", LOG_PDA)

//Request Console Logs - KEY REQUIRED
if(href_list["view_requests"])
if(LINKED_SERVER_NONRESPONSIVE)
Expand Down