Removes the Skills Tab From the Character Setup Screen (#14591)

This commit is contained in:
SleepyGemmy
2023-02-13 23:11:17 +01:00
committed by GitHub
parent a3ce596030
commit 5dd5cbc9e1
11 changed files with 18 additions and 432 deletions
@@ -28,35 +28,30 @@
sort_order = 2
category_item_type = /datum/category_item/player_setup_item/origin
/datum/category_group/player_setup_category/skill_preferences
name = "Skills"
sort_order = 3
category_item_type = /datum/category_item/player_setup_item/skills
/datum/category_group/player_setup_category/occupation_preferences
name = "Occupation"
sort_order = 4
sort_order = 3
category_item_type = /datum/category_item/player_setup_item/occupation
/datum/category_group/player_setup_category/appearance_preferences
name = "Roles"
sort_order = 5
sort_order = 4
category_item_type = /datum/category_item/player_setup_item/antagonism
/datum/category_group/player_setup_category/loadout_preferences
name = "Loadout"
sort_order = 6
sort_order = 5
category_item_type = /datum/category_item/player_setup_item/loadout
/datum/category_group/player_setup_category/global_preferences
name = "Global"
sort_order = 7
sort_order = 6
category_item_type = /datum/category_item/player_setup_item/player_global
sql_role = SQL_PREFERENCES
/datum/category_group/player_setup_category/other_preferences
name = "Other"
sort_order = 8
sort_order = 7
category_item_type = /datum/category_item/player_setup_item/other
/****************************
@@ -1,126 +0,0 @@
/datum/category_item/player_setup_item/skills
name = "Skills"
sort_order = 1
/datum/category_item/player_setup_item/skills/load_character(var/savefile/S)
S["skills"] >> pref.skills
S["used_skillpoints"] >> pref.used_skillpoints
S["skill_specialization"] >> pref.skill_specialization
/datum/category_item/player_setup_item/skills/save_character(var/savefile/S)
S["skills"] << pref.skills
S["used_skillpoints"] << pref.used_skillpoints
S["skill_specialization"] << pref.skill_specialization
/datum/category_item/player_setup_item/skills/gather_load_query()
return list(
"ss13_characters" = list(
"vars" = list(
"skills",
"skill_specialization"
),
"args" = list("id")
)
)
/datum/category_item/player_setup_item/skills/gather_load_parameters()
return list("id" = pref.current_character)
/datum/category_item/player_setup_item/skills/gather_save_query()
return list(
"ss13_characters" = list(
"skills",
"skill_specialization",
"id" = 1,
"ckey" = 1
)
)
/datum/category_item/player_setup_item/skills/gather_save_parameters()
return list(
"skills" = list2params(pref.skills),
"skill_specialization" = pref.skill_specialization,
"id" = pref.current_character,
"ckey" = PREF_CLIENT_CKEY
)
/datum/category_item/player_setup_item/skills/sanitize_character(var/sql_load = 0)
if (SKILLS == null)
setup_skills()
if (!pref.skills)
pref.skills = list()
if (sql_load)
pref.skills = params2list(pref.skills)
if (!pref.skills || !islist(pref.skills) || !pref.skills.len)
pref.ZeroSkills()
else
for (var/skill in pref.skills)
pref.skills[skill] = text2num(pref.skills[skill])
pref.CalculateSkillPoints()
if (!pref.skills.len)
pref.ZeroSkills()
if (pref.used_skillpoints < 0)
pref.used_skillpoints = 0
/datum/category_item/player_setup_item/skills/content(var/mob/user)
var/list/dat = list(
"<b>Select your Skills</b><br>",
"Current skill level: <b>[pref.GetSkillClass(pref.used_skillpoints)]</b> ([pref.used_skillpoints])<br>",
"<a href='?src=\ref[src];preconfigured=1'>Use preconfigured skillset</a><br>",
"<table>"
)
for(var/V in SKILLS)
dat += "<tr><th colspan = 5><b>[V]</b>"
dat += "</th></tr>"
for(var/datum/skill/S in SKILLS[V])
var/level = pref.skills[S.ID]
dat += "<tr style='text-align:left;'>"
dat += "<th><a href='?src=\ref[src];skillinfo=\ref[S]'>[S.name]</a></th>"
dat += "<th><a href='?src=\ref[src];setskill=\ref[S];newvalue=[SKILL_NONE]'><font color=[(level == SKILL_NONE) ? "red" : ""]>\[Untrained\]</font></a></th>"
// secondary skills don't have an amateur level
if(S.secondary)
dat += "<th></th>"
else
dat += "<th><a href='?src=\ref[src];setskill=\ref[S];newvalue=[SKILL_BASIC]'><font color=[(level == SKILL_BASIC) ? "red" : ""]>\[Amateur\]</font></a></th>"
dat += "<th><a href='?src=\ref[src];setskill=\ref[S];newvalue=[SKILL_ADEPT]'><font color=[(level == SKILL_ADEPT) ? "red" : ""]>\[Trained\]</font></a></th>"
dat += "<th><a href='?src=\ref[src];setskill=\ref[S];newvalue=[SKILL_EXPERT]'><font color=[(level == SKILL_EXPERT) ? "red" : ""]>\[Professional\]</font></a></th>"
dat += "</tr>"
dat += "</table>"
. = dat.Join()
/datum/category_item/player_setup_item/skills/OnTopic(href, href_list, user)
if(href_list["skillinfo"])
var/datum/skill/S = locate(href_list["skillinfo"])
var/HTML = "<b>[S.name]</b><br>[S.desc]"
user << browse(HTML, "window=\ref[user]skillinfo")
return TOPIC_HANDLED
else if(href_list["setskill"])
var/datum/skill/S = locate(href_list["setskill"])
var/value = text2num(href_list["newvalue"])
pref.skills[S.ID] = value
pref.CalculateSkillPoints()
return TOPIC_REFRESH
else if(href_list["preconfigured"])
var/selected = input(user, "Select a skillset", "Skillset") as null|anything in SKILL_PRE
if(!selected && !CanUseTopic(user)) return
pref.ZeroSkills(1)
for(var/V in SKILL_PRE[selected])
if(V == "field")
pref.skill_specialization = SKILL_PRE[selected]["field"]
continue
pref.skills[V] = SKILL_PRE[selected][V]
pref.CalculateSkillPoints()
return TOPIC_REFRESH
else if(href_list["setspecialization"])
pref.skill_specialization = href_list["setspecialization"]
pref.CalculateSkillPoints()
return TOPIC_REFRESH
return ..()
-61
View File
@@ -125,10 +125,6 @@ datum/preferences
//Keeps track of preferrence for not getting any wanted jobs
var/alternate_option = RETURN_TO_LOBBY
var/used_skillpoints = 0
var/skill_specialization = null
var/list/skills = list() // skills can range from 0 to 3
// maps each organ to either null(intact), "cyborg" or "amputated"
// will probably not be able to do this for head and torso ;)
var/list/organ_data = list()
@@ -215,58 +211,6 @@ datum/preferences
var/datum/species/mob_species = all_species[species]
return mob_species.age_max
/datum/preferences/proc/ZeroSkills(var/forced = 0)
for(var/V in SKILLS) for(var/datum/skill/S in SKILLS[V])
if(!skills.Find(S.ID) || forced)
skills[S.ID] = SKILL_NONE
/datum/preferences/proc/CalculateSkillPoints()
used_skillpoints = 0
for(var/V in SKILLS) for(var/datum/skill/S in SKILLS[V])
var/multiplier = 1
switch(skills[S.ID])
if(SKILL_NONE)
used_skillpoints += 0 * multiplier
if(SKILL_BASIC)
used_skillpoints += 1 * multiplier
if(SKILL_ADEPT)
// secondary skills cost less
if(S.secondary)
used_skillpoints += 1 * multiplier
else
used_skillpoints += 3 * multiplier
if(SKILL_EXPERT)
// secondary skills cost less
if(S.secondary)
used_skillpoints += 3 * multiplier
else
used_skillpoints += 6 * multiplier
/datum/preferences/proc/GetSkillClass(points)
return CalculateSkillClass(points, age)
/proc/CalculateSkillClass(points, age)
if(points <= 0) return "Unconfigured"
// skill classes describe how your character compares in total points
points -= min(round((age - 20) / 2.5), 4) // every 2.5 years after 20, one extra skillpoint
if(age > 30)
points -= round((age - 30) / 5) // every 5 years after 30, one extra skillpoint
switch(points)
if(-1000 to 3)
return "Terrifying"
if(4 to 6)
return "Below Average"
if(7 to 10)
return "Average"
if(11 to 14)
return "Above Average"
if(15 to 18)
return "Exceptional"
if(19 to 24)
return "Genius"
if(24 to 1000)
return "God"
/datum/preferences/proc/ShowChoices(mob/user)
if(!user || !user.client) return
var/dat = "<center>"
@@ -473,9 +417,6 @@ datum/preferences
character.origin.on_apply(character)
character.culture.on_apply(character)
character.skills = skills
character.used_skillpoints = used_skillpoints
// Destroy/cyborgize organs & setup body markings
character.sync_organ_prefs_to_mob(src)
@@ -620,8 +561,6 @@ datum/preferences
gear_list = list() //Dont copy the loadout
ZeroSkills(1)
// Do we need to reinitialize a whole bunch more vars?
if (re_initialize)
be_special_role = list()