[MIRROR] Clean Up Global Tab (#9848)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-01-12 07:34:23 -07:00
committed by GitHub
parent 3c0f30bf8b
commit f68a9f4f1d
4 changed files with 58 additions and 64 deletions

View File

@@ -2,6 +2,8 @@
name = "Basic"
sort_order = 1
var/datum/paiCandidate/candidate
/datum/category_item/player_setup_item/antagonism/basic/load_character(list/save_data)
pref.exploit_record = save_data["exploit_record"]
pref.antag_faction = save_data["antag_faction"]
@@ -12,6 +14,29 @@
save_data["antag_faction"] = pref.antag_faction
save_data["antag_vis"] = pref.antag_vis
/datum/category_item/player_setup_item/antagonism/basic/load_preferences(datum/json_savefile/savefile)
if(!candidate)
candidate = new()
var/preference_mob = preference_mob()
if(!preference_mob)// No preference mob - this happens when we're called from client/New() before it calls ..() (via datum/preferences/New())
spawn()
preference_mob = preference_mob()
if(!preference_mob)
return
candidate.savefile_load(preference_mob)
return
candidate.savefile_load(preference_mob)
/datum/category_item/player_setup_item/antagonism/basic/save_preferences(datum/json_savefile/savefile)
if(!candidate)
return
if(!preference_mob())
return
candidate.savefile_save(preference_mob())
/datum/category_item/player_setup_item/antagonism/basic/sanitize_character()
if(!pref.antag_faction) pref.antag_faction = "None"
if(!pref.antag_vis) pref.antag_vis = "Hidden"
@@ -32,6 +57,15 @@
. += span_bold("You are banned from using character records.") + "<br>"
else
. +="<a href='byond://?src=\ref[src];exploitable_record=1'>[TextPreview(pref.exploit_record,40)]</a><br>"
. += "<br>"
. += span_bold("pAI:") + "<br>"
if(!candidate)
log_debug("[user] pAI prefs have a null candidate var.")
return .
. += "Name: <a href='byond://?src=\ref[src];option=name'>[candidate.name ? candidate.name : "None Set"]</a><br>"
. += "Description: <a href='byond://?src=\ref[src];option=desc'>[candidate.description ? TextPreview(candidate.description, 40) : "None Set"]</a><br>"
. += "Role: <a href='byond://?src=\ref[src];option=role'>[candidate.role ? TextPreview(candidate.role, 40) : "None Set"]</a><br>"
. += "OOC Comments: <a href='byond://?src=\ref[src];option=ooc'>[candidate.comments ? TextPreview(candidate.comments, 40) : "None Set"]</a><br>"
/datum/category_item/player_setup_item/antagonism/basic/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["uplinklocation"])
@@ -66,4 +100,25 @@
pref.antag_vis = choice
return TOPIC_REFRESH
if(href_list["option"])
var/t
switch(href_list["option"])
if("name")
t = sanitizeName(tgui_input_text(user, "Enter a name for your pAI", "Global Preference", candidate.name, MAX_NAME_LEN), MAX_NAME_LEN, 1)
if(t && CanUseTopic(user))
candidate.name = t
if("desc")
t = tgui_input_text(user, "Enter a description for your pAI", "Global Preference", html_decode(candidate.description), multiline = TRUE, prevent_enter = TRUE)
if(!isnull(t) && CanUseTopic(user))
candidate.description = sanitize(t)
if("role")
t = tgui_input_text(user, "Enter a role for your pAI", "Global Preference", html_decode(candidate.role))
if(!isnull(t) && CanUseTopic(user))
candidate.role = sanitize(t)
if("ooc")
t = tgui_input_text(user, "Enter any OOC comments", "Global Preference", html_decode(candidate.comments), multiline = TRUE, prevent_enter = TRUE)
if(!isnull(t) && CanUseTopic(user))
candidate.comments = sanitize(t)
return TOPIC_REFRESH
return ..()

View File

@@ -1,62 +0,0 @@
/datum/category_item/player_setup_item/player_global/pai
name = "pAI"
sort_order = 3
var/datum/paiCandidate/candidate
/datum/category_item/player_setup_item/player_global/pai/load_preferences(datum/json_savefile/savefile)
if(!candidate)
candidate = new()
var/preference_mob = preference_mob()
if(!preference_mob)// No preference mob - this happens when we're called from client/New() before it calls ..() (via datum/preferences/New())
spawn()
preference_mob = preference_mob()
if(!preference_mob)
return
candidate.savefile_load(preference_mob)
return
candidate.savefile_load(preference_mob)
/datum/category_item/player_setup_item/player_global/pai/save_preferences(datum/json_savefile/savefile)
if(!candidate)
return
if(!preference_mob())
return
candidate.savefile_save(preference_mob())
/datum/category_item/player_setup_item/player_global/pai/content(var/mob/user)
. += span_bold("pAI:") + "<br>"
if(!candidate)
log_debug("[user] pAI prefs have a null candidate var.")
return .
. += "Name: <a href='byond://?src=\ref[src];option=name'>[candidate.name ? candidate.name : "None Set"]</a><br>"
. += "Description: <a href='byond://?src=\ref[src];option=desc'>[candidate.description ? TextPreview(candidate.description, 40) : "None Set"]</a><br>"
. += "Role: <a href='byond://?src=\ref[src];option=role'>[candidate.role ? TextPreview(candidate.role, 40) : "None Set"]</a><br>"
. += "OOC Comments: <a href='byond://?src=\ref[src];option=ooc'>[candidate.comments ? TextPreview(candidate.comments, 40) : "None Set"]</a><br>"
/datum/category_item/player_setup_item/player_global/pai/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["option"])
var/t
switch(href_list["option"])
if("name")
t = sanitizeName(tgui_input_text(user, "Enter a name for your pAI", "Global Preference", candidate.name, MAX_NAME_LEN), MAX_NAME_LEN, 1)
if(t && CanUseTopic(user))
candidate.name = t
if("desc")
t = tgui_input_text(user, "Enter a description for your pAI", "Global Preference", html_decode(candidate.description), multiline = TRUE, prevent_enter = TRUE)
if(!isnull(t) && CanUseTopic(user))
candidate.description = sanitize(t)
if("role")
t = tgui_input_text(user, "Enter a role for your pAI", "Global Preference", html_decode(candidate.role))
if(!isnull(t) && CanUseTopic(user))
candidate.role = sanitize(t)
if("ooc")
t = tgui_input_text(user, "Enter any OOC comments", "Global Preference", html_decode(candidate.comments), multiline = TRUE, prevent_enter = TRUE)
if(!isnull(t) && CanUseTopic(user))
candidate.comments = sanitize(t)
return TOPIC_REFRESH
return ..()

View File

@@ -26,11 +26,13 @@
name = "Traits"
sort_order = 6
category_item_type = /datum/category_item/player_setup_item/traits
*/ //VOREStation Removal End
//redundant due to having most of its content stripped out, merged into special roles
/datum/category_group/player_setup_category/global_preferences
name = "Global"
sort_order = 6 //VOREStation Edit due to above commented out
category_item_type = /datum/category_item/player_setup_item/player_global
*/ //VOREStation Removal End
/****************************
* Category Collection Setup *