Oocpaneledit 2 (Copy of #7713) (#7763)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
Raeschen
2024-02-16 11:48:34 +01:00
committed by GitHub
co-authored by Kashargul Kashargul
parent be481849b9
commit 615004fb01
28 changed files with 716 additions and 38 deletions
@@ -1,4 +1,9 @@
/datum/preferences
//Our OOC Metadata additions
var/metadata_maybes = ""
var/metadata_favs = ""
var/matadata_ooc_style = FALSE
var/job_other_low = 0
var/job_other_med = 0
var/job_other_high = 0
@@ -190,4 +190,36 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc.
/mob/living/set_dir(var/new_dir)
. = ..()
if(size_multiplier != 1 || icon_scale_x != 1 && center_offset > 0)
update_transform(TRUE)
update_transform(TRUE)
/mob/living/proc/set_metainfo_favs(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 FAVOURITE roleplay preferences. This will not be saved permanently unless you click save in the OOC notes panel!", "Game Preference" , html_decode(ooc_notes_favs), multiline = TRUE, prevent_enter = TRUE))
if(CanUseTopic(usr))
ooc_notes_favs = new_metadata
client.prefs.metadata_favs = new_metadata
to_chat(usr, "<span class='filter_notice'>OOC note favs have been updated. Don't forget to save!</span>")
log_admin("[key_name(usr)] updated their OOC note favs mid-round.")
if(reopen)
ooc_notes_window(usr)
/mob/living/proc/set_metainfo_maybes(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 MAYBE roleplay preferences. This will not be saved permanently unless you click save in the OOC notes panel!", "Game Preference" , html_decode(ooc_notes_maybes), multiline = TRUE, prevent_enter = TRUE))
if(CanUseTopic(usr))
ooc_notes_maybes = new_metadata
client.prefs.metadata_maybes = new_metadata
to_chat(usr, "<span class='filter_notice'>OOC note maybes have been updated. Don't forget to save!</span>")
log_admin("[key_name(usr)] updated their OOC note maybes mid-round.")
if(reopen)
ooc_notes_window(usr)
/mob/living/proc/set_metainfo_ooc_style(var/reopen = TRUE)
if(usr != src)
return
ooc_notes_style = !ooc_notes_style
client.prefs.matadata_ooc_style = !client.prefs.matadata_ooc_style
if(reopen)
ooc_notes_window(usr)
@@ -0,0 +1,4 @@
/mob/living
var/ooc_notes_favs = null
var/ooc_notes_maybes = null
var/ooc_notes_style = FALSE
@@ -0,0 +1,207 @@
/mob/living/ooc_notes_window(mob/user)
if(!ooc_notes)
return
//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(src.ooc_notes), "\n", "<BR>")
var/favs = replacetext(html_decode(src.ooc_notes_favs), "\n", "<BR>")
var/likes = replacetext(html_decode(src.ooc_notes_likes), "\n", "<BR>")
var/maybes = replacetext(html_decode(src.ooc_notes_maybes), "\n", "<BR>")
var/dislikes = replacetext(html_decode(src.ooc_notes_dislikes), "\n", "<BR>")
var/style = src.ooc_notes_style
var/dat = {"
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<style>
* {
box-sizing: border-box;
}
.collapsible {
background-color: #1a1e3f;
color: white;
width: 100%;
text-align: left;
font-size: 20px;
}
.collapsible_a {
background-color: #263d20;
color: white;
width: 100%;
text-align: left;
font-size: 20px;
}
.collapsible_b {
background-color: #3e3f1a;
color: white;
width: 100%;
text-align: left;
font-size: 20px;
}
.collapsible_c {
background-color: #3f1a1a;
color: white;
width: 100%;
text-align: left;
font-size: 20px;
}
.content {
padding: 5;
width: 100%;
background-color: #363636;
}
.column {
verflow-wrap: break-word;
float: left;
width: 25%;
}
.row:after {
content: "";
display: table;
clear: both;
}
</style>
</head>"}
dat += {"<body><table>"}
if(user == src)
dat += {"
<td class="button">
<a href='byond://?src=\ref[src];save_ooc_panel=1' class='button'>Save Character Preferences</a>
</td>
"}
dat += {"
<td class="button">
<a href='byond://?src=\ref[src];print_ooc_notes_to_chat=1' class='button'>Print to chat</a>
</td>
"}
if(style)
dat += {"
<td class="button">
<a href='byond://?src=\ref[src];set_metainfo_ooc_style=1' class='button'>Lists</a>
</td>
"}
else
dat += {"
<td class="button">
<a href='byond://?src=\ref[src];set_metainfo_ooc_style=1' class='button'>Fields</a>
</td>
"}
dat += {"</table>"}
if(user == src)
dat += {"
<br>
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_notes=1' class='button'>Edit</a>
</td>
</table>
"}
dat += {"
<br>
<div class="content">
<p>[notes]</p>
</div>
<br>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">"}
if(style)
dat += {"<div class='row'><div class='column'>"}
if(favs || user == src)
dat += {"<div class="collapsible"><b><center>Favourites</center></b></div>"}
if(user == src)
dat += {"
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_note_favs=1' class='button'>Edit</a>
</td>
</table>
"}
if(favs)
dat += {"
<div class="content">
<p>[favs]</p>
</div>"}
if(style)
dat += {"</div>"}
dat += {"<div class='column'>"}
if(likes || user == src)
dat += {"<div class="collapsible_a"><b><center>Likes</center></b></div>"}
if(user == src)
dat += {"
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_note_likes=1' class='button'>Edit</a>
</td>
</table>
"}
if(likes)
dat += {"
<div class="content">
<p>[likes]</p>
</div>"}
if(style)
dat += {"</div>"}
dat += {"<div class='column'>"}
if(maybes || user == src)
dat += {"<div class="collapsible_b"><b><center>Maybes</center></b></div>"}
if(user == src)
dat += {"
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_note_maybes=1' class='button'>Edit</a>
</td>
</table>
"}
if(maybes)
dat += {"
<div class="content">
<p>[maybes]</p>
</div>
"}
if(style)
dat += {"</div>"}
dat += {"<div class='column'>"}
if(dislikes || user == src)
dat += {"<div class="collapsible_c"><b><center>Dislikes</center></b></div>"}
if(user == src)
dat += {"
<table>
<td class="button">
<a href='byond://?src=\ref[src];edit_ooc_note_dislikes=1' class='button'>Edit</a>
</td>
</table>
"}
if(dislikes)
dat += {"
<div class="content">
<p>[dislikes]</p>
</div>
"}
if(style)
dat += {"</div></div>"}
dat+= {" </body>
</html>"}
var/key = "ooc_notes[src.real_name]" //Generate a unique key so we can make unique clones of windows, that way we can have more than one
if(src.ckey)
key = "[key][src.ckey]" //Add a ckey if they have one, in case their name is the same
winclone(user, "ooc_notes", key) //Allows us to have more than one OOC notes panel open
winshow(user, key, TRUE) //Register our window
var/datum/browser/popup = new(user, key, "OOC Notes: [src.name]", 500, 600) //Create the window
popup.set_content(dat) //Populate window contents
popup.open(FALSE) // Skip registring onclose on the browser pane
onclose(user, key, src) // We want to register on the window itself