Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Allergies #34500

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Conversation

emmanuelbassil
Copy link
Contributor

@emmanuelbassil emmanuelbassil commented Jan 30, 2024

馃啈 emmanuelbassil
rscadd: Adds ability to select minor or severe allergies to selected reagents in character setup screen.
rscadd: Adds Allergy autoinjectors in loadout; can only be equipped if character has an allergy. Contains inaprovaline and epinephrine.
rscadd: Minor allergies cause itching and resolve on their own with time. Can also be resolved with inaprovaline.
rscadd: Major allergies cause breathing problems, do not resolve on their own. Require inaprovaline for stabilization and epinephrine to reverse the reaction.
rscadd: Medical records automatically populate with allergies selected in setup screen.
code: Can now set specific traits as requirements for loadout items; currently only used for allergy autoinjectors.
admin: Adds verbs in mob variable panel to add/remove traits
/馃啈

Starting a project to expand on traits.
Since next step involves allowing some traits (and not all) to be set in character setup; figured I'd preface it by allowing admins to add/remove traits from VV.

Also added the ability to associate traits with lists; in case you want to give a trait a severity and another instruction. Only used for allergies at the moment.

Will use this as my to-do list:

  • Add character setup screen to add procs
  • Add EpiPens to loadout if allergy enabled.
  • Pick list of allergens
  • Make sure incompatible traits work
  • Make sure no interference with species innate traits
  • Use Amatoxin for inspiration for symptoms?
  • Add automatically populated medical records
  • Implement allergy checks at mob metabolism level
  • Create proc for mild allergy and proc for 'healing it'. Set the resolution proc on a timer that is called early if medicated?
  • Create proc for anaphylaxis; no healing timer. Medication or death.

For Separate PRs

  • Allow skin to change color to simulate rash.
  • Add proper food allergies where ingredients matter?
  • Replace hand picked list with global list sans exceptions?
  • Add cross-reactivity? (or subtype reactivity)
  • Create 'random allergies' button on setup for mild allergies. Also make it an event?
  • Add wheezing to physical exam?
  • Adjust metabolism of drug; specifically IV versus oral rate into chem_doses
  • Add proc to check species/other conditions and integrate it into AddTrait
  • Create Proc for proper anaphylactic shock instead of relying on chem_effects?

@emmanuelbassil emmanuelbassil changed the title Adds Debug verbs for traits [Draft] Adds Debug verbs for traits Jan 31, 2024
@emmanuelbassil emmanuelbassil marked this pull request as draft January 31, 2024 02:00
@emmanuelbassil
Copy link
Contributor Author

At this point; will mark this as draft and just submit the whole complete feature.

@emmanuelbassil emmanuelbassil changed the title [Draft] Adds Debug verbs for traits [Draft] Adds Allergies Jan 31, 2024
code/datums/traits/traits.dm Outdated Show resolved Hide resolved
code/datums/traits/maluses/allergy.dm Outdated Show resolved Hide resolved
code/datums/traits/traits.dm Outdated Show resolved Hide resolved
code/datums/traits/maluses/allergy.dm Outdated Show resolved Hide resolved
code/modules/reagents/Chemistry-Reagents.dm Outdated Show resolved Hide resolved
@@ -68,3 +68,5 @@

/// An associative list of /singleton/trait and trait level - See individual traits for valid levels
var/list/traits
/// Flags set by traits triggering behavior; currently used for allergies.
var/trait_flags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't currently seem to be used anywhere yet, and technically whatever does want to use the trait_flags could just call a variant of process_allergy() instead

Fixes

Auto stash before rebase of "refs/heads/Allergies"
Auto stash before cherry pick of "Adds ability to associate singletons with reagents"

Auto stash before rebase of "refs/heads/Allergies"

Auto stash before rebase of "refs/heads/Allergies"
@emmanuelbassil
Copy link
Contributor Author

Hello, I am reaching the polish and testing stage (see todo list). The feature currently works.

Given I am sure a lot of this is terribly written, you can start reviewing this whenever you鈥檇 like at this point so I can fix whatever needs to be fixed.

@github-actions github-actions bot added the Repo This PR commits changes that affect the repository - Actions, documentation, github metadata, etc label Apr 1, 2024
@emmanuelbassil emmanuelbassil force-pushed the Allergies branch 2 times, most recently from f79657b to c2c1a7b Compare April 1, 2024 16:28
@emmanuelbassil emmanuelbassil marked this pull request as ready for review April 1, 2024 16:29
@emmanuelbassil
Copy link
Contributor Author

emmanuelbassil commented Apr 1, 2024

This is ready to be reviewed.
I was hoping to have the allergy selection screen show the reagent's name as opposed to its path but my brain has shut down and I don't want to hold the feature up on this thing's account (if anyone has any ideas).
There is much room for improvement, which I have in a to-do list for separate PRs up there.

In short, two types of allergies: Mild and Severe

  • Mild allergies give 'you're itching!' messages and an increased pulse. Two ways to stop it: Ride it out until your system washes it out or give inaprovaline. As long as inaprovaline outlives the allergen in your system it will not recur.
  • Severe allergies that markedly increase pulse and make breathing difficult. Only way to stop them is epinephrine; you can't wait to ride this out. However epinephrine should be given with inaprovaline to stabilize the pulse.

In effect, any allergy can be prevented/controlled if you pre-load someone with inaprovaline. So if someone is under medical's care, allergies are usually a non-issue (as it should be, hard to die of an allergy when in a medical facility).

Other additions:

  • Epi-pen in the loadout that can only be equipped if you have an allergy in char setup.
  • Add Trait/Remove Trait verb for admins on the VV screen, all traits are ripe for the choosing.
  • Framework to open other traits for selection during set up with a change of var. For now only allergies are selectable.
  • Medical records populate with the loadout-selected allergies.


///Flags assigned to carbon mobs trait_flags when they're actively having an allergy.
#define MILD_ALLERGY FLAG(0)
#define SEVERE_ALLERGY FLAG(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seem like they would be mutually exclusive - is there a particular reason they're flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I am certain there is a better way to implement this, because you鈥檙e right that they are mutually exclusive.

The reason they鈥檙e flags is because I didn鈥檛 think of a different/better way

@emmanuelbassil emmanuelbassil changed the title [Draft] Adds Allergies Adds Allergies Apr 5, 2024
@emmanuelbassil
Copy link
Contributor Author

Fixed Mistakenot's feedback
Ready for review again

Copy link
Contributor

@SierraKomodo SierraKomodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog seems a big lacking compared to your todo list and PR description

@MuckerMayhem
Copy link
Contributor

Got this crash during init:

[05:00:00] Runtime in code/datums/traits/traits.dm,115: Inappropriate argument fed into proc.
  proc name: crash at (/proc/crash_at)
  src: null
  call stack:
  crash at("Inappropriate argument fed int...", "code/datums/traits/traits.dm", 115)
  sanitize trait prefs(null)
  Body (/datum/category_item/player_setup_item/physical/body): load character(/datum/pref_record_reader/json... (/datum/pref_record_reader/json_list))
  Physical (/datum/category_group/player_setup_category/physical_preferences): load character(/datum/pref_record_reader/json... (/datum/pref_record_reader/json_list))
  /datum/category_collection/pla... (/datum/category_collection/player_setup_collection): load character(/datum/pref_record_reader/json... (/datum/pref_record_reader/json_list))
  /datum/preferences (/datum/preferences): load character(1)
  /datum/preferences (/datum/preferences): load data()
  /datum/preferences (/datum/preferences): setup()
  Character Setup (/datum/controller/subsystem/character_setup): Initialize(122685)
  Character Setup (/datum/controller/subsystem/character_setup): DoInitialize(122685)
  Main (/datum/controller/master): Initialize(10, 0)

Fixes

Fixes

Fixes

Fixes

Fixes

f

Fixes

Auto stash before rebase of "refs/heads/Allergies"

Auto stash before rebase of "refs/heads/Allergies"

Fixes

Auto stash before rebase of "refs/heads/Allergies"

Fixes
@emmanuelbassil
Copy link
Contributor Author

Got this crash during init:

[05:00:00] Runtime in code/datums/traits/traits.dm,115: Inappropriate argument fed into proc.
  proc name: crash at (/proc/crash_at)
  src: null
  call stack:
  crash at("Inappropriate argument fed int...", "code/datums/traits/traits.dm", 115)
  sanitize trait prefs(null)
  Body (/datum/category_item/player_setup_item/physical/body): load character(/datum/pref_record_reader/json... (/datum/pref_record_reader/json_list))
  Physical (/datum/category_group/player_setup_category/physical_preferences): load character(/datum/pref_record_reader/json... (/datum/pref_record_reader/json_list))
  /datum/category_collection/pla... (/datum/category_collection/player_setup_collection): load character(/datum/pref_record_reader/json... (/datum/pref_record_reader/json_list))
  /datum/preferences (/datum/preferences): load character(1)
  /datum/preferences (/datum/preferences): load data()
  /datum/preferences (/datum/preferences): setup()
  Character Setup (/datum/controller/subsystem/character_setup): Initialize(122685)
  Character Setup (/datum/controller/subsystem/character_setup): DoInitialize(122685)
  Main (/datum/controller/master): Initialize(10, 0)

Forgot to add a null check in the sanitize proc; I didn't get it on my end because I've done so much testing the preference file is not null. Should be fixed.

@emmanuelbassil
Copy link
Contributor Author

Changelog updated

@MuckerMayhem MuckerMayhem added the Test Merge Indicates the PR should be trialed on server before further review or approval. label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repo This PR commits changes that affect the repository - Actions, documentation, github metadata, etc Test Merge Indicates the PR should be trialed on server before further review or approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants