[MIRROR] Adds a persistent notes feature (#9935)

Co-authored-by: SatinIsle <98125273+SatinIsle@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-01-26 09:31:12 -07:00
committed by GitHub
parent 9b7090a92a
commit fdebf86a72
12 changed files with 128 additions and 2 deletions

View File

@@ -66,6 +66,8 @@
. += span_bold("Spawn With Backup Implant:") + " <a [pref.auto_backup_implant ? "class='linkOn'" : ""] href='byond://?src=\ref[src];toggle_implant=1'><b>[pref.auto_backup_implant ? "Yes" : "No"]</b></a><br>"
. += span_bold("Allow petting as robot:") + " <a [pref.borg_petting ? "class='linkOn'" : ""] href='byond://?src=\ref[src];toggle_borg_petting=1'><b>[pref.borg_petting ? "Yes" : "No"]</b></a><br>"
. += span_bold("Enable Stomach Sprites:") + " <a [pref.stomach_vision ? "class='linkOn'" : ""] href='byond://?src=\ref[src];toggle_stomach_vision=1'><b>[pref.stomach_vision ? "Yes" : "No"]</b></a><br>"
if(CONFIG_GET(flag/allow_metadata))
. += span_bold("Private Notes: <a href='byond://?src=\ref[src];edit_private_notes=1'>Edit</a>") + "<br>"
/datum/category_item/player_setup_item/vore/misc/OnTopic(var/href, var/list/href_list, var/mob/user)
if(href_list["toggle_show_in_directory"])
@@ -120,4 +122,8 @@
else if(href_list["toggle_stomach_vision"])
pref.stomach_vision = pref.stomach_vision ? 0 : 1;
return TOPIC_REFRESH
else if(href_list["edit_private_notes"])
var/new_metadata = sanitize(tgui_input_text(user,"Write some notes for yourself. These can be anything that is useful, whether it's character events that you want to remember or a bit of lore. Things that you would normally stick in a txt file for yourself!", "Private Notes", html_decode(pref.read_preference(/datum/preference/text/living/private_notes)), multiline = TRUE, prevent_enter = TRUE), extra = 0)
if(new_metadata && CanUseTopic(user))
pref.update_preference_by_type(/datum/preference/text/living/private_notes, new_metadata)
return ..();

View File

@@ -173,3 +173,14 @@
/datum/preference/choiced/living/spawnpoint/apply_to_living(mob/living/target, value)
return // handled in job_controller
/datum/preference/text/living/private_notes
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
savefile_identifier = PREFERENCE_CHARACTER
savefile_key = "Private_Notes"
maximum_value_length = MAX_MESSAGE_LEN * 4
can_randomize = FALSE
/datum/preference/text/living/private_notes/apply_to_living(mob/living/target, value)
target.private_notes = value
return