From 35bfba1f6aa45b79a96588a102c127f9662e5ddf Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 5 May 2021 18:15:13 +0300 Subject: [PATCH] Redoes the variable changes into procs --- code/datums/diseases/advance/symptoms/oxygen.dm | 2 +- code/modules/antagonists/cult/cult_structures.dm | 2 +- .../antagonists/eldritch_cult/eldritch_magic.dm | 2 +- code/modules/mob/living/blood.dm | 16 +++++++--------- code/modules/mob/living/carbon/human/species.dm | 2 +- .../carbon/human/species_types/jellypeople.dm | 8 ++++---- code/modules/mob/living/living_defines.dm | 2 +- .../chemistry/reagents/alcohol_reagents.dm | 2 +- .../chemistry/reagents/medicine_reagents.dm | 5 +++-- .../chemistry/reagents/other_reagents.dm | 12 ++++++------ .../research/nanites/nanite_programs/healing.dm | 2 +- .../xenobiology/crossbreeding/consuming.dm | 2 +- code/modules/research/xenobiology/xenobiology.dm | 2 +- code/modules/surgery/organs/lungs.dm | 2 +- .../modules/reagents/chemistry/reagents/SDGF.dm | 6 +++--- 15 files changed, 33 insertions(+), 34 deletions(-) diff --git a/code/datums/diseases/advance/symptoms/oxygen.dm b/code/datums/diseases/advance/symptoms/oxygen.dm index a035697a20..d00761dbf9 100644 --- a/code/datums/diseases/advance/symptoms/oxygen.dm +++ b/code/datums/diseases/advance/symptoms/oxygen.dm @@ -47,7 +47,7 @@ Bonus M.adjustOxyLoss(-7, 0) M.losebreath = max(0, M.losebreath - 4) if(regenerate_blood && M.blood_volume < (BLOOD_VOLUME_NORMAL * M.blood_ratio)) - M.integrating_blood += 1 + M.AddIntegrationBlood(1) else if(prob(base_message_chance)) to_chat(M, "[pick("Your lungs feel great.", "You realize you haven't been breathing.", "You don't feel the need to breathe.")]") diff --git a/code/modules/antagonists/cult/cult_structures.dm b/code/modules/antagonists/cult/cult_structures.dm index 15b4ee13f6..21e19ef739 100644 --- a/code/modules/antagonists/cult/cult_structures.dm +++ b/code/modules/antagonists/cult/cult_structures.dm @@ -222,7 +222,7 @@ if(M.health < M.maxHealth) M.adjustHealth(-3) if(ishuman(L) && L.blood_volume < (BLOOD_VOLUME_NORMAL * L.blood_ratio)) - L.integrating_blood += 1.0 + L.AddIntegrationBlood(1) CHECK_TICK if(last_corrupt <= world.time) var/list/validturfs = list() diff --git a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm index 0dfedfceb4..bb37135155 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm @@ -147,7 +147,7 @@ carbon_target.blood_volume -= 20 if(carbon_user.blood_volume < BLOOD_VOLUME_MAXIMUM) //we dont want to explode after all - carbon_user.integrating_blood += 20 + carbon_user.AddIntegrationBlood(20) return /obj/effect/proc_holder/spell/pointed/blood_siphon/can_target(atom/target, mob/user, silent) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 5e25888851..e655e0c213 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -39,13 +39,13 @@ return if(bodytemperature >= TCRYO && !(HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood. - integrating_blood -- + if(integrating_blood) + integrating_blood -- //Blood regeneration if there is some space if(blood_volume < BLOOD_VOLUME_NORMAL) var/nutrition_ratio = 0 if(integrating_blood) //Do we have blood to normalize in our system? blood_volume ++ - //vomit(blood = TRUE) //Too much, just too much if(!HAS_TRAIT(src, TRAIT_NOHUNGER)) switch(nutrition) if(0 to NUTRITION_LEVEL_STARVING) @@ -62,13 +62,7 @@ nutrition_ratio *= 1.25 adjust_nutrition(-nutrition_ratio * HUNGER_FACTOR) blood_volume = min(BLOOD_VOLUME_NORMAL, blood_volume + 0.5 * nutrition_ratio) - else - if(integrating_blood) - integrating_blood -- - if(integrating_blood > BLOOD_VOLUME_NORMAL) //Let's not allow too much - integrating_blood = BLOOD_VOLUME_NORMAL - if(integrating_blood > blood_volume) - integrating_blood = BLOOD_VOLUME_NORMAL - + //Effects of bloodloss var/word = pick("dizzy","woozy","faint") var/blood_effect_volume = blood_volume + integrating_blood @@ -386,3 +380,7 @@ if(ishuman(src)) var/mob/living/carbon/human/H = src H.handle_blood() + +/mob/living/proc/AddIntegrationBlood(value) + if(blood_volume + integrating_blood < BLOOD_VOLUME_NORMAL) + integrating_blood += value diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 7e47efdcad..41b04ca0bc 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1365,7 +1365,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) /datum/species/proc/handle_chemicals(datum/reagent/chem, mob/living/carbon/human/H) if(chem.type == exotic_blood && !istype(exotic_blood, /datum/reagent/blood)) - H.integrating_blood += round(chem.volume, 0.1) + H.AddIntegrationBlood(round(chem.volume, 0.1)) H.reagents.del_reagent(chem.type) return TRUE return FALSE diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index 345bc5a19d..772e128d67 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -59,13 +59,13 @@ if(H.stat == DEAD || HAS_TRAIT(H, TRAIT_NOMARROW)) //can't farm slime jelly from a dead slime/jelly person indefinitely, and no regeneration for bloodsuckers return if(!H.blood_volume) - H.integrating_blood += 5 + H.AddIntegrationBlood(5) H.adjustBruteLoss(5) to_chat(H, "You feel empty!") if(H.blood_volume < (BLOOD_VOLUME_NORMAL * H.blood_ratio)) if(H.nutrition >= NUTRITION_LEVEL_STARVING) - H.integrating_blood += 3 + H.AddIntegrationBlood(3) H.nutrition -= 2.5 if(H.blood_volume < (BLOOD_VOLUME_OKAY*H.blood_ratio)) if(prob(5)) @@ -85,7 +85,7 @@ consumed_limb.drop_limb() to_chat(H, "Your [consumed_limb] is drawn back into your body, unable to maintain its shape!") qdel(consumed_limb) - H.integrating_blood += 20 + H.AddIntegrationBlood(20) ////////////////////////////////////////////////////////SLIMEPEOPLE/////////////////////////////////////////////////////////////////// @@ -154,7 +154,7 @@ if(prob(5)) to_chat(H, "You feel very bloated!") else if(H.nutrition >= NUTRITION_LEVEL_WELL_FED) - H.integrating_blood += 3 + H.AddIntegrationBlood(3) H.nutrition -= 2.5 ..() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index d743d2baea..d45d662de3 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -109,7 +109,7 @@ var/stun_absorption = null //converted to a list of stun absorption sources this mob has when one is added var/blood_volume = 0 //how much blood the mob has - var/integrating_blood = 0 //this is the variable you want to affect if you want to give the mob blood, this will slowly turn into normal blood, preventing some cheesyness + var/integrating_blood = 0 //this is the variable you want to affect if you want to give the mob blood, this will slowly turn into normal blood, preventing some cheesyness, use AddIntegrationBlood() instead of modifying directly var/blood_ratio = 1 //How much blood the mob needs, in terms of ratio (i.e 1.2 will require BLOOD_VOLUME_NORMAL of 672) DO NOT GO ABOVE 3.55 Well, actually you can but, then they can't get enough blood. var/obj/effect/proc_holder/ranged_ability //Any ranged ability the mob has, as a click override diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 3725445023..a6bf499bc6 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -574,7 +574,7 @@ All effects don't start immediately, but rather get worse over time; the rate is if(AmBloodsucker(C)) disgust_bloodsucker(FALSE, 1) //Bloodsuckers get SOME blood from it, for style reasons. if(C.blood_volume < (BLOOD_VOLUME_NORMAL*C.blood_ratio)) - C.integrating_blood += 3 //Bloody Mary quickly restores blood loss. + C.AddIntegrationBlood(3) //Bloody Mary quickly restores blood loss. ..() /datum/reagent/consumable/ethanol/brave_bull diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 084c81f7d3..e7b42c694f 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -409,6 +409,7 @@ last_added = 0 if(M.blood_volume < maximum_reachable) //Can only up to double your effective blood level. last_added = volume * 5 + M.AddIntegrationBlood(last_added) if(prob(33)) M.adjustBruteLoss(-0.5*REM, 0) M.adjustFireLoss(-0.5*REM, 0) @@ -1271,7 +1272,7 @@ M.adjustCloneLoss(-3*REM, FALSE) M.adjustStaminaLoss(-25*REM,FALSE) if(M.blood_volume < (BLOOD_VOLUME_NORMAL*M.blood_ratio)) - M.integrating_blood += 40 // blood fall out man bad + M.AddIntegrationBlood(40) // blood fall out man bad ..() . = 1 @@ -1292,7 +1293,7 @@ M.adjustCloneLoss(-1.25*REM, FALSE) M.adjustStaminaLoss(-4*REM,FALSE) if(M.blood_volume < (BLOOD_VOLUME_NORMAL*M.blood_ratio)) - M.integrating_blood += 3 + M.AddIntegrationBlood(3) ..() . = 1 diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 4bd66d8982..4f6550dc86 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -48,7 +48,7 @@ var/mob/living/carbon/C = L var/blood_id = C.get_blood_id() if((HAS_TRAIT(C, TRAIT_NOMARROW) || blood_id == /datum/reagent/blood || blood_id == /datum/reagent/blood/jellyblood) && (method == INJECT || (method == INGEST && C.dna && C.dna.species && (DRINKSBLOOD in C.dna.species.species_traits)))) - C.integrating_blood += round(reac_volume, 0.1) + C.AddIntegrationBlood(round(reac_volume, 0.1)) // we don't care about bloodtype here, we're just refilling the mob if(reac_volume >= 10 && istype(L) && method != INJECT) @@ -253,7 +253,7 @@ /datum/reagent/water/on_mob_life(mob/living/carbon/M) . = ..() if(M.blood_volume) - M.integrating_blood += 0.1 // water is good for you! + M.AddIntegrationBlood(0.1) // water is good for you! /* * Water reaction to turf @@ -368,7 +368,7 @@ /datum/reagent/water/holywater/on_mob_life(mob/living/carbon/M) if(M.blood_volume) - M.integrating_blood += 0.1 // water is good for you! + M.AddIntegrationBlood(0.1) // water is good for you! if(!data) data = list("misc" = 1) data["misc"]++ @@ -454,7 +454,7 @@ M.adjustBruteLoss(-2, FALSE) M.adjustFireLoss(-2, FALSE) if(ishuman(M) && M.blood_volume < (BLOOD_VOLUME_NORMAL*M.blood_ratio)) - M.integrating_blood += 3 + M.AddIntegrationBlood(3) else // Will deal about 90 damage when 50 units are thrown M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3, 150) M.adjustToxLoss(2, FALSE) @@ -1144,7 +1144,7 @@ if((HAS_TRAIT(C, TRAIT_NOMARROW))) return if(C.blood_volume < (BLOOD_VOLUME_NORMAL*C.blood_ratio)) - C.integrating_blood += 0.25 + C.AddIntegrationBlood(0.25) ..() /datum/reagent/iron/reaction_mob(mob/living/M, method=TOUCH, reac_volume) @@ -2550,7 +2550,7 @@ M.adjustBruteLoss(-3, FALSE) M.adjustFireLoss(-3, FALSE) if(ishuman(M) && M.blood_volume < BLOOD_VOLUME_NORMAL) - M.integrating_blood += 3 + M.AddIntegrationBlood(3) else M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3, 150) M.adjustToxLoss(2, FALSE) diff --git a/code/modules/research/nanites/nanite_programs/healing.dm b/code/modules/research/nanites/nanite_programs/healing.dm index 46d7cb3501..bb36474565 100644 --- a/code/modules/research/nanites/nanite_programs/healing.dm +++ b/code/modules/research/nanites/nanite_programs/healing.dm @@ -107,7 +107,7 @@ /datum/nanite_program/blood_restoring/active_effect() if(iscarbon(host_mob)) var/mob/living/carbon/C = host_mob - C.integrating_blood += 2 + C.AddIntegrationBlood(2) /datum/nanite_program/repairing name = "Mechanical Repair" diff --git a/code/modules/research/xenobiology/crossbreeding/consuming.dm b/code/modules/research/xenobiology/crossbreeding/consuming.dm index c999a5de8e..26e2a63634 100644 --- a/code/modules/research/xenobiology/crossbreeding/consuming.dm +++ b/code/modules/research/xenobiology/crossbreeding/consuming.dm @@ -322,7 +322,7 @@ Consuming extracts: playsound(get_turf(M), 'sound/effects/splat.ogg', 10, 1) if(iscarbon(M)) var/mob/living/carbon/C = M - C.integrating_blood += 25 //Half a vampire drain. + C.AddIntegrationBlood(25) //Half a vampire drain. /obj/item/slimecross/consuming/green colour = "green" diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 1195f7e766..2340946c46 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -187,7 +187,7 @@ switch(activation_type) if(SLIME_ACTIVATE_MINOR) user.adjust_nutrition(50) - user.integrating_blood += 50 + user.AddIntegrationBlood(50) to_chat(user, "You activate [src], and your body is refilled with fresh slime jelly!") return 150 diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 7768b2c490..d40c7984f2 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -605,7 +605,7 @@ . = ..() if (breath) var/plasma_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/plasma)) - owner.integrating_blood += (0.2 * plasma_pp) // 10/s when breathing literally nothing but plasma, which will suffocate you. + owner.AddIntegrationBlood(0.2 * plasma_pp) // 10/s when breathing literally nothing but plasma, which will suffocate you. /obj/item/organ/lungs/yamerol name = "Yamerol lungs" diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm index 6b6c43b36f..be590ef4c3 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -226,7 +226,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING M.adjustCloneLoss(-10, 0) //I don't want to make Rezadone obsolete. M.adjustBruteLoss(-25, 0)// Note that this takes a long time to apply and makes you fat and useless when it's in you, I don't think this small burst of healing will be useful considering how long it takes to get there. M.adjustFireLoss(-25, 0) - M.integrating_blood += 250 + M.AddIntegrationBlood(250) M.heal_bodypart_damage(1,1) M.action_cooldown_mod = 1 if (M.nutrition < 1500) @@ -236,7 +236,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING to_chat(M, "the cells fail to hold enough mass to generate a clone, instead diffusing into your system.") M.adjustBruteLoss(-10, 0) M.adjustFireLoss(-10, 0) - M.integrating_blood += 100 + M.AddIntegrationBlood(100) M.action_cooldown_mod = 1 if (M.nutrition < 1500) M.adjust_nutrition(500) @@ -309,7 +309,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING /datum/reagent/fermi/SDGFheal/on_mob_life(mob/living/carbon/M)//Used to heal the clone after splitting, the clone spawns damaged. (i.e. insentivies players to make more than required, so their clone doesn't have to be treated) if(M.blood_volume < (BLOOD_VOLUME_NORMAL*M.blood_ratio)) - M.integrating_blood += 10 + M.AddIntegrationBlood(10) M.adjustCloneLoss(-2, 0) M.setOrganLoss(ORGAN_SLOT_BRAIN, -1) M.adjust_nutrition(10)