[MIRROR] Adds a new tool for GMs to create props for events in form of fake PDA conversation logs (#7717)

Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2
2024-02-11 13:55:00 -07:00
committed by GitHub
parent 25ff4870ab
commit 9b0aa981ff
7 changed files with 127 additions and 2 deletions

View File

@@ -174,7 +174,8 @@ var/list/admin_verbs_fun = list(
/client/proc/narrate_mob, //VOREStation Add
/client/proc/narrate_mob_args, //VOREStation Add
/client/proc/getPlayerStatus, //VORESTation Add
/client/proc/manage_event_triggers
/client/proc/manage_event_triggers,
/client/proc/fake_pdaconvos
)

View File

@@ -86,6 +86,11 @@
<option value='?_src_=vars;[HrefToken()];emp=\ref[src]'>Trigger EM pulse</option>
"}
/obj/item/device/pda/get_view_variables_options()
return ..() + {"
<option value='?_src_=vars;[HrefToken()];fakepdapropconvo=\ref[src]'>Add Fake Prop Conversation</option>
"}
/datum/proc/get_variables()
. = vars - VV_hidden()
if(!usr || !check_rights(R_ADMIN|R_DEBUG, FALSE))

View File

@@ -274,6 +274,15 @@
return
log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ")
message_admins("<span class='notice'>[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) </span>")
else if(href_list["fakepdapropconvo"])
if(!check_rights(R_FUN)) return
var/obj/item/device/pda/P = locate(href_list["fakepdapropconvo"])
if(!istype(P))
to_chat(usr, span_warning("This can only be done to instances of type /pda"))
return
P.createPropFakeConversation_admin(usr)
else if(href_list["rotatedatum"])
if(!check_rights(0)) return

View File

@@ -47,6 +47,7 @@
var/last_message_count = 0
var/ircreplyamount = 0
var/entity_narrate_holder //Holds /datum/entity_narrate when using the relevant admin verbs.
var/fakeConversations //Holds fake PDA conversations for event set-up
/////////
//OTHER//

View File

@@ -0,0 +1,95 @@
/datum/eventkit/fake_pdaconvos
var/list/names = list() //Assoc list of refs in fakeRefs = name
var/list/fakeRefs = list() //Used to find elements in other lists and tracking conversations. MUST BE UNIQUE.
var/list/fakeJobs = list() //Assoc list of name in names = job
/client/proc/fake_pdaconvos()
set category = "EventKit"
set name = "Manage PDA identities"
set desc = "Creates fake identities for use in setting up PDA props"
if(!check_rights(R_FUN))
return
var/choice = tgui_input_list(usr, "What do you wish to do?", "Options",
list("Add new identity", "Edit existing identity", "Delete existing identity", "Delete holder", "Cancel"))
if(choice == "Delete holder")
qdel(fakeConversations)
fakeConversations = null
return
if(choice == "Cancel")
return
if(!fakeConversations || !istype(fakeConversations, /datum/eventkit/fake_pdaconvos))
fakeConversations = new /datum/eventkit/fake_pdaconvos
var/datum/eventkit/fake_pdaconvos/FPC = fakeConversations
if(choice == "Add new identity")
var/newRef = sanitize(tgui_input_text(usr, "Input unique reference. Duplicates are FORBIDDEN!. Players can't see this.\
Used to uniquely identify conversations in PDAs", null))
if(!newRef) return
FPC.fakeRefs.Add(newRef)
FPC.names[newRef] = sanitize(tgui_input_text(usr, "Input fake name",newRef))
FPC.fakeJobs[newRef] = sanitize(tgui_input_text(usr, "Input fake assignment.",newRef))
to_chat(usr, span_notice("You have created [newRef]. Current name: [FPC.names[newRef]]. Current assignment: [FPC.fakeJobs[newRef]]"))
return
if(choice == "Edit existing identity")
var/ref = tgui_input_list(usr, "Pick which identity to edit (details are printed to chat)", "identities", FPC.fakeRefs)
to_chat(usr, span_notice("You are editing [ref]. Current name: [FPC.names[ref]]. Current assignment: [FPC.fakeJobs[ref]]"))
var/editChoice = tgui_alert(usr, "What do you wish to edit?", "Details", list("Name", "Job", "Cancel"))
if(editChoice == "Name")
FPC.names[ref] = sanitize(tgui_input_text(usr, "Input fake name", FPC.names[ref]))
to_chat(usr, span_notice("Current data for [ref] are : Current name: [FPC.names[ref]]. Current assignment: [FPC.fakeJobs[ref]]"))
if(editChoice == "Job")
FPC.fakeJobs[ref] = sanitize(tgui_input_text(usr, "Input fake name", FPC.fakeJobs[ref]))
to_chat(usr, span_notice("Current data for [ref] are : Current name: [FPC.names[ref]]. Current assignment: [FPC.fakeJobs[ref]]"))
return
if(choice == "Delete existing identity")
var/ref = tgui_input_list(usr, "Pick which identity to delete (details are printed to chat)", "identities", FPC.fakeRefs)
if(tgui_alert(usr, "You are deleting [ref]. Current name: [FPC.names[ref]]. Current assignment: [FPC.fakeJobs[ref]]",
"are you sure?", list("Yes", "No"))=="Yes")
FPC.fakeRefs =- ref
FPC.fakeJobs =- ref
FPC.names =- ref
return
/*
Invoked by vv topic "fakepdapropconvo" in code\modules\admin\view_variables\topic.dm found in PDA vv dropdown.
*/
/obj/item/device/pda/proc/createPropFakeConversation_admin(mob/M)
if(!M.client || !check_rights_for(M.client,R_FUN))
return
var/datum/eventkit/fake_pdaconvos/FPC = M.client.fakeConversations
if(!FPC || !istype(FPC, /datum/eventkit/fake_pdaconvos))
to_chat(M, span_warning("First you must create a new identity with Manage PDA identities in EventKit"))
return
var/choice = tgui_alert(M,"Use TGUI or dialogue boxes?", "TGUI?", list("TGUI", "Dialogue", "Cancel"))
if(choice == "Cancel") return
var/datum/data/pda/app/messenger/ourPDA = find_program(/datum/data/pda/app/messenger)
if(choice == "Dialogue")
var/identity = tgui_input_list(M, "Pick which identity to use(details are printed to chat)", "identities", FPC.fakeRefs)
var/job = FPC.fakeJobs[identity]
var/name = FPC.names[identity]
to_chat(M, span_notice("You are using [identity]. Current name: [name]. Current assignment: [job]"))
var/safetyLimit = 0
while(safetyLimit < 30)
safetyLimit += 1
var/message = sanitize(tgui_input_text(M, "Input fake message. Leave empty to cancel. Can create up to 30 messages in a row",null),
MAX_MESSAGE_LEN)
if(!message) return
var/receipent = ((tgui_alert(M, "Received or Sent?", "Direction", list("Received", "Sent"))=="Sent") ? 1 : 0)
ourPDA.createFakeMessage(name,identity,job,receipent, message)
if(choice == "TGUI")
to_chat(M, span_notice("Sorry, the TGUI functionality is not yet implemented - use Dialogue mode!"))

View File

@@ -12,6 +12,7 @@
var/m_hidden = 0 // Is the PDA hidden from the PDA list?
var/active_conversation = null // New variable that allows us to only view a single conversation.
var/list/conversations = list() // For keeping up with who we have PDA messsages from.
var/list/fakepdas = list() //So that fake PDAs show up in conversations for props. Namedlist of "fakeName" = fakeRef
/datum/data/pda/app/messenger/start()
. = ..()
@@ -42,6 +43,8 @@
convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1")))
else
pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0")))
for(var/fakeRef in fakepdas)
convopdas.Add(list(list("Name" = "[fakepdas[fakeRef]]", "Reference" = "[fakeRef]", "Detonate" = "0", "inconvo" = "1")))
data["convopdas"] = convopdas
data["pdas"] = pdas
@@ -242,3 +245,13 @@
var/datum/data/pda/app/messenger/P = target.find_program(/datum/data/pda/app/messenger)
if(P)
P.receive_message(modified_message, "\ref[M]")
/*
Generalized proc to handle GM fake prop messages, or future fake prop messages from mapping landmarks.
We need a separate proc for this due to the "target" component and creation of a fake conversation entry.
Invoked by /obj/item/device/pda/proc/createPropFakeConversation_admin(var/mob/M)
*/
/datum/data/pda/app/messenger/proc/createFakeMessage(fakeName, fakeRef, fakeJob, sent, message)
receive_message(list("sent" = sent, "owner" = "[fakeName]", "job" = "[fakeJob]", "message" = "[message]", "target" = "[fakeRef]"), fakeRef)
if(!fakepdas[fakeRef])
fakepdas[fakeRef] = fakeName

View File

@@ -2394,6 +2394,7 @@
#include "code\modules\error_handler\error_viewer.dm"
#include "code\modules\error_handler\~defines.dm"
#include "code\modules\eventkit\event_machinery.dm"
#include "code\modules\eventkit\gm_interfaces\fake_pda_conversations.dm"
#include "code\modules\eventkit\gm_interfaces\mob_spawner.dm"
#include "code\modules\events\apc_damage.dm"
#include "code\modules\events\atmos_leak.dm"