Files
Paradise/code/modules/admin/verbs/serialization.dm
Qwertytoforty d6c3191d07 Json spawning is now logged (#18828)
* Json spawning is now logged

* Update code/modules/admin/verbs/serialization.dm

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
2022-08-18 10:49:18 +01:00

29 lines
971 B
Plaintext

/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))
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
to_chat(src, json_encode(AM.serialize()))
/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
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]")