mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 11:12:14 +00:00
Integrated circuits for modular computers (#80530) This PR integrates circuits for modular computers and a good bits of their programs. The peculiarity here is that modular computers have no fixed amount of unremovable components (except the base one with just a couple ports for now), instead, they're added and removed along with programs. With a few exceptions (such as the messenger and signaler), for these program circuits to work, their associated program has to be either open or in the background. For a reason or another, not all programs have a circuit associated to them, still, however the programs with a circuit are still a handful. They are: - Nanotrasen Pay System - Notepad - SiliConnect - WireCarp - MODsuit Control - Spectre Meter - Direct Messenger* - LifeConnect - Custodial Locator - Fission360 - Camera - Status Display - SignalCommander *By the by, sending messages has a cooldown, so it shouldn't be as spammy. If it turns out to not be enough, I can make it so messages from circuit will be ignored by other messenger circuits. The PR is no longer WIP. I believe modular computers could make for some interesting setups with circuits, since they're fairly flexible and stocked with features unlike many other appliances, therefore also a speck more abusable, though limits, cooldowns, logging and sanitization have been implemented to keep it in check. 🆑 add: Modular Computers now support integrated circuits. What can be done with them depends on the programs installed and whether they're running (open or background). add: Modular Consoles (the machinery) now have a small backup cell they draw power from if the power goes out. /🆑 Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
64 lines
2.2 KiB
Plaintext
64 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"
|
|
can_run_on_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, datum/ui_state/state)
|
|
. = ..()
|
|
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
|