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.
This commit is contained in:
VerySoft
2023-08-16 05:44:59 -04:00
parent 1e184fcbb3
commit 90981fa620
9 changed files with 98 additions and 206 deletions
@@ -93,7 +93,7 @@
. += "<b>Age:</b> <a href='?src=\ref[src];age=1'>[pref.age]</a> <b>Birthday:</b> <a href='?src=\ref[src];bday_month=1'>[pref.bday_month]</a><b>/</b><a href='?src=\ref[src];bday_day=1'>[pref.bday_day]</a> - <b>Announce?:</b> <a href='?src=\ref[src];bday_announce=1'>[pref.bday_announce ? "Yes" : "No"]</a><br>"
. += "<b>Spawn Point</b>: <a href='?src=\ref[src];spawnpoint=1'>[pref.spawnpoint]</a><br>"
if(config.allow_Metadata)
. += "<b>OOC Notes:</b> <a href='?src=\ref[src];metadata=1'> Edit </a><br>"
. += "<b>OOC Notes: <a href='?src=\ref[src];edit_ooc_notes=1'>Edit</a><a href='?src=\ref[src];edit_ooc_note_likes=1'>Likes</a><a href='?src=\ref[src];edit_ooc_note_dislikes=1'>Dislikes</a></b><br>"
. = 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", "<BR>")
var/likes = replacetext(html_decode(pref.metadata_likes), "\n", "<BR>")
var/dislikes = replacetext(html_decode(pref.metadata_dislikes), "\n", "<BR>")
var/dat = {"
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<style>
body {
margin-top:5px;
font-family:Verdana;
color:white;
font-size:13px;
background-image:url('ooc_notes.png');
background-repeat:repeat-x;
background-color:#272727;
background-position:center top;
}
table {
font-size:13px;
margin-left:-2px;
}
h2 {
font-size:15px;
}
.collapsible {
background-color: #263d20;
color: white;
padding: 5px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 20px;
}
.collapsible_b {
background-color: #3f1a1a;
color: white;
padding: 5px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 20px;
}
.content {
padding: 5;
width: 100%;
background-color: #363636;
}
.button {
background-color: #40628a;
text-align: center;
}
td.button {
border: 1px solid #161616;
background-color: #40628a;
text-align: center;
}
a.button {
color:white;
text-decoration: none;
}
</style>
</head>"}
dat += {"<body>
<p><b>Save your changes in the character setup!</b></p>
<b><font size='3px'>[pref.real_name]'s OOC notes</font></b><br>"}
dat += {"
<br>
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_notes=1' class='button'>Edit</a>
</td>
</table>
"}
dat += {"
<br>
<p>[notes]</p>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<body>
<div class="collapsible"><b>Likes</b></div>"}
dat += {"
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_note_likes=1' class='button'>Edit</a>
</td>
</table>
"}
dat += {"
<div class="content">
<p>[likes]</p>
</div>"}
dat += {"
<br>
<div class="collapsible_b"><b>Dislikes</b></div>"}
dat += {"
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_note_dislikes=1' class='button'>Edit</a>
</td>
</table>
"}
dat += {"
<div class="content">
<p>[dislikes]</p>
</div>
</body>
</html>
<br><br>
<p><b>This only updates your character save file, to update your notes in the round use the Set OOC Metainfo verb!</b></p>
"}
user << browse("<html><head><title>OOC Notes: [pref.real_name]</title></head>[dat]</html>", "window=[pref.real_name]mvp;size=500x600;can_resize=1;can_minimize=0")
onclose(usr, "[pref.real_name]")