mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-17 20:47:29 +00:00
## About The Pull Request I deleted the documentation file of ModPCs because it was barebones and had no new information to give that autodoc couldn't. Just to make sure this isn't a net-negative, I improved on much of the autodoc and comments in general around ModPC code to help people understand easier what's going on around it. I also renamed vars that were too easily confused with other var names, and reworked the ntnet downloader a little; - it now has a search bar - it now has more sections to scroll through, hopefully making it more accurate and easy to find what you need. - also organized the apps that were previously shoved in 'other'. - i also upgraded it to a .tsx because why not video demonstration https://github.com/tgstation/tgstation/assets/53777086/cbba4c1c-b8a8-4ba4-8628-aea8389999fc ## Why It's Good For The Game Adds in a lot of comments that were previously missing, clears up some sources of confusion within ModPC code, and improves NTNet Downloader, something I've procrastinated on doing for a very long time now. ## Changelog 🆑 qol: NTNet Downloader now has a search bar, and programs are now better sorted. /🆑
63 lines
2.2 KiB
Plaintext
63 lines
2.2 KiB
Plaintext
/datum/computer_file/program/skill_tracker
|
|
filename = "skilltracker"
|
|
filedesc = "ExperTrak Skill Tracker"
|
|
downloader_category = PROGRAM_CATEGORY_DEVICE
|
|
program_open_overlay = "generic"
|
|
extended_desc = "Scan and view your current marketable job skills."
|
|
size = 2
|
|
tgui_id = "NtosSkillTracker"
|
|
program_icon = "medal"
|
|
usage_flags = PROGRAM_PDA // Must be a handheld device to read read your chakras or whatever
|
|
|
|
/datum/computer_file/program/skill_tracker/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
var/list/skills = list()
|
|
data["skills"] = skills
|
|
|
|
var/datum/mind/targetmind = user.mind
|
|
if(targetmind)
|
|
for (var/type in GLOB.skill_types)
|
|
var/datum/skill/skill = GetSkillRef(type)
|
|
var/lvl_num = targetmind.get_skill_level(type)
|
|
var/lvl_name = uppertext(targetmind.get_skill_level_name(type))
|
|
var/exp = targetmind.get_skill_exp(type)
|
|
var/xp_prog_to_level = targetmind.exp_needed_to_level_up(type)
|
|
var/xp_req_to_level = 0
|
|
if (xp_prog_to_level && lvl_num < length(SKILL_EXP_LIST)) // is it even possible to level up?
|
|
xp_req_to_level = SKILL_EXP_LIST[lvl_num+1] - SKILL_EXP_LIST[lvl_num]
|
|
|
|
var/list/skilldata = list(
|
|
"name" = skill.name,
|
|
"desc" = skill.desc,
|
|
"title" = skill.title,
|
|
"lvl_name" = lvl_name
|
|
)
|
|
if (exp && xp_req_to_level)
|
|
skilldata["progress_percent"] = (xp_req_to_level-xp_prog_to_level)/xp_req_to_level
|
|
skilldata["overall_percent"] = exp / SKILL_EXP_LIST[length(SKILL_EXP_LIST)]
|
|
if (lvl_num >= length(SKILL_EXP_LIST) && !(type in targetmind.skills_rewarded))
|
|
skilldata["reward"] = TRUE
|
|
skills[++skills.len] = skilldata
|
|
|
|
return data
|
|
|
|
/datum/computer_file/program/skill_tracker/proc/find_skilltype(name)
|
|
for(var/type in GLOB.skill_types)
|
|
var/datum/skill/skill = GetSkillRef(type)
|
|
if(skill.name == name)
|
|
return type
|
|
|
|
return null
|
|
|
|
/datum/computer_file/program/skill_tracker/ui_act(action, params, datum/tgui/ui)
|
|
switch(action)
|
|
if("PRG_reward")
|
|
var/skill_type = find_skilltype(params["skill"])
|
|
if(skill_type)
|
|
var/datum/skill/skill = GetSkillRef(skill_type)
|
|
var/datum/mind/mind = ui.user.mind
|
|
var/new_level = mind.get_skill_level(skill_type)
|
|
skill.try_skill_reward(mind, new_level)
|
|
return TRUE
|