mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-19 10:59:39 +01:00
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>
84 lines
3.5 KiB
Plaintext
84 lines
3.5 KiB
Plaintext
/**
|
|
* Container for a single moodlet to be associated with a Morale Component.
|
|
* Only one of each type of moodlet is allowed to exist in a mood component at a time.
|
|
* If you're making a new source of moodlets, add a new child of this type.
|
|
*/
|
|
ABSTRACT_TYPE(/datum/moodlet)
|
|
/**
|
|
* How much this moodlet modifies its owner's morale by.
|
|
* This is simple summed exactly once when the moodlet is created.
|
|
* If anything needs to Set the value of a moodlet, they have to do so by calling set_moodlet().
|
|
* You may only Get this value by calling get_morale_modifier().
|
|
*
|
|
* This is similar to { get; private set; }. Under no circumstances are outside functions ever allowed to directly change this var because other vars depend on it.
|
|
* But there are public procs available to interact with it which obey its own internal rules.
|
|
*/
|
|
VAR_PRIVATE/morale_modifier = 0.0 // Positive and negative floating points are allowed.
|
|
|
|
/**
|
|
*
|
|
*/
|
|
var/moodlet_descriptor = "It's a moodlet!"
|
|
|
|
/**
|
|
* How long this moodlet will last if not refreshed. For Aurora's purposes, moodlets are targeted as having "Small effect, extreme duration".
|
|
* This is by design to encourage players to "Visit the chef at least once a round to do a little RP", while avoiding having moodlet collection interrupt the flow of expeditions.
|
|
*/
|
|
var/duration = 2.0 HOURS
|
|
|
|
/**
|
|
* The target time (in real life seconds) that the moodlet will self-terminate on.
|
|
* This is set automatically during the New() creation of moodlets.
|
|
* This can be updated by calling refresh_moodlet() to reset the time to die.
|
|
*/
|
|
var/time_to_die = 0.0
|
|
|
|
/**
|
|
* Moodlets should always have an associated morale component, but the component owns the moodlets, not the other way around.
|
|
* For the convenience of refreshing individual moodlets, they hold a weakref to their owner.
|
|
* This is set to private here so that we can assert that it will always be a morale component.
|
|
*/
|
|
VAR_PRIVATE/datum/weakref/morale_component
|
|
|
|
/datum/moodlet/New(datum/component/morale/_morale_component, set_points)
|
|
time_to_die = duration + REALTIMEOFDAY
|
|
morale_component = WEAKREF(_morale_component)
|
|
if (set_points) morale_modifier = set_points
|
|
_morale_component.add_morale_points(morale_modifier)
|
|
|
|
/datum/moodlet/Destroy(force)
|
|
if (force)
|
|
// This will be forced when a Morale Component is deleted directly, as it QDEL_NULL_LIST's its own moodlets.
|
|
return ..()
|
|
|
|
// Else if the moodlet is deleted directly rather than its parent.
|
|
var/datum/component/morale/parent = morale_component.resolve()
|
|
if (!parent || !parent.moodlets[src])
|
|
return ..()
|
|
|
|
// Clean the effects of this moodlet from the parent.
|
|
parent.moodlets -= src
|
|
parent.add_morale_points(-morale_modifier)
|
|
return ..()
|
|
|
|
/datum/moodlet/proc/get_morale_modifier()
|
|
return morale_modifier
|
|
|
|
/datum/moodlet/proc/set_moodlet(new_modifier)
|
|
// We can skip the istype() in this case since the held weakref is asserted by VAR_PRIVATE to always be a morale component.
|
|
var/datum/component/morale/possible_morale = morale_component.resolve()
|
|
if (!possible_morale && !QDELING(src))
|
|
// Owner didn't exist, the moodlet has no need to exist either.
|
|
qdel(src)
|
|
return
|
|
|
|
// Add the difference between the new modifier and the old morale points.
|
|
// This should come out to no change if old and new are the same.
|
|
possible_morale.add_morale_points(new_modifier - morale_modifier)
|
|
|
|
// Then set the current morale points to the new ones.
|
|
morale_modifier = new_modifier
|
|
|
|
/datum/moodlet/proc/refresh_moodlet()
|
|
time_to_die = REALTIMEOFDAY + duration
|