mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 13:30:42 +01:00
Skills System Revival: The Things She Remembered Had Never Been Her Own (#21853)
This PR is a revisit to the previously derelict PR #20159 that has been unfinished for sometime now. More details about it in general can be found here: https://github.com/orgs/Aurorastation/projects/2?pane=issue&itemId=53167153 For awhile I've been talking about "Things I've been doing but it would be really nice to do them with a skills system", or "And here's how I would put this into the skills system when it's done". The main thing that was stopping me from building it myself was having poor real life skills in UI code and in DB code. However, I've gotten permission to resume this PR, which has already completed the steps I would not have been able to do myself. The rest of the PR fits well into my skillset as a dev. I'm opening this PR as a draft so as to enable my dev environment to locally track all the previously modified files. I'll take this PR out of draft and give this a full writeup when I have more work to show for the PR this weekend. ### TODO - [x] Rework a decent chunk of the currently existing skills to no longer require hardcoded inserts into other systems. EG, converting from classical ss13 methods, to modern /tg/-style ECS coding methods that work off of component-signal patterns. - [x] Make sure all of the existing skills have actual game functionality (I won't PR a 2016 Baystation12 situation where 90% of the skills are fluff only) - [x] Add the various skills not yet made but are necessary for completion sake, EG: Pilot (Spacecraft), Gunnery, Pilot (Walkers). - [x] Examine each existing job in the game and assess whether it should have a skill made with it in mind, or if it's covered by an existing skill. - [x] TO DISCUSS, BUT NOT ESSENTIAL: Additional skill proposals not currently in the pre-existing TODO list, proposing subcategories. - [x] Ensure that the previous TODO list is completed. ### Current Skills The current list of skills, checkmarked for if I've completed them/they have actual game mechanics. Or if we're just relegating them to separate PRs. Originally this list was going to be forced to visit for a bare minimum "does at least one thing" requirement, but now that is being forgone due to this PR ballooning out of control and in complexity, as well as development time overruns. - [x] Bartending - [x] Cooking - [x] Gardening - [x] Entertaining - [x] Electrical Engineering - [x] Mechanical Engineering - [x] Atmospherics Systems - [x] Reactor Systems - [x] Medicine - [x] Surgery - [x] Pharmacology - [x] Anatomy - [x] Forensics - [x] Robotics - [x] Pilot: Spacecraft - [x] Pilot: Exosuits - [x] Research - [x] Xenobotany - [x] Xenoarchaeology - [x] Xenobiology - [x] Unarmed Combat - [x] Armed Combat - [x] Firearms - [x] Leadership --------- Signed-off-by: VMSolidus <evilexecutive@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: FabianK3 <21039694+FabianK3@users.noreply.github.com> Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
This commit is contained in:
co-authored by
Matt Atlas
FabianK3
Matt Atlas
parent
2948b1dc87
commit
260f744906
@@ -99,11 +99,43 @@
|
||||
if(locate(/datum/stack_recipe) in recipes_sublist)
|
||||
var/sublist_title = sublist ? " ([capitalize_first_letters(sublist.title)])" : ""
|
||||
t1 += "<h2>Recipes[sublist_title]</h2>"
|
||||
|
||||
// Cache "skill visits" to avoid having to constantly recheck for components.
|
||||
var/alist/checked_skills = alist()
|
||||
var/visited_skill = null // Trinary boolean as null/0/nonzero
|
||||
|
||||
for(var/datum/stack_recipe/R in recipes_sublist)
|
||||
var/lacks_skill = FALSE
|
||||
// If you put anything other than a skill component in the required skills for a recipe, I will destroy you.
|
||||
for(var/skill_comp, skill_level_requirement in R.required_skills_hard)
|
||||
visited_skill = checked_skills[skill_comp]
|
||||
// ** Trinary Check for Null, 0, or Nonzero. **
|
||||
// Case for skill hasn't been checked yet.
|
||||
if (isnull(visited_skill))
|
||||
// null if no component at all, otherwise equal to the skill level (which can be any real number).
|
||||
var/visited_comp = astype(user.GetComponent(skill_comp), SKILL_COMPONENT)?.skill_level
|
||||
|
||||
// Case for "Non-Player Characters", which will never have the component at all.
|
||||
if (isnull(visited_comp))
|
||||
checked_skills[skill_comp] = SKILL_LEVEL_PROFESSIONAL
|
||||
continue // Not a player character, just assume they can craft everything.
|
||||
|
||||
// Player characters will always have the component if relevant.
|
||||
checked_skills[skill_comp] = visited_comp
|
||||
if (visited_comp < skill_level_requirement)
|
||||
lacks_skill = TRUE
|
||||
break
|
||||
// Case for skill has been checked AND the character has the component.
|
||||
else if (visited_skill < skill_level_requirement)
|
||||
lacks_skill = TRUE
|
||||
break
|
||||
|
||||
var/max_multiplier = round(src.get_amount() / R.req_amount)
|
||||
var/title = ""
|
||||
var/can_build = TRUE
|
||||
can_build = (max_multiplier > 0)
|
||||
if(lacks_skill)
|
||||
can_build = FALSE
|
||||
|
||||
if(R.res_amount > 1)
|
||||
title += "[R.res_amount]x [R.title]\s"
|
||||
@@ -116,7 +148,7 @@
|
||||
var/sublist_var = sublist ? "[REF(sublist)]" : ""
|
||||
t1 += "<a href='byond://?src=[REF(src)];make=[REF(R)];sublist=[sublist_var];multiplier=1'>[title]</a>"
|
||||
else
|
||||
t1 += "<div class='no-build inline'>[title]</div><br>"
|
||||
t1 += "[lacks_skill ? "<span class='warning'>Missing Skill — " : ""]<div class='no-build inline'>[title]</div>[lacks_skill ? "</span>" : ""]<br>"
|
||||
continue
|
||||
|
||||
if(R.max_res_amount > 1 && max_multiplier > 1)
|
||||
@@ -157,14 +189,22 @@
|
||||
if (recipe.on_floor && !isfloor(user.loc))
|
||||
to_chat(user, SPAN_WARNING("\The [recipe.title] must be constructed on the floor!"))
|
||||
return
|
||||
var/skill_diff = 0
|
||||
for (var/skill_type, required_level in recipe.required_skills_soft)
|
||||
skill_diff += required_level - astype(user.GetComponent(skill_type), SKILL_COMPONENT)?.skill_level
|
||||
|
||||
to_chat(user, SPAN_NOTICE("Building [recipe.title]..."))
|
||||
if (recipe.time)
|
||||
if (!do_after(user, recipe.time, do_flags = DO_REPAIR_CONSTRUCT))
|
||||
var/doafter_time = recipe.time
|
||||
if (doafter_time)
|
||||
|
||||
// Approximately no crafting time if you beat the skill req by 4, approximately twice as long to craft if you're under by 4.
|
||||
// No need to do an expensive min because it is mathematically impossible for this to ever be negative.
|
||||
doafter_time += doafter_time * ftanh(0.5 * skill_diff)
|
||||
if (!do_after(user, doafter_time, do_flags = DO_REPAIR_CONSTRUCT))
|
||||
return
|
||||
|
||||
if (use(required))
|
||||
recipe.Produce(produced, user.loc, user.dir, user)
|
||||
recipe.Produce(produced, user.loc, user.dir, user, skill_diff)
|
||||
|
||||
/obj/item/stack/Topic(href, href_list)
|
||||
..()
|
||||
@@ -365,8 +405,21 @@
|
||||
var/one_per_turf = 0
|
||||
var/on_floor = 0
|
||||
var/use_material
|
||||
/**
|
||||
* Assoc list of required skills to required skill levels. Requirements are taken as a "soft" requirement used to generate a "skill difference", which is applied as a modifier to a d20 roll.
|
||||
* This roll currently just affects the name of the resulting item and is for fun, but should be later expanded to have more unique effects.
|
||||
* THIS MAY ONLY HAVE /datum/component/skill/skill_name in it. I WILL DESTROY YOU IF YOU PUT ANYTHING ELSE IN HERE.
|
||||
*/
|
||||
var/alist/required_skills_soft
|
||||
|
||||
/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0, supplied_material = null)
|
||||
/**
|
||||
* Assoc list of required skills to required skill levels. This is the MINIMUM to craft the item.
|
||||
* You must have ALL these skills at that level to see the item as craftable.
|
||||
* THIS MAY ONLY HAVE /datum/component/skill/skill_name in it. I WILL DESTROY YOU IF YOU PUT ANYTHING ELSE IN HERE.
|
||||
*/
|
||||
var/alist/required_skills_hard
|
||||
|
||||
/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0, supplied_material = null, alist/required_skills_soft, alist/required_skills_hard)
|
||||
src.title = title
|
||||
src.result_type = result_type
|
||||
if(ispath(result_type, /obj/structure))
|
||||
@@ -380,8 +433,10 @@
|
||||
src.one_per_turf = one_per_turf
|
||||
src.on_floor = on_floor
|
||||
src.use_material = supplied_material
|
||||
src.required_skills_soft = required_skills_soft
|
||||
src.required_skills_hard = required_skills_hard
|
||||
|
||||
/datum/stack_recipe/proc/Produce(var/amount = 1, var/loc = null, var/dir = NORTH, var/user = null)
|
||||
/datum/stack_recipe/proc/Produce(var/amount = 1, var/loc = null, var/dir = NORTH, var/user = null, var/skill_diff = 0)
|
||||
if(amount < 1)
|
||||
return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user