Merge pull request #9672 from KillianKirilenko/kk-misc4

TGUI Character Directory Tweak
This commit is contained in:
Verkister
2021-02-10 07:25:53 +02:00
committed by GitHub
6 changed files with 43 additions and 8 deletions
+2 -1
View File
@@ -7,4 +7,5 @@ GLOBAL_LIST_EMPTY(wire_color_directory) // This is an associative list with the
// Reference list for disposal sort junctions. Filled up by sorting junction's New()
GLOBAL_LIST_EMPTY(tagger_locations)
GLOBAL_LIST_INIT(char_directory_tags, list("Pred", "Prey", "Switch", "Non-Vore", "Unset"))
GLOBAL_LIST_INIT(char_directory_tags, list("Pred", "Prey", "Switch", "Non-Vore", "Unset"))
GLOBAL_LIST_INIT(char_directory_erptags, list("Top", "Bottom", "Switch", "No ERP", "Unset"))
+10 -1
View File
@@ -32,6 +32,7 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
data["personalVisibility"] = user?.client?.prefs?.show_in_directory
data["personalTag"] = user?.client?.prefs?.directory_tag
data["personalErpTag"] = user?.client?.prefs?.directory_erptag
return data
@@ -50,6 +51,7 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
var/ooc_notes = null
var/flavor_text = null
var/tag = C.prefs.directory_tag
var/erptag = C.prefs.directory_erptag
var/character_ad = C.prefs.directory_ad
if(ishuman(C.mob))
@@ -85,6 +87,7 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
"name" = name,
"ooc_notes" = ooc_notes,
"tag" = tag,
"erptag" = erptag,
"character_ad" = character_ad,
"flavor_text" = flavor_text,
)))
@@ -109,11 +112,17 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
update_tgui_static_data(usr, ui)
return TRUE
if("setTag")
var/list/new_tag = input(usr, "Pick a new tag for the character directory", "Character Tag", usr?.client?.prefs?.directory_tag) as null|anything in GLOB.char_directory_tags
var/list/new_tag = input(usr, "Pick a new Vore tag for the character directory", "Character Tag", usr?.client?.prefs?.directory_tag) as null|anything in GLOB.char_directory_tags
if(!new_tag)
return
usr?.client?.prefs?.directory_tag = new_tag
return TRUE
if("setErpTag")
var/list/new_erptag = input(usr, "Pick a new ERP tag for the character directory", "Character ERP Tag", usr?.client?.prefs?.directory_erptag) as null|anything in GLOB.char_directory_erptags
if(!new_erptag)
return
usr?.client?.prefs?.directory_erptag = new_erptag
return TRUE
if("setVisible")
usr?.client?.prefs?.show_in_directory = !usr?.client?.prefs?.show_in_directory
to_chat(usr, "<span class='notice'>You are now [usr.client.prefs.show_in_directory ? "shown" : "not shown"] in the directory.</span>")
@@ -7,12 +7,14 @@
/datum/category_item/player_setup_item/vore/misc/load_character(var/savefile/S)
S["show_in_directory"] >> pref.show_in_directory
S["directory_tag"] >> pref.directory_tag
S["directory_erptag"] >> pref.directory_erptag
S["directory_ad"] >> pref.directory_ad
S["sensorpref"] >> pref.sensorpref //TFF 5/8/19 - add sensor pref setting to load after saved
/datum/category_item/player_setup_item/vore/misc/save_character(var/savefile/S)
S["show_in_directory"] << pref.show_in_directory
S["directory_tag"] << pref.directory_tag
S["directory_erptag"] << pref.directory_erptag
S["directory_ad"] << pref.directory_ad
S["sensorpref"] << pref.sensorpref //TFF 5/8/19 - add sensor pref setting to be saveable
@@ -25,12 +27,14 @@
/datum/category_item/player_setup_item/vore/misc/sanitize_character()
pref.show_in_directory = sanitize_integer(pref.show_in_directory, 0, 1, initial(pref.show_in_directory))
pref.directory_tag = sanitize_inlist(pref.directory_tag, GLOB.char_directory_tags, initial(pref.directory_tag))
pref.directory_erptag = sanitize_inlist(pref.directory_erptag, GLOB.char_directory_erptags, initial(pref.directory_erptag))
pref.sensorpref = sanitize_integer(pref.sensorpref, 1, sensorpreflist.len, initial(pref.sensorpref)) //TFF - 5/8/19 - add santisation for sensor prefs
/datum/category_item/player_setup_item/vore/misc/content(var/mob/user)
. += "<br>"
. += "<b>Appear in Character Directory:</b> <a [pref.show_in_directory ? "class='linkOn'" : ""] href='?src=\ref[src];toggle_show_in_directory=1'><b>[pref.show_in_directory ? "Yes" : "No"]</b></a><br>"
. += "<b>Character Directory Tag:</b> <a href='?src=\ref[src];directory_tag=1'><b>[pref.directory_tag]</b></a><br>"
. += "<b>Character Directory Vore Tag:</b> <a href='?src=\ref[src];directory_tag=1'><b>[pref.directory_tag]</b></a><br>"
. += "<b>Character Directory ERP Tag:</b> <a href='?src=\ref[src];directory_erptag=1'><b>[pref.directory_erptag]</b></a><br>"
. += "<b>Character Directory Advertisement:</b> <a href='?src=\ref[src];directory_ad=1'><b>Set Directory Ad</b></a><br>"
. += "<b>Suit Sensors Preference:</b> <a [pref.sensorpref ? "" : ""] href='?src=\ref[src];toggle_sensor_setting=1'><b>[sensorpreflist[pref.sensorpref]]</b></a><br>" //TFF 5/8/19 - Allow selection of sensor settings from off, binary, vitals, tracking, or random
@@ -39,11 +43,17 @@
pref.show_in_directory = pref.show_in_directory ? 0 : 1;
return TOPIC_REFRESH
else if(href_list["directory_tag"])
var/new_tag = input(user, "Pick a new tag for the character directory", "Character Tag", pref.directory_tag) as null|anything in GLOB.char_directory_tags
var/new_tag = input(user, "Pick a new Vore tag for the character directory", "Character Vore Tag", pref.directory_tag) as null|anything in GLOB.char_directory_tags
if(!new_tag)
return
pref.directory_tag = new_tag
return TOPIC_REFRESH
else if(href_list["directory_erptag"])
var/new_erptag = input(user, "Pick a new ERP tag for the character directory", "Character ERP Tag", pref.directory_erptag) as null|anything in GLOB.char_directory_erptags
if(!new_erptag)
return
pref.directory_erptag = new_erptag
return TOPIC_REFRESH
else if(href_list["directory_ad"])
var/msg = sanitize(input(user,"Write your advertisement here!", "Flavor Text", html_decode(pref.directory_ad)) as message, extra = 0) //VOREStation Edit: separating out OOC notes
pref.directory_ad = msg
+1
View File
@@ -1,6 +1,7 @@
/datum/preferences
var/show_in_directory = 1 //Show in Character Directory
var/directory_tag = "Unset" //Sorting tag to use in character directory
var/directory_erptag = "No ERP" //ditto, but for non-vore scenes
var/directory_ad = "" //Advertisement stuff to show in character directory.
var/sensorpref = 5 //Set character's suit sensor level
@@ -25,6 +25,7 @@ export const CharacterDirectory = (props, context) => {
const {
personalVisibility,
personalTag,
personalErpTag,
} = data;
const [overlay, setOverlay] = useLocalState(context, "overlay", null);
@@ -44,12 +45,18 @@ export const CharacterDirectory = (props, context) => {
content={personalVisibility ? "Shown" : "Not Shown"}
onClick={() => act("setVisible")} />
</LabeledList.Item>
<LabeledList.Item label="Tag">
<LabeledList.Item label="Vore Tag">
<Button
fluid
content={personalTag}
onClick={() => act("setTag")} />
</LabeledList.Item>
<LabeledList.Item label="ERP Tag">
<Button
fluid
content={personalErpTag}
onClick={() => act("setErpTag")} />
</LabeledList.Item>
<LabeledList.Item label="Advertisement">
<Button
fluid
@@ -76,11 +83,16 @@ const ViewCharacter = (props, context) => {
content="Back"
onClick={() => setOverlay(null)} />
}>
<Section level={2} title="Tag">
<Section level={2} title="Vore Tag">
<Box p={1} backgroundColor={getTagColor(overlay.tag)}>
{overlay.tag}
</Box>
</Section>
<Section level={2} title="ERP Tag">
<Box>
{overlay.erptag}
</Box>
</Section>
<Section level={2} title="Character Ad">
<Box style={{ "word-break": "break-all" }}>
{overlay.character_ad ? overlay.character_ad.split("\n").map((c, i) => <Box key={i}>{c}</Box>) : "Unset."}
@@ -121,7 +133,8 @@ const CharacterDirectoryList = (props, context) => {
<Table>
<Table.Row bold>
<SortButton id="name">Name</SortButton>
<SortButton id="tag">Tag</SortButton>
<SortButton id="tag">Vore Tag</SortButton>
<SortButton id="erptag">ERP Tag</SortButton>
<Table.Cell collapsing textAlign="right">View</Table.Cell>
</Table.Row>
{directory
@@ -133,6 +146,7 @@ const CharacterDirectoryList = (props, context) => {
<Table.Row key={i} backgroundColor={getTagColor(character.tag)}>
<Table.Cell p={1}>{character.name}</Table.Cell>
<Table.Cell>{character.tag}</Table.Cell>
<Table.Cell>{character.erptag}</Table.Cell>
<Table.Cell collapsing textAlign="right">
<Button
onClick={() => setOverlay(character)}
File diff suppressed because one or more lines are too long