From 90981fa620cc1e57b3242b25c82b434dc3786b96 Mon Sep 17 00:00:00 2001 From: VerySoft Date: Wed, 16 Aug 2023 05:44:59 -0400 Subject: [PATCH] Revise OOC notes panel Revises the OOC notes panel a bit, and removes the OOC notes panel from character setup, in favor of just adding buttons to set the likes and dislikes there, rather than maintaining two different versions of the panel. Additionally, adds a 'print to chat' button to the panel, and to examine for the OOC notes. Changes the way the window is sent to the client so that it behaves more like character setup. This should mitigate edge cases where the panel appears off screen when SS13 is not being displayed on the primary monitor. It SHOULD also remember its position between sessions. Either way it should stay on your screen now. Also, for the print to chat, character directory, and any OOC notes panel that isn't yours, the LIKES and DISLIKES sections will show up conditionally depending on if they are actually set up. If there's nothing there, then they won't show up. This is presently an imperfect revision, as it only allows you to have one OOC notes panel open at a time. I would like you to be able to have more than one at a time, while also having the features to allow it to always appear on the screen, however, that will take some extra development time. Apart from that, this is fully functional. --- .../objects/items/weapons/capture_crystal.dm | 2 +- .../preference_setup/general/01_basic.dm | 139 +----------------- .../client/verbs/character_directory.dm | 17 ++- .../mob/living/carbon/human/examine.dm | 2 +- code/modules/mob/living/living_vr.dm | 35 ++++- code/modules/mob/living/ooc_notes.dm | 81 ++++------ code/modules/vore/eating/living_vr.dm | 8 +- code/modules/vore/eating/silicon_vr.dm | 2 +- interface/skin.dmf | 18 +++ 9 files changed, 98 insertions(+), 206 deletions(-) diff --git a/code/game/objects/items/weapons/capture_crystal.dm b/code/game/objects/items/weapons/capture_crystal.dm index c6281804dc3..83dbec328a7 100644 --- a/code/game/objects/items/weapons/capture_crystal.dm +++ b/code/game/objects/items/weapons/capture_crystal.dm @@ -44,7 +44,7 @@ if(isanimal(bound_mob)) . += "[bound_mob.health / bound_mob.maxHealth * 100]%" if(bound_mob.ooc_notes) - . += "OOC Notes: \[View\]" + . += "OOC Notes: \[View\] - \[Print\]" . += "\[Mechanical Vore Preferences\]" //Command! This lets the owner toggle hostile on AI controlled mobs, or send a silent command message to your bound mob, wherever they may be. diff --git a/code/modules/client/preference_setup/general/01_basic.dm b/code/modules/client/preference_setup/general/01_basic.dm index 689fcd48e45..86fd2aafc62 100644 --- a/code/modules/client/preference_setup/general/01_basic.dm +++ b/code/modules/client/preference_setup/general/01_basic.dm @@ -93,7 +93,7 @@ . += "Age: [pref.age] Birthday: [pref.bday_month]/[pref.bday_day] - Announce?: [pref.bday_announce ? "Yes" : "No"]
" . += "Spawn Point: [pref.spawnpoint]
" if(config.allow_Metadata) - . += "OOC Notes: Edit
" + . += "OOC Notes: EditLikesDislikes
" . = jointext(.,null) /datum/category_item/player_setup_item/general/basic/OnTopic(var/href,var/list/href_list, var/mob/user) @@ -208,27 +208,18 @@ pref.spawnpoint = choice return TOPIC_REFRESH - else if(href_list["metadata"]) -// var/new_metadata = strip_html_simple(tgui_input_text(user, "Enter any information you'd like others to see, such as Roleplay-preferences:", "Game Preference" , html_decode(pref.metadata), multiline = TRUE, prevent_enter = TRUE)) //VOREStation Edit - if(CanUseTopic(user)) - ooc_notes_window(user) -// pref.metadata = new_metadata - return TOPIC_HANDLED else if(href_list["edit_ooc_notes"]) var/new_metadata = strip_html_simple(tgui_input_text(usr, "Enter any information you'd like others to see, such as Roleplay-preferences. This will not be saved permanently unless you click save in the Character Setup panel!", "Game Preference" , html_decode(pref.metadata), multiline = TRUE, prevent_enter = TRUE)) if(new_metadata && CanUseTopic(user)) pref.metadata = new_metadata - ooc_notes_window(usr) else if(href_list["edit_ooc_note_likes"]) var/new_metadata = strip_html_simple(tgui_input_text(usr, "Enter any information you'd like others to see relating to your LIKED roleplay preferences. This will not be saved permanently unless you click save in the Character Setup panel!", "Game Preference" , html_decode(pref.metadata_likes), multiline = TRUE, prevent_enter = TRUE)) if(new_metadata && CanUseTopic(user)) pref.metadata_likes = new_metadata - ooc_notes_window(usr) else if(href_list["edit_ooc_note_dislikes"]) var/new_metadata = strip_html_simple(tgui_input_text(usr, "Enter any information you'd like others to see relating to your DISLIKED roleplay preferences. This will not be saved permanently unless you click save in the Character Setup panel!", "Game Preference" , html_decode(pref.metadata_dislikes), multiline = TRUE, prevent_enter = TRUE)) if(new_metadata && CanUseTopic(user)) pref.metadata_dislikes = new_metadata - ooc_notes_window(usr) return ..() /datum/category_item/player_setup_item/general/basic/proc/get_genders() @@ -243,131 +234,3 @@ possible_genders = possible_genders.Copy() possible_genders |= NEUTER return possible_genders - -/datum/category_item/player_setup_item/general/basic/proc/ooc_notes_window(mob/user) - //I tried to get it to accept things like emojis and all that, but, it wouldn't do! It would be cool if it did. - var/notes = replacetext(html_decode(pref.metadata), "\n", "
") - var/likes = replacetext(html_decode(pref.metadata_likes), "\n", "
") - var/dislikes = replacetext(html_decode(pref.metadata_dislikes), "\n", "
") - var/dat = {" - - - - - "} - - dat += {" -

Save your changes in the character setup!

- [pref.real_name]'s OOC notes
"} - dat += {" -
- - -
- Edit -
- "} - - dat += {" -
-

[notes]

- - - - -
Likes
"} - dat += {" - - -
- Edit -
- "} - - dat += {" -
-

[likes]

-
"} - dat += {" -
-
Dislikes
"} - dat += {" - - -
- Edit -
- "} - - dat += {" -
-

[dislikes]

-
- - -

-

This only updates your character save file, to update your notes in the round use the Set OOC Metainfo verb!

- "} - - user << browse("OOC Notes: [pref.real_name][dat]", "window=[pref.real_name]mvp;size=500x600;can_resize=1;can_minimize=0") - - onclose(usr, "[pref.real_name]") diff --git a/code/modules/client/verbs/character_directory.dm b/code/modules/client/verbs/character_directory.dm index f6c38357fcc..ebc7f4da763 100644 --- a/code/modules/client/verbs/character_directory.dm +++ b/code/modules/client/verbs/character_directory.dm @@ -77,7 +77,10 @@ GLOBAL_DATUM(character_directory, /datum/character_directory) name = H.real_name species = "[H.custom_species ? H.custom_species : H.species.name]" ooc_notes = H.ooc_notes - ooc_notes += "\n\n LIKES\n\n[H.ooc_notes_likes]\n\nDISLIKES\n\n[H.ooc_notes_dislikes]" + if(H.ooc_notes_likes) + ooc_notes += "\n\nLIKES\n\n[H.ooc_notes_likes]" + if(H.ooc_notes_dislikes) + ooc_notes += "\n\nDISLIKES\n\n[H.ooc_notes_dislikes]" flavor_text = H.flavor_texts["general"] if(isAI(C.mob)) @@ -85,7 +88,11 @@ GLOBAL_DATUM(character_directory, /datum/character_directory) name = A.name species = "Artificial Intelligence" ooc_notes = A.ooc_notes - ooc_notes += "\n\nLIKES\n\n[A.ooc_notes_likes]\n\nDISLIKES\n\n[A.ooc_notes_dislikes]" + if(A.ooc_notes_likes) + ooc_notes += "\n\nLIKES\n\n[A.ooc_notes_likes]" + if(A.ooc_notes_dislikes) + ooc_notes += "\n\nDISLIKES\n\n[A.ooc_notes_dislikes]" + flavor_text = null // No flavor text for AIs :c if(isrobot(C.mob)) @@ -95,7 +102,11 @@ GLOBAL_DATUM(character_directory, /datum/character_directory) name = R.name species = "[R.modtype] [R.braintype]" ooc_notes = R.ooc_notes - ooc_notes += "\n\nLIKES\n\n[R.ooc_notes_likes]\n\nDISLIKES\n\n[R.ooc_notes_dislikes]" + if(R.ooc_notes_likes) + ooc_notes += "\n\nLIKES\n\n[R.ooc_notes_likes]" + if(R.ooc_notes_dislikes) + ooc_notes += "\n\nDISLIKES\n\n[R.ooc_notes_dislikes]" + flavor_text = R.flavor_text // It's okay if we fail to find OOC notes and flavor text diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 83cb6fae65c..4651baecb4a 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -435,7 +435,7 @@ msg += "Custom link: [custom_link]" if(ooc_notes) - msg += "OOC Notes: \[View\]" + msg += "OOC Notes: \[View\] - \[Print\]" msg += "\[Mechanical Vore Preferences\]" // VOREStation End msg += "*---------*" diff --git a/code/modules/mob/living/living_vr.dm b/code/modules/mob/living/living_vr.dm index c7a496c6365..4771b1e884e 100644 --- a/code/modules/mob/living/living_vr.dm +++ b/code/modules/mob/living/living_vr.dm @@ -36,8 +36,21 @@ to_chat(usr, "OOC notes updated. Don't forget to save!") log_admin("[key_name(usr)] updated their OOC notes mid-round.") ooc_notes_window(usr) + set_metainfo_likes(FALSE) + set_metainfo_dislikes(FALSE) -/mob/living/proc/set_metainfo_likes() +/mob/living/verb/set_metainfo_panel() + if(usr != src) + return + var/new_metadata = strip_html_simple(tgui_input_text(usr, "Enter any information you'd like others to see, such as Roleplay-preferences. This will not be saved permanently unless you click save in the OOC notes panel!", "Game Preference" , html_decode(ooc_notes), multiline = TRUE, prevent_enter = TRUE)) + if(new_metadata && CanUseTopic(usr)) + ooc_notes = new_metadata + client.prefs.metadata = new_metadata + to_chat(usr, "OOC notes updated. Don't forget to save!") + log_admin("[key_name(usr)] updated their OOC notes mid-round.") + ooc_notes_window(usr) + +/mob/living/proc/set_metainfo_likes(var/reopen = TRUE) if(usr != src) return var/new_metadata = strip_html_simple(tgui_input_text(usr, "Enter any information you'd like others to see relating to your LIKED roleplay preferences. This will not be saved permanently unless you click save in the OOC notes panel!", "Game Preference" , html_decode(ooc_notes_likes), multiline = TRUE, prevent_enter = TRUE)) @@ -46,9 +59,10 @@ client.prefs.metadata_likes = new_metadata to_chat(usr, "OOC note likes have been updated. Don't forget to save!") log_admin("[key_name(usr)] updated their OOC note likes mid-round.") - ooc_notes_window(usr) + if(reopen) + ooc_notes_window(usr) -/mob/living/proc/set_metainfo_dislikes() +/mob/living/proc/set_metainfo_dislikes(var/reopen = TRUE) if(usr != src) return var/new_metadata = strip_html_simple(tgui_input_text(usr, "Enter any information you'd like others to see relating to your DISLIKED roleplay preferences. This will not be saved permanently unless you click save in the OOC notes panel!", "Game Preference" , html_decode(ooc_notes_dislikes), multiline = TRUE, prevent_enter = TRUE)) @@ -57,7 +71,8 @@ client.prefs.metadata_dislikes = new_metadata to_chat(usr, "OOC note dislikes have been updated. Don't forget to save!") log_admin("[key_name(usr)] updated their OOC note dislikes mid-round.") - ooc_notes_window(usr) + if(reopen) + ooc_notes_window(usr) /mob/living/proc/save_ooc_panel() if(usr != src) @@ -68,6 +83,18 @@ if(client.prefs.save_character()) to_chat(usr, "Character preferences saved.") +/mob/living/proc/print_ooc_notes_to_chat() + if(usr != src) + return + if(!ooc_notes) + return + var/msg = ooc_notes + if(ooc_notes_likes) + msg += "

LIKES

[ooc_notes_likes]" + if(ooc_notes_dislikes) + msg += "

DISLIKES

[ooc_notes_dislikes]" + to_chat(src, "[src]'s Metainfo:
[msg]
") + /mob/living/verb/set_custom_link() set name = "Set Custom Link" set desc = "Set a custom link to show up with your examine text." diff --git a/code/modules/mob/living/ooc_notes.dm b/code/modules/mob/living/ooc_notes.dm index 4b572b3e9bb..ff955a4aa7c 100644 --- a/code/modules/mob/living/ooc_notes.dm +++ b/code/modules/mob/living/ooc_notes.dm @@ -10,77 +10,43 @@ "} - dat += {" - [src.name]'s OOC notes
"} + dat += {""} if(user == src) dat += {" -
- -
- Save Character Preferences -
- "} + + Save Character Preferences + + "} + dat += {" + + Print to chat + + + "} + if(user == src) dat += {"
@@ -95,10 +61,10 @@

[notes]

- - + "} -
Likes
"} + if(likes || user == src) + dat += {"
Likes
"} if(user == src) dat += {" @@ -113,9 +79,10 @@

[likes]

"} - dat += {" -
-
Dislikes
"} + if(dislikes || user == src) + dat += {" +
+
Dislikes
"} if(user == src) dat += {"
@@ -134,6 +101,12 @@ "} - user << browse("OOC Notes: [src][dat]", "window=[src.name]mvp;size=500x600;can_resize=1;can_minimize=1") +// user << browse("OOC Notes: [src][dat]", "window=[src.name]ooc_notes;size=500x600;can_resize=1;can_minimize=1") - onclose(usr, "[src.name]") +// onclose(usr, "[src.name]") + + winshow(user, "ooc_notes", TRUE) + var/datum/browser/popup = new(user, "ooc_notes_panel", "OOC Notes: [src.name]", 500, 600) + popup.set_content(dat) + popup.open(FALSE) // Skip registring onclose on the browser pane + onclose(user, "ooc_notes", src) // We want to register on the window itself diff --git a/code/modules/vore/eating/living_vr.dm b/code/modules/vore/eating/living_vr.dm index eeb016f4b9e..6443ed3cfaa 100644 --- a/code/modules/vore/eating/living_vr.dm +++ b/code/modules/vore/eating/living_vr.dm @@ -1060,7 +1060,7 @@ if(custom_link) . += "Custom link: [custom_link]" if(ooc_notes) - . += "OOC Notes:\[View\]" + . += "OOC Notes:\[View\] - \[Print\]" . += "\[Mechanical Vore Preferences\]" @@ -1071,7 +1071,7 @@ src.Examine_OOC() if(href_list["edit_ooc_notes"]) if(usr == src) - set_metainfo() + set_metainfo_panel() if(href_list["edit_ooc_note_likes"]) if(usr == src) set_metainfo_likes() @@ -1081,8 +1081,8 @@ if(href_list["save_ooc_panel"]) if(usr == src) save_ooc_panel() - - + if(href_list["print_ooc_notes_to_chat"]) + print_ooc_notes_to_chat() return ..() /mob/living/proc/display_voreprefs(mob/user) //Called by Topic() calls on instances of /mob/living (and subtypes) containing vore_prefs as an argument diff --git a/code/modules/vore/eating/silicon_vr.dm b/code/modules/vore/eating/silicon_vr.dm index 727a08de0d2..52a450a58c3 100644 --- a/code/modules/vore/eating/silicon_vr.dm +++ b/code/modules/vore/eating/silicon_vr.dm @@ -105,4 +105,4 @@ . += "[flavor_text]" if(master.ooc_notes) - . += "OOC Notes:\[View\]" + . += "OOC Notes:\[View\] - \[Print\]" diff --git a/interface/skin.dmf b/interface/skin.dmf index fb4e0d438b3..541e4287569 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -1501,6 +1501,24 @@ window "preferences_window" right-click = true saved-params = "zoom;letterbox;zoom-mode" +window "ooc_notes" + elem "ooc_notes" + type = MAIN + pos = 25,25 + size = 500x600 + anchor1 = -1,-1 + anchor2 = -1,-1 + is-visible = false + saved-params = "pos;is-minimized;is-maximized" + statusbar = false + elem "ooc_notes_panel" + type = BROWSER + pos = 0,0 + size = 500x600 + anchor1 = 0,0 + anchor2 = 80,100 + saved-params = "" + window "infowindow" elem "infowindow" type = MAIN