port ADMIN_VERB and friends (#30646)

* port ADMIN_VERB and friends

* some renaming

* dumb

* one more rename

* never search and replace this codebase

* fix TM issues, more renaming

* add a static analysis to shore up user verbs

* fix double message on roundstart

* remove macro we're not using yet

* convert remaining playsounds verbs

* convert more verbs i missed somehow

* why is this a completely different signature than everything else

* fix ui_interact arg

* fix logging view and others

* buncha issues caught in TM

* fix mentor tickets ui

* fix bug report viewing

* moron
This commit is contained in:
warriorstar-orion
2025-12-12 19:18:22 +00:00
committed by GitHub
parent f89b05ee88
commit 2a842644d5
92 changed files with 1751 additions and 3113 deletions
+25 -47
View File
@@ -1,30 +1,25 @@
/client/proc/admin_serialize()
set name = "Serialize Marked Datum"
set desc = "Turns your marked object into a JSON string you can later use to re-create the object"
set category = "Debug"
if(!check_rights(R_ADMIN|R_DEBUG))
USER_VERB(serialize_datum, R_ADMIN|R_DEBUG, "Serialize Marked Datum", \
"Turns your marked object into a JSON string you can later use to re-create the object", \
VERB_CATEGORY_DEBUG)
if(!istype(client.holder.marked_datum, /atom/movable))
to_chat(client, "The marked datum is not an atom/movable!")
return
if(!istype(holder.marked_datum, /atom/movable))
to_chat(src, "The marked datum is not an atom/movable!")
return
var/atom/movable/AM = holder.marked_datum
var/atom/movable/AM = client.holder.marked_datum
var/json_data = json_encode(AM.serialize())
var/choice = alert(usr, "Would you like to store this on your PC or server side?", "Storage Location", "PC", "Server", "Cancel")
var/choice = alert(client, "Would you like to store this on your PC or server side?", "Storage Location", "PC", "Server", "Cancel")
if(!choice || choice == "Cancel")
return
if(choice == "PC")
to_chat(src, chat_box_examine(json_data))
to_chat(client, chat_box_examine(json_data))
if(choice == "Server")
// Right, get their slot names
var/list/slots = list("--NEW--")
var/datum/db_query/dbq = SSdbcore.NewQuery("SELECT slotname FROM json_datum_saves WHERE ckey=:ckey", list("ckey" = usr.ckey))
var/datum/db_query/dbq = SSdbcore.NewQuery("SELECT slotname FROM json_datum_saves WHERE ckey=:ckey", list("ckey" = client.ckey))
if(!dbq.warn_execute())
qdel(dbq)
return
@@ -34,14 +29,14 @@
qdel(dbq)
var/slot_choice = input(usr, "Select a slot to update, or create a new one.", "Slot Selection") as null|anything in slots
var/slot_choice = input(client, "Select a slot to update, or create a new one.", "Slot Selection") as null|anything in slots
if(!slot_choice)
return
if(slot_choice == "--NEW--")
// New slot, save to DB
var/chosen_slot_name = input(usr, "Name your slot", "Slot name") as null|text
var/chosen_slot_name = input(client, "Name your slot", "Slot name") as null|text
if(!chosen_slot_name || length(chosen_slot_name) == 0)
return
@@ -50,7 +45,7 @@
// And save
var/datum/db_query/dbq2 = SSdbcore.NewQuery("INSERT INTO json_datum_saves (ckey, slotname, slotjson) VALUES(:ckey, :slotname, :slotjson)", list(
"ckey" = usr.ckey,
"ckey" = client.ckey,
"slotname" = clean_name,
"slotjson" = json_data
))
@@ -59,18 +54,18 @@
return
qdel(dbq2)
to_chat(usr, "Successfully saved <code>[clean_name]</code>. You can spawn it from <code>Debug > Spawn Saved JSON Datum</code>.")
to_chat(client, "Successfully saved <code>[clean_name]</code>. You can spawn it from <code>Debug > Spawn Saved JSON Datum</code>.")
else
// Existing slot, warn first
var/confirmation = alert(usr, "Are you sure you want to update '[slot_choice]'? This cannot be undone!", "You sure?", "Yes", "No")
var/confirmation = alert(client, "Are you sure you want to update '[slot_choice]'? This cannot be undone!", "You sure?", "Yes", "No")
if(confirmation != "Yes")
return
// Now update
var/datum/db_query/dbq2 = SSdbcore.NewQuery("UPDATE json_datum_saves SET slotjson=:slotjson WHERE slotname=:slotname AND ckey=:ckey", list(
"slotjson" = json_data,
"ckey" = usr.ckey,
"ckey" = client.ckey,
"slotname" = slot_choice
))
if(!dbq2.warn_execute())
@@ -78,36 +73,19 @@
return
qdel(dbq2)
to_chat(usr, "Successfully updated <code>[slot_choice]</code>. You can spawn it from <code>Debug > Spawn Saved JSON Datum</code>.")
to_chat(client, "Successfully updated <code>[slot_choice]</code>. You can spawn it from <code>Debug > Spawn Saved JSON Datum</code>.")
/client/proc/admin_deserialize()
set name = "Deserialize JSON datum"
set desc = "Creates an object from a JSON string"
set category = "Debug"
if(!check_rights(R_SPAWN)) // this involves spawning things
return
var/json_text = input("Enter the JSON code:","Text") as message|null
USER_VERB(deserialize_json, R_SPAWN, "Deserialize JSON datum", "Creates an object from a JSON string", VERB_CATEGORY_DEBUG)
var/json_text = input(client, "Enter the JSON code:","Text") as message|null
if(json_text)
json_to_object(json_text, get_turf(usr))
message_admins("[key_name_admin(usr)] spawned an atom from a custom JSON object.")
log_admin("[key_name(usr)] spawned an atom from a custom JSON object, JSON Text: [json_text]")
/client/proc/json_spawn_menu()
set name = "Spawn Saved JSON Datum"
set desc = "Spawns a JSON datums saved server side"
set category = "Debug"
// This needs a holder to function
if(!check_rights(R_SPAWN) || !holder)
return
json_to_object(json_text, get_turf(client.mob))
message_admins("[key_name_admin(client)] spawned an atom from a custom JSON object.")
log_admin("[key_name(client)] spawned an atom from a custom JSON object, JSON Text: [json_text]")
USER_VERB(spawn_json, R_SPAWN, "Spawn Saved JSON Datum", "Spawns a JSON datums saved server side", VERB_CATEGORY_DEBUG)
// Right, get their slot names
var/list/slots = list()
var/datum/db_query/dbq = SSdbcore.NewQuery("SELECT slotname, id FROM json_datum_saves WHERE ckey=:ckey", list("ckey" = usr.ckey))
var/datum/db_query/dbq = SSdbcore.NewQuery("SELECT slotname, id FROM json_datum_saves WHERE ckey=:ckey", list("ckey" = client.ckey))
if(!dbq.warn_execute())
qdel(dbq)
return
@@ -117,10 +95,10 @@
qdel(dbq)
var/datum/browser/popup = new(usr, "jsonspawnmenu", "JSON Spawn Menu", 400, 300)
var/datum/browser/popup = new(client, "jsonspawnmenu", "JSON Spawn Menu", 400, 300)
// Cache this to reduce proc jumps
var/holder_uid = holder.UID()
var/holder_uid = client.holder.UID()
var/list/rows = list()
rows += "<table><tr><th scope='col' width='90%'>Slot</th><th scope='col' width='10%'>Actions</th></tr>"