From 8ce5d242775139b9b64e50bfd9d6e81c7d176dc6 Mon Sep 17 00:00:00 2001 From: Killian <49700375+KillianKirilenko@users.noreply.github.com> Date: Sun, 10 Sep 2023 23:57:06 +0100 Subject: [PATCH] blood reagents refactor --- code/datums/datacore.dm | 1 + code/game/machinery/computer/medical.dm | 4 ++++ code/game/objects/items/devices/scanners/health.dm | 9 +++++---- .../client/preference_setup/vore/07_traits.dm | 14 ++++++++++++++ code/modules/client/preferences.dm | 1 + code/modules/mob/living/carbon/human/human.dm | 2 +- .../mob/living/carbon/human/species/species.dm | 1 + .../carbon/human/species/station/prometheans.dm | 1 + .../living/carbon/human/species/station/station.dm | 1 + .../carbon/human/species/station/station_vr.dm | 1 + code/modules/reagents/reagents/_reagents.dm | 2 ++ code/modules/reagents/reagents/dispenser.dm | 8 -------- 12 files changed, 32 insertions(+), 13 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index a5bd442b5f6..0d3b7340998 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -369,6 +369,7 @@ var/global/list/PDA_Manifest = list() var/datum/data/record/M = CreateMedicalRecord(H.real_name, id, hidden) M.fields["species"] = "[H.custom_species ? "[H.custom_species] ([H.species.name])" : H.species.name]" //VOREStation Edit M.fields["b_type"] = H.b_type + M.fields["blood_reagent"] = H.species.blood_reagents M.fields["b_dna"] = H.dna.unique_enzymes M.fields["id_gender"] = gender2text(H.identifying_gender) if(H.get_FBP_type()) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 7930231cbfa..69c4e279e31 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -41,6 +41,7 @@ // Medical "id_gender" = "Please select new gender identity:", "blood_type" = "Please select new blood type:", + "blood_reagent" = "Please select new blood basis:", "b_dna" = "Please input new DNA:", "mi_dis" = "Please input new minor disabilities:", "mi_dis_d" = "Please summarize minor disabilities:", @@ -159,6 +160,7 @@ medical["fields"] = fields fields[++fields.len] = MED_FIELD("Gender identity", active2.fields["id_gender"], "id_gender", TRUE) fields[++fields.len] = MED_FIELD("Blood Type", active2.fields["b_type"], "blood_type", FALSE) + fields[++fields.len] = MED_FIELD("Blood Basis", active2.fields["blood_reagent"], "blood_reagent", FALSE) fields[++fields.len] = MED_FIELD("DNA", active2.fields["b_dna"], "b_dna", TRUE) fields[++fields.len] = MED_FIELD("Brain Type", active2.fields["brain_type"], "brain_type", TRUE) fields[++fields.len] = MED_FIELD("Important Notes", active2.fields["notes"], "notes", TRUE) @@ -301,6 +303,7 @@ R.fields["id"] = active1.fields["id"] R.name = "Medical Record #[R.fields["id"]]" R.fields["b_type"] = "Unknown" + R.fields["blood_reagent"] = "Unknown" R.fields["b_dna"] = "Unknown" R.fields["mi_dis"] = "None" R.fields["mi_dis_d"] = "No minor disabilities have been declared." @@ -431,6 +434,7 @@ P.info += {"
\n
Medical Data

\nGender Identity: [active2.fields["id_gender"]]
\nBlood Type: [active2.fields["b_type"]] +
\nBlood Basis: [active2.fields["blood_reagent"]]
\nDNA: [active2.fields["b_dna"]]
\n
\nMinor Disabilities: [active2.fields["mi_dis"]]
\nDetails: [active2.fields["mi_dis_d"]]
\n diff --git a/code/game/objects/items/devices/scanners/health.dm b/code/game/objects/items/devices/scanners/health.dm index 707009a31c1..6d854e201c5 100644 --- a/code/game/objects/items/devices/scanners/health.dm +++ b/code/game/objects/items/devices/scanners/health.dm @@ -304,14 +304,15 @@ var/blood_volume = H.vessel.get_reagent_amount("blood") var/blood_percent = round((blood_volume / H.species.blood_volume)*100) var/blood_type = H.dna.b_type + var/blood_reagent = H.species.blood_reagents if(blood_volume <= H.species.blood_volume*H.species.blood_level_danger) - dat += "Warning: Blood Level CRITICAL: [blood_percent]% [blood_volume]cl. Type: [blood_type]
" + dat += "Warning: Blood Level CRITICAL: [blood_percent]% [blood_volume]cl. Type: [blood_type]. Basis: [blood_reagent].
" else if(blood_volume <= H.species.blood_volume*H.species.blood_level_warning) - dat += "Warning: Blood Level VERY LOW: [blood_percent]% [blood_volume]cl. Type: [blood_type]
" + dat += "Warning: Blood Level VERY LOW: [blood_percent]% [blood_volume]cl. Type: [blood_type]. Basis: [blood_reagent].
" else if(blood_volume <= H.species.blood_volume*H.species.blood_level_safe) - dat += "Warning: Blood Level LOW: [blood_percent]% [blood_volume]cl. Type: [blood_type]
" + dat += "Warning: Blood Level LOW: [blood_percent]% [blood_volume]cl. Type: [blood_type]. Basis: [blood_reagent].
" else - dat += "Blood Level Normal: [blood_percent]% [blood_volume]cl. Type: [blood_type]
" + dat += "Blood Level Normal: [blood_percent]% [blood_volume]cl. Type: [blood_type]. Basis: [blood_reagent].
" dat += "Subject's pulse: [H.get_pulse(GETPULSE_TOOL)] bpm.
" // VORE Edit: Missed a linebreak here. if(istype(H.species, /datum/species/xenochimera)) // VOREStation Edit Start: Visible feedback for medmains on Xenochimera. if(H.stat == DEAD && H.revive_ready == REVIVING_READY && !H.hasnutriment()) diff --git a/code/modules/client/preference_setup/vore/07_traits.dm b/code/modules/client/preference_setup/vore/07_traits.dm index c17e5384098..e89d12f2cc3 100644 --- a/code/modules/client/preference_setup/vore/07_traits.dm +++ b/code/modules/client/preference_setup/vore/07_traits.dm @@ -5,6 +5,8 @@ #define ORGANICS 1 #define SYNTHETICS 2 +var/global/list/valid_bloodreagents = list("iron","copper","phoron","silver","gold","slimejelly") //allowlist-based so people don't make their blood restored by alcohol or something really silly. use reagent IDs! + /datum/preferences var/custom_species // Custom species name, can't be changed due to it having been used in savefiles already. var/custom_base // What to base the custom species on @@ -115,6 +117,7 @@ S["neu_traits"] >> pref.neu_traits S["neg_traits"] >> pref.neg_traits S["blood_color"] >> pref.blood_color + S["blood_reagents"] >> pref.blood_reagents S["traits_cheating"] >> pref.traits_cheating S["max_traits"] >> pref.max_traits @@ -135,6 +138,7 @@ S["neu_traits"] << pref.neu_traits S["neg_traits"] << pref.neg_traits S["blood_color"] << pref.blood_color + S["blood_reagents"] << pref.blood_reagents S["traits_cheating"] << pref.traits_cheating S["max_traits"] << pref.max_traits @@ -154,6 +158,7 @@ if(!pref.neg_traits) pref.neg_traits = list() pref.blood_color = sanitize_hexcolor(pref.blood_color, default="#A10808") + pref.blood_reagents = sanitize_text(pref.blood_reagents, initial(pref.blood_reagents)) if(!pref.traits_cheating) var/datum/species/S = GLOB.all_species[pref.species] @@ -253,6 +258,7 @@ //Any additional non-trait settings can be applied here new_S.blood_color = pref.blood_color + new_S.blood_reagents = pref.blood_reagents if(pref.species == SPECIES_CUSTOM) //Statistics for this would be nice @@ -305,6 +311,8 @@ . += "Blood Color: " //People that want to use a certain species to have that species traits (xenochimera/promethean/spider) should be able to set their own blood color. . += "Set Color" . += "R
" + . += "Blood Reagent: " //Wanna be copper-based? Go ahead. + . += "[pref.blood_reagents]
" . += "
" . += "Custom Say: " @@ -362,6 +370,12 @@ pref.blood_color = "#A10808" return TOPIC_REFRESH + else if(href_list["blood_reagents"]) + var/new_blood_reagents = tgui_input_list(user, "Choose your character's blood restoration reagent:", "Character Preference", valid_bloodreagents) + if(new_blood_reagents && CanUseTopic(user)) + pref.blood_reagents = new_blood_reagents + return TOPIC_REFRESH + else if(href_list["clicked_pos_trait"]) var/datum/trait/trait = text2path(href_list["clicked_pos_trait"]) var/choice = tgui_alert(usr, "Remove [initial(trait.name)] and regain [initial(trait.cost)] points?","Remove Trait",list("Remove","Cancel")) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 64633791ff4..9f2f1dba023 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -44,6 +44,7 @@ var/list/preferences_datums = list() var/bday_announce = FALSE //Public announcement for birthdays var/spawnpoint = "Arrivals Shuttle" //where this character will spawn (0-2). var/b_type = "A+" //blood type (not-chooseable) + var/blood_reagents = "iron" //blood restoration reagents var/backbag = 2 //backpack type var/pdachoice = 1 //PDA type var/h_style = "Bald" //Hair type diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 092185ed88b..448c9c32d58 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -508,7 +508,7 @@ if (R.fields["id"] == E.fields["id"]) if(hasHUD(usr,"medical")) var/list/medical_hud_text = list() - medical_hud_text += "Name: [R.fields["name"]] Blood Type: [R.fields["b_type"]]" + medical_hud_text += "Name: [R.fields["name"]] Blood Type: [R.fields["b_type"]] Blood Basis: [R.fields["blood_reagent"]]" medical_hud_text += "Species: [R.fields["species"]]" medical_hud_text += "DNA: [R.fields["b_dna"]]" medical_hud_text += "Minor Disabilities: [R.fields["mi_dis"]]" diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 47089619ef1..fec724dae20 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -42,6 +42,7 @@ var/virus_immune var/short_sighted // Permanent weldervision. var/blood_name = "blood" // Name for the species' blood. + var/blood_reagents = "iron" // Reagent(s) that restore lost blood. goes by reagent IDs. var/blood_volume = 560 // Initial blood volume. var/bloodloss_rate = 1 // Multiplier for how fast a species bleeds out. Higher = Faster var/blood_level_safe = 0.85 //"Safe" blood level; above this, you're OK diff --git a/code/modules/mob/living/carbon/human/species/station/prometheans.dm b/code/modules/mob/living/carbon/human/species/station/prometheans.dm index 36e0ad9c174..7e5f579592a 100644 --- a/code/modules/mob/living/carbon/human/species/station/prometheans.dm +++ b/code/modules/mob/living/carbon/human/species/station/prometheans.dm @@ -36,6 +36,7 @@ var/datum/species/shapeshifter/promethean/prometheans assisted_langs = list(LANGUAGE_ROOTGLOBAL, LANGUAGE_VOX) // Prometheans are weird, let's just assume they can use basically any language. blood_name = "gelatinous ooze" + blood_reagents = "slimejelly" breath_type = null poison_type = null diff --git a/code/modules/mob/living/carbon/human/species/station/station.dm b/code/modules/mob/living/carbon/human/species/station/station.dm index 3faf631adf4..fc9c607a0dd 100644 --- a/code/modules/mob/living/carbon/human/species/station/station.dm +++ b/code/modules/mob/living/carbon/human/species/station/station.dm @@ -314,6 +314,7 @@ flash_mod = 1.2 chemOD_mod = 0.9 + blood_reagents = "copper" bloodloss_rate = 1.5 ambiguous_genders = TRUE diff --git a/code/modules/mob/living/carbon/human/species/station/station_vr.dm b/code/modules/mob/living/carbon/human/species/station/station_vr.dm index 84b3a61c5e5..79273429b2d 100644 --- a/code/modules/mob/living/carbon/human/species/station/station_vr.dm +++ b/code/modules/mob/living/carbon/human/species/station/station_vr.dm @@ -201,6 +201,7 @@ flesh_color = "#AFA59E" base_color = "#333333" blood_color = "#240bc4" + blood_reagents = "copper" reagent_tag = IS_ZORREN color_mult = 1 diff --git a/code/modules/reagents/reagents/_reagents.dm b/code/modules/reagents/reagents/_reagents.dm index 3fdd9e4f3ae..b5ee4d9d731 100644 --- a/code/modules/reagents/reagents/_reagents.dm +++ b/code/modules/reagents/reagents/_reagents.dm @@ -180,6 +180,8 @@ /datum/reagent/proc/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed) M.bloodstr.add_reagent(id, removed) + if(src.id == M.species.blood_reagents) + M.add_chemical_effect(CE_BLOODRESTORE, 8 * removed) return /datum/reagent/proc/affect_touch(var/mob/living/carbon/M, var/alien, var/removed) diff --git a/code/modules/reagents/reagents/dispenser.dm b/code/modules/reagents/reagents/dispenser.dm index 7b6f49af676..f69d7d451ee 100644 --- a/code/modules/reagents/reagents/dispenser.dm +++ b/code/modules/reagents/reagents/dispenser.dm @@ -79,10 +79,6 @@ taste_description = "pennies" color = "#6E3B08" -/datum/reagent/copper/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed) - if(alien == IS_SKRELL || alien == IS_ZORREN) - M.add_chemical_effect(CE_BLOODRESTORE, 8 * removed) - /datum/reagent/ethanol name = "Ethanol" //Parent class for all alcoholic reagents. id = "ethanol" @@ -246,10 +242,6 @@ reagent_state = SOLID color = "#353535" -/datum/reagent/iron/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed) - if(alien != IS_DIONA && alien != IS_SKRELL && alien != IS_ZORREN) - M.add_chemical_effect(CE_BLOODRESTORE, 8 * removed) - /datum/reagent/lithium name = "Lithium" id = "lithium"