From a447482126a0c7986abc95536e8e9abb9b5ce4fc Mon Sep 17 00:00:00 2001 From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Date: Fri, 22 Mar 2024 02:04:34 -0400 Subject: [PATCH] Brainmed patch 3.14159 (#889) * pain redux * pain spike reduced by painkillers * slowdown stuffs * FUCK * oops * rename multiplicative slowdown fuck you * grammar * experimental pain changes * experimental pain shit i apparently for got to commit * blood refactor * tweak epinephrine * brainmed 3 * macros * whoops * fix germs * shock changes * fix emote stuffs * huh? --- code/__DEFINES/combat.dm | 3 + code/__DEFINES/logging.dm | 7 +- code/__DEFINES/mobs.dm | 6 +- code/__DEFINES/pain.dm | 23 +++- code/__DEFINES/wounds.dm | 2 +- code/__HELPERS/pronouns.dm | 26 ++++ .../ai/basic_mobs/base_basic_controller.dm | 2 +- code/datums/ai/dog/dog_controller.dm | 2 +- code/datums/ai/monkey/monkey_controller.dm | 4 +- code/datums/ai/oldhostile/hostile_tameable.dm | 2 +- code/datums/brain_damage/severe.dm | 5 +- code/datums/emotes.dm | 7 +- code/datums/status_effects/buffs.dm | 2 +- code/datums/status_effects/debuffs/debuffs.dm | 2 +- code/datums/status_effects/wound_effects.dm | 4 +- code/game/atoms_movable.dm | 2 +- code/game/machinery/pipe/construction.dm | 2 +- code/game/objects/buckling.dm | 2 +- code/game/objects/items/defib.dm | 6 +- code/game/say.dm | 8 +- .../actionspeed/_actionspeed_modifier.dm | 14 +-- .../actionspeed/modifiers/addiction.dm | 2 +- .../actionspeed/modifiers/status_effects.dm | 8 +- .../modules/admin/verbs/individual_logging.dm | 2 + .../abductor/equipment/glands/heal.dm | 7 +- code/modules/antagonists/cult/blood_magic.dm | 3 +- code/modules/antagonists/cult/cult_items.dm | 6 +- .../sacrifice_knowledge/sacrifice_buff.dm | 3 +- code/modules/mob/living/basic/basic.dm | 2 +- code/modules/mob/living/blood.dm | 34 +++-- code/modules/mob/living/brain/brain_item.dm | 17 ++- code/modules/mob/living/carbon/carbon.dm | 8 +- .../mob/living/carbon/carbon_defense.dm | 5 +- .../mob/living/carbon/carbon_movement.dm | 2 +- .../modules/mob/living/carbon/damage_procs.dm | 8 +- code/modules/mob/living/carbon/human/death.dm | 7 +- code/modules/mob/living/carbon/human/human.dm | 51 +++----- .../mob/living/carbon/human/human_movement.dm | 7 +- .../mob/living/carbon/human/species.dm | 4 +- .../carbon/human/species_types/jellypeople.dm | 3 +- .../carbon/human/species_types/vampire.dm | 4 +- code/modules/mob/living/carbon/life.dm | 9 +- code/modules/mob/living/carbon/pain.dm | 118 ++++++++++++------ code/modules/mob/living/damage_procs.dm | 5 +- code/modules/mob/living/living.dm | 4 +- code/modules/mob/living/living_movement.dm | 4 +- .../mob/living/simple_animal/simple_animal.dm | 2 +- .../mob/living/simple_animal/slime/life.dm | 2 +- .../mob/living/simple_animal/slime/slime.dm | 4 +- code/modules/mob/mob.dm | 21 ++-- code/modules/mob/mob_defines.dm | 2 +- code/modules/mob/mob_helpers.dm | 2 + code/modules/mob/mob_movement.dm | 2 +- code/modules/movespeed/_movespeed_modifier.dm | 33 +++-- .../modules/movespeed/modifiers/components.dm | 12 +- code/modules/movespeed/modifiers/drugs.dm | 2 +- code/modules/movespeed/modifiers/innate.dm | 6 +- code/modules/movespeed/modifiers/items.dm | 10 +- code/modules/movespeed/modifiers/misc.dm | 2 +- code/modules/movespeed/modifiers/mobs.dm | 57 ++++----- code/modules/movespeed/modifiers/reagent.dm | 36 +++--- .../movespeed/modifiers/status_effects.dm | 14 +-- code/modules/reagents/chemistry/reagents.dm | 4 +- .../chemistry/reagents/alcohol_reagents.dm | 1 + .../chemistry/reagents/dispenser_reagents.dm | 2 +- .../chemistry/reagents/medicine_reagents.dm | 38 +++--- .../chemistry/reagents/other_reagents.dm | 9 +- .../chemistry/reagents/toxin_reagents.dm | 1 + .../crossbreeding/_status_effects.dm | 4 +- .../spell_types/shapeshift/_shapeshift.dm | 10 +- code/modules/surgery/bodyparts/_bodyparts.dm | 35 ++++-- .../surgery/bodyparts/germs_bodypart.dm | 34 ++--- code/modules/surgery/bodyparts/injuries.dm | 4 +- code/modules/surgery/bodyparts/pain.dm | 14 +-- .../surgery/bodyparts/wounds/_wounds.dm | 1 + .../surgery/bodyparts/wounds/bruises.dm | 1 + .../modules/surgery/bodyparts/wounds/burns.dm | 1 + .../surgery/bodyparts/wounds/create_wound.dm | 4 +- code/modules/surgery/bodyparts/wounds/cuts.dm | 1 + .../surgery/bodyparts/wounds/punctures.dm | 1 + code/modules/surgery/organs/augments_chest.dm | 7 +- code/modules/surgery/organs/heart.dm | 44 +++++-- code/modules/surgery/organs/liver.dm | 2 +- .../surgery/organs/stomach/_stomach.dm | 2 +- .../organs/stomach/stomach_ethereal.dm | 2 +- 85 files changed, 522 insertions(+), 361 deletions(-) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index 933c40561483..fa69a9e5b9b7 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -228,6 +228,9 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list( #define BODY_ZONE_PRECISE_L_FOOT "l_foot" #define BODY_ZONE_PRECISE_R_FOOT "r_foot" +/// The max damage capacity of the average human. Used for balance purposes. +#define CARBON_BODYPART_HEALTH_SUM (/obj/item/bodypart/head::max_damage + /obj/item/bodypart/chest::max_damage + /obj/item/bodypart/leg::max_damage + /obj/item/bodypart/arm::max_damage) + //We will round to this value in damage calculations. #define DAMAGE_PRECISION 0.1 diff --git a/code/__DEFINES/logging.dm b/code/__DEFINES/logging.dm index 7eac66fcb824..cd5aee0ebec9 100644 --- a/code/__DEFINES/logging.dm +++ b/code/__DEFINES/logging.dm @@ -40,6 +40,7 @@ #define LOG_VICTIM (1 << 20) #define LOG_RADIO_EMOTE (1 << 21) #define LOG_MECHCOMP (1 <<22) +#define LOG_HEALTH (1<< 23) //Individual logging panel pages #define INDIVIDUAL_ATTACK_LOG (LOG_ATTACK | LOG_VICTIM) @@ -48,7 +49,11 @@ #define INDIVIDUAL_COMMS_LOG (LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS) #define INDIVIDUAL_OOC_LOG (LOG_OOC | LOG_ADMIN) #define INDIVIDUAL_OWNERSHIP_LOG (LOG_OWNERSHIP) -#define INDIVIDUAL_SHOW_ALL_LOG (LOG_ATTACK | LOG_SAY | LOG_WHISPER | LOG_EMOTE | LOG_RADIO_EMOTE | LOG_DSAY | LOG_PDA | LOG_CHAT | LOG_COMMENT | LOG_TELECOMMS | LOG_OOC | LOG_ADMIN | LOG_OWNERSHIP | LOG_GAME | LOG_ADMIN_PRIVATE | LOG_ASAY | LOG_MECHA | LOG_VIRUS | LOG_CLONING | LOG_SHUTTLE | LOG_ECON | LOG_VICTIM) +#define INDIVIDUAL_HEALTH_LOG (LOG_HEALTH) +#define INDIVIDUAL_SHOW_ALL_LOG (ALL) #define LOGSRC_CKEY "Ckey" #define LOGSRC_MOB "Mob" + + +#define log_health(mob, message) mob?.log_message(message, LOG_HEALTH, COLOR_GREEN, FALSE) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 26a07455a869..b848988b99cd 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -13,7 +13,8 @@ #define MOVE_INTENT_SPRINT "sprint" //Blood levels -#define BLOOD_VOLUME_MAX_LETHAL 2150 +#define BLOOD_VOLUME_ABSOLUTE_MAX 2150 +#define BLOOD_VOLUME_MAX_LETHAL BLOOD_VOLUME_ABSOLUTE_MAX #define BLOOD_VOLUME_EXCESS 2100 #define BLOOD_VOLUME_MAXIMUM 2000 #define BLOOD_VOLUME_SLIME_SPLIT 1120 @@ -512,7 +513,8 @@ // /obj/item/bodypart on_mob_life() retval flag #define BODYPART_LIFE_UPDATE_HEALTH (1<<0) -#define BODYPART_LIFE_UPDATE_DAMAGE_OVERLAYS (1<<1) +#define BODYPART_LIFE_UPDATE_HEALTH_HUD (1<<1) +#define BODYPART_LIFE_UPDATE_DAMAGE_OVERLAYS (1<<2) #define MAX_REVIVE_FIRE_DAMAGE 180 #define MAX_REVIVE_BRUTE_DAMAGE 180 diff --git a/code/__DEFINES/pain.dm b/code/__DEFINES/pain.dm index cfef71fdaee1..f4493376ec2f 100644 --- a/code/__DEFINES/pain.dm +++ b/code/__DEFINES/pain.dm @@ -16,6 +16,23 @@ #define SHOCK_TIER_6 120 #define SHOCK_TIER_7 150 -#define PAIN_AMT_LOW 10 -#define PAIN_AMT_MEDIUM 40 -#define PAIN_AMT_AGONIZING 70 +/// The amount of shock required for someone to be elligible for shock-induced fibrillation +#define SHOCK_AMT_FOR_FIBRILLATION 120 + +/// The amount of pain where the mob is rendered unconscious +#define PAIN_AMT_PASSOUT (200) + +/// The amount of pain where movement slowdown beings +#define PAIN_AMT_BEGIN_SLOWDOWN (PAIN_AMT_PASSOUT * 0.075) +#define PAIN_MAX_SLOWDOWN 5 + +#define PAIN_AMT_LOW (PAIN_AMT_PASSOUT * 0.05) +#define PAIN_AMT_MEDIUM (PAIN_AMT_PASSOUT * 0.35) +#define PAIN_AMT_AGONIZING (PAIN_AMT_PASSOUT * 0.85) + +/// max_damage * this value is the amount of pain constantly applied when the limb bone is broken +#define BROKEN_BONE_PAIN_FACTOR 0.1 +/// max_damage * this value is the amount of pain constantly applied when the limb is dislocated +#define DISLOCATED_LIMB_PAIN_FACTOR 0.05 +/// The amount of pain applied immediately when a bone breaks +#define BONE_BREAK_APPLICATION_PAIN 60 diff --git a/code/__DEFINES/wounds.dm b/code/__DEFINES/wounds.dm index 71d49a41c594..cba31770803f 100644 --- a/code/__DEFINES/wounds.dm +++ b/code/__DEFINES/wounds.dm @@ -38,7 +38,7 @@ #define WOUND_DETERMINATION_BLEED_MOD 0.85 /// How often can we annoy the player about their bleeding? This duration is extended if it's not serious bleeding -#define BLEEDING_MESSAGE_BASE_CD 10 SECONDS +#define BLEEDING_MESSAGE_BASE_CD (10 SECONDS) ///The percentage of damage at which a bodypart can start to be dismembered. #define LIMB_DISMEMBERMENT_PERCENT 0.9 diff --git a/code/__HELPERS/pronouns.dm b/code/__HELPERS/pronouns.dm index 6328591471a5..150a3e83c0a7 100644 --- a/code/__HELPERS/pronouns.dm +++ b/code/__HELPERS/pronouns.dm @@ -32,6 +32,9 @@ /datum/proc/p_do(temp_gender) . = "does" +/datum/proc/p_dont(temp_gender) + . = "doesnt" + /datum/proc/p_theyve(capitalized, temp_gender) . = p_they(capitalized, temp_gender) + "'" + copytext_char(p_have(temp_gender), 3) @@ -136,6 +139,14 @@ if(temp_gender == PLURAL || temp_gender == NEUTER) . = "do" +/client/p_dont(temp_gender) + if(!temp_gender) + temp_gender = gender + + . = "doesn't" + if(temp_gender == PLURAL || temp_gender == NEUTER) + . = "don't" + /client/p_s(temp_gender) if(!temp_gender) temp_gender = gender @@ -233,6 +244,14 @@ if(temp_gender == PLURAL) . = "do" +/mob/p_dont(temp_gender) + if(!temp_gender) + temp_gender = gender + + . = "doesn't" + if(temp_gender == PLURAL || temp_gender == NEUTER) + . = "don't" + /mob/p_s(temp_gender) if(!temp_gender) temp_gender = gender @@ -302,6 +321,13 @@ temp_gender = PLURAL return ..() +/mob/living/carbon/human/p_dont(temp_gender) + var/obscured = check_obscured_slots() + var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE)) + if((obscured & ITEM_SLOT_ICLOTHING) && skipface) + temp_gender = PLURAL + return ..() + /mob/living/carbon/human/p_s(temp_gender) var/obscured = check_obscured_slots() var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE)) diff --git a/code/datums/ai/basic_mobs/base_basic_controller.dm b/code/datums/ai/basic_mobs/base_basic_controller.dm index ad50572c39f7..4a1a2eca4c48 100644 --- a/code/datums/ai/basic_mobs/base_basic_controller.dm +++ b/code/datums/ai/basic_mobs/base_basic_controller.dm @@ -23,4 +23,4 @@ /datum/ai_controller/basic_controller/proc/update_speed(mob/living/basic/basic_mob) SIGNAL_HANDLER - movement_delay = basic_mob.cached_multiplicative_slowdown + movement_delay = basic_mob.movement_delay diff --git a/code/datums/ai/dog/dog_controller.dm b/code/datums/ai/dog/dog_controller.dm index 6ddaa5f2467e..1f33fa647b82 100644 --- a/code/datums/ai/dog/dog_controller.dm +++ b/code/datums/ai/dog/dog_controller.dm @@ -20,7 +20,7 @@ /datum/ai_controller/dog/process(delta_time) if(ismob(pawn)) var/mob/living/living_pawn = pawn - movement_delay = living_pawn.cached_multiplicative_slowdown + movement_delay = living_pawn.movement_delay return ..() /datum/ai_controller/dog/TryPossessPawn(atom/new_pawn) diff --git a/code/datums/ai/monkey/monkey_controller.dm b/code/datums/ai/monkey/monkey_controller.dm index 08a77309ca3b..d3494bc23c9f 100644 --- a/code/datums/ai/monkey/monkey_controller.dm +++ b/code/datums/ai/monkey/monkey_controller.dm @@ -60,7 +60,7 @@ have ways of interacting with a specific mob and control it. RegisterSignal(new_pawn, COMSIG_CARBON_CUFF_ATTEMPTED, PROC_REF(on_attempt_cuff)) RegisterSignal(new_pawn, COMSIG_MOB_MOVESPEED_UPDATED, PROC_REF(update_movespeed)) - movement_delay = living_pawn.cached_multiplicative_slowdown + movement_delay = living_pawn.movement_delay return ..() //Run parent at end /datum/ai_controller/monkey/UnpossessPawn(destroy) @@ -215,7 +215,7 @@ have ways of interacting with a specific mob and control it. /datum/ai_controller/monkey/proc/update_movespeed(mob/living/pawn) SIGNAL_HANDLER - movement_delay = pawn.cached_multiplicative_slowdown + movement_delay = pawn.movement_delay /datum/ai_controller/monkey/proc/target_del(target) SIGNAL_HANDLER diff --git a/code/datums/ai/oldhostile/hostile_tameable.dm b/code/datums/ai/oldhostile/hostile_tameable.dm index 8e0daf6a8a17..16c7f52f60ed 100644 --- a/code/datums/ai/oldhostile/hostile_tameable.dm +++ b/code/datums/ai/oldhostile/hostile_tameable.dm @@ -19,7 +19,7 @@ /datum/ai_controller/hostile_friend/process(delta_time) if(isliving(pawn)) var/mob/living/living_pawn = pawn - movement_delay = living_pawn.cached_multiplicative_slowdown + movement_delay = living_pawn.movement_delay return ..() /datum/ai_controller/hostile_friend/TryPossessPawn(atom/new_pawn) diff --git a/code/datums/brain_damage/severe.dm b/code/datums/brain_damage/severe.dm index 9feeda86afd6..e2d7ad3d736d 100644 --- a/code/datums/brain_damage/severe.dm +++ b/code/datums/brain_damage/severe.dm @@ -211,8 +211,9 @@ if(high_stress) if(prob(15) && ishuman(owner)) var/mob/living/carbon/human/H = owner - H.set_heartattack(TRUE) - to_chat(H, span_userdanger("You feel a stabbing pain in your heart!")) + if(H.set_heartattack(TRUE)) + log_health(H, "Heart stopped due to monophobia quirk.") + to_chat(H, span_userdanger("You feel a stabbing pain in your heart!")) else to_chat(owner, span_userdanger("You feel your heart lurching in your chest...")) owner.adjustOxyLoss(8) diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index 9df4b60ccb88..68b6629cb73a 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -317,14 +317,15 @@ log_message(text, LOG_EMOTE) - var/ghost_text = "[src] [text]" + var/ghost_text = "[src] [text]" var/origin_turf = get_turf(src) if(client) - for(var/mob/ghost as anything in GLOB.dead_mob_list) + for(var/mob/ghost as anything in GLOB.dead_mob_list - viewers(origin_turf)) if(!ghost.client || isnewplayer(ghost)) continue - if(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT && !(ghost in viewers(origin_turf, null))) + + if(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT) ghost.show_message("[FOLLOW_LINK(ghost, src)] [ghost_text]") visible_message(text, visible_message_flags = EMOTE_MESSAGE) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 7bc87e0bda40..cdf1adde3fed 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -508,7 +508,7 @@ owner.remove_movespeed_modifier(/datum/movespeed_modifier/status_speed_boost, update = TRUE) /datum/movespeed_modifier/status_speed_boost - multiplicative_slowdown = -1 + slowdown = -1 ///this buff provides a max health buff and a heal. /datum/status_effect/limited_buff/health_buff diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index 4c043f23a507..15faa5b1372b 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -1220,7 +1220,7 @@ owner.remove_movespeed_modifier(/datum/movespeed_modifier/freezing_blast, update = TRUE) /datum/movespeed_modifier/freezing_blast - multiplicative_slowdown = 1 + slowdown = 1 /datum/status_effect/discoordinated id = "discoordinated" diff --git a/code/datums/status_effects/wound_effects.dm b/code/datums/status_effects/wound_effects.dm index eeda65faf293..73d3e2c8b355 100644 --- a/code/datums/status_effects/wound_effects.dm +++ b/code/datums/status_effects/wound_effects.dm @@ -248,12 +248,12 @@ if(speed_right == 1) C.remove_actionspeed_modifier(/datum/actionspeed_modifier/broken_arm) else - C.add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/broken_arm, multiplicative_slowdown = speed_right) + C.add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/broken_arm, slowdown = speed_right) else if(hand == BODY_ZONE_L_ARM) if(speed_left == 1) C.remove_actionspeed_modifier(/datum/actionspeed_modifier/broken_arm) else - C.add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/broken_arm, multiplicative_slowdown = speed_left) + C.add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/broken_arm, slowdown = speed_left) /datum/status_effect/arm_slowdown/proc/on_hand_swap() SIGNAL_HANDLER diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index df7c6a25129b..85556d8a2623 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -995,7 +995,7 @@ //They are moving! Wouldn't it be cool if we calculated their momentum and added it to the throw? if (thrower && thrower.last_move && thrower.client && thrower.client.move_delay >= world.time + world.tick_lag*2) - var/user_momentum = thrower.cached_multiplicative_slowdown + var/user_momentum = thrower.movement_delay if (!user_momentum) //no movement_delay, this means they move once per byond tick, lets calculate from that instead. user_momentum = world.tick_lag diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 179621248747..7a3780c09ddb 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -295,7 +295,7 @@ Buildable meters if(prob(20)) C.spew_organ() sleep(5) - C.blood_volume = 0 + C.setBloodVolume(0) return(OXYLOSS|BRUTELOSS) /obj/item/pipe/examine(mob/user) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 3a001565e492..f26f6eff3581 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -158,7 +158,7 @@ buckled_mob.set_buckled(null) buckled_mob.set_anchored(initial(buckled_mob.anchored)) buckled_mob.clear_alert(ALERT_BUCKLED) - buckled_mob.set_glide_size(DELAY_TO_GLIDE_SIZE(buckled_mob.total_multiplicative_slowdown())) + buckled_mob.set_glide_size(DELAY_TO_GLIDE_SIZE(buckled_mob.total_slowdown())) buckled_mobs -= buckled_mob if(anchored) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 15a5c9ab03c4..b4ac01dbe0b3 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -552,6 +552,7 @@ H.emote("scream") shock_pulling(45, H) if(H.set_heartattack(TRUE)) + log_health(H, "Heart stopped due to offensive defibrillator use.") if(!H.stat) H.visible_message(span_warning("[H] thrashes wildly, clutching at [H.p_their()] chest!"), span_userdanger("You feel a horrible agony in your chest!")) @@ -619,7 +620,10 @@ return user.audible_message(span_notice("[req_defib ? "[defib]" : "[src]"] pings: Resuscitation successful.")) - H.resuscitate() + + if(H.resuscitate()) + log_health(H, "Resuscitated due to defibrillator shock.") + H.AdjustSleeping(-60 SECONDS) //WAKEY WAKEY YOUR HEART IS SHOCKY /obj/item/shockpaddles/cyborg diff --git a/code/game/say.dm b/code/game/say.dm index d853e8e04e89..0baf2900bbc3 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -72,7 +72,13 @@ GLOBAL_LIST_INIT(freqtospan, list( var/alt_name = speaker.get_alt_name() //Basic span - var/wrapper_span = "" + var/wrapper_span = "" + if(radio_freq) + wrapper_span = "" + + else if(message_mods[MODE_CUSTOM_SAY_ERASE_INPUT]) + wrapper_span = "" + //Radio freq/name display var/freqpart = radio_freq ? "\[[get_radio_name(radio_freq)]\] " : "" //Speaker name diff --git a/code/modules/actionspeed/_actionspeed_modifier.dm b/code/modules/actionspeed/_actionspeed_modifier.dm index 71bc966acf4d..3d1de5182453 100644 --- a/code/modules/actionspeed/_actionspeed_modifier.dm +++ b/code/modules/actionspeed/_actionspeed_modifier.dm @@ -32,7 +32,7 @@ can next move var/flags = NONE /// Multiplicative slowdown - var/multiplicative_slowdown = 0 + var/slowdown = 0 /// Other modification datums this conflicts with. var/conflicts_with @@ -99,7 +99,7 @@ GLOBAL_LIST_EMPTY(actionspeed_modification_cache) 4. If any of the rest of the args are not null (see: multiplicative slowdown), modify the datum 5. Update if necessary */ -/mob/proc/add_or_update_variable_actionspeed_modifier(datum/actionspeed_modifier/type_id_datum, update = TRUE, multiplicative_slowdown) +/mob/proc/add_or_update_variable_actionspeed_modifier(datum/actionspeed_modifier/type_id_datum, update = TRUE, slowdown) var/modified = FALSE var/inject = FALSE var/datum/actionspeed_modifier/final @@ -122,8 +122,8 @@ GLOBAL_LIST_EMPTY(actionspeed_modification_cache) if(!LAZYACCESS(actionspeed_modification, final.id)) inject = TRUE modified = TRUE - if(!isnull(multiplicative_slowdown)) - final.multiplicative_slowdown = multiplicative_slowdown + if(!isnull(slowdown)) + final.slowdown = slowdown modified = TRUE if(inject) add_actionspeed_modifier(final, FALSE) @@ -149,7 +149,7 @@ GLOBAL_LIST_EMPTY(actionspeed_modification_cache) for(var/key in get_actionspeed_modifiers()) var/datum/actionspeed_modifier/M = actionspeed_modification[key] var/conflict = M.conflicts_with - var/amt = M.multiplicative_slowdown + var/amt = M.slowdown if(conflict) // Conflicting modifiers prioritize the larger slowdown or the larger speedup // We purposefuly don't handle mixing speedups and slowdowns on the same id @@ -162,7 +162,7 @@ GLOBAL_LIST_EMPTY(actionspeed_modification_cache) ///Adds a default action speed /mob/proc/initialize_actionspeed() - add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/base, multiplicative_slowdown = 1) + add_or_update_variable_actionspeed_modifier(/datum/actionspeed_modifier/base, slowdown = 1) /// Get the action speed modifiers list of the mob /mob/proc/get_actionspeed_modifiers() @@ -172,4 +172,4 @@ GLOBAL_LIST_EMPTY(actionspeed_modification_cache) /// Checks if a action speed modifier is valid and not missing any data /proc/actionspeed_data_null_check(datum/actionspeed_modifier/M) //Determines if a data list is not meaningful and should be discarded. - . = !(M.multiplicative_slowdown) + . = !(M.slowdown) diff --git a/code/modules/actionspeed/modifiers/addiction.dm b/code/modules/actionspeed/modifiers/addiction.dm index a37693329a05..dfcc8796772c 100644 --- a/code/modules/actionspeed/modifiers/addiction.dm +++ b/code/modules/actionspeed/modifiers/addiction.dm @@ -1,3 +1,3 @@ /datum/actionspeed_modifier/stimulants - multiplicative_slowdown = 0.25 + slowdown = 0.25 id = ACTIONSPEED_ID_STIMULANTS diff --git a/code/modules/actionspeed/modifiers/status_effects.dm b/code/modules/actionspeed/modifiers/status_effects.dm index c0e8d9692c06..e240bfe2ff0e 100644 --- a/code/modules/actionspeed/modifiers/status_effects.dm +++ b/code/modules/actionspeed/modifiers/status_effects.dm @@ -1,14 +1,14 @@ /datum/actionspeed_modifier/timecookie - multiplicative_slowdown = -0.05 + slowdown = -0.05 /datum/actionspeed_modifier/broken_arm variable = TRUE /datum/actionspeed_modifier/nooartrium - multiplicative_slowdown = 0.5 + slowdown = 0.5 /datum/actionspeed_modifier/power_chord - multiplicative_slowdown = -0.15 + slowdown = -0.15 /datum/actionspeed_modifier/status_effect/hazard_area - multiplicative_slowdown = 4 + slowdown = 4 diff --git a/code/modules/admin/verbs/individual_logging.dm b/code/modules/admin/verbs/individual_logging.dm index f22c5fe4b423..8e213c95e7a5 100644 --- a/code/modules/admin/verbs/individual_logging.dm +++ b/code/modules/admin/verbs/individual_logging.dm @@ -38,6 +38,8 @@ dat += " | " dat += individual_logging_panel_link(M, INDIVIDUAL_OOC_LOG, LOGSRC_MOB, "OOC Log", source, ntype) dat += " | " + dat += individual_logging_panel_link(M, INDIVIDUAL_HEALTH_LOG, LOGSRC_MOB, "Health Log", source, ntype) + dat += " | " dat += individual_logging_panel_link(M, INDIVIDUAL_SHOW_ALL_LOG, LOGSRC_MOB, "Show All", source, ntype) dat += "" diff --git a/code/modules/antagonists/abductor/equipment/glands/heal.dm b/code/modules/antagonists/abductor/equipment/glands/heal.dm index 5e7360b5ea59..a2f5139b4f33 100644 --- a/code/modules/antagonists/abductor/equipment/glands/heal.dm +++ b/code/modules/antagonists/abductor/equipment/glands/heal.dm @@ -67,7 +67,7 @@ replace_blood() return if(owner.blood_volume < BLOOD_VOLUME_OKAY) - owner.blood_volume = BLOOD_VOLUME_NORMAL + owner.setBloodVolume(BLOOD_VOLUME_NORMAL) to_chat(owner, span_warning("You feel your blood pulsing within you.")) return @@ -199,12 +199,15 @@ owner.Stun(15) owner.adjustToxLoss(-15, TRUE, TRUE) - owner.blood_volume = min(BLOOD_VOLUME_NORMAL, owner.blood_volume + 20) + if(owner.blood_volume < BLOOD_VOLUME_NORMAL) + owner.adjustBloodVolume(min(BLOOD_VOLUME_NORMAL - owner.blood_volume), 20) + if(owner.blood_volume < BLOOD_VOLUME_NORMAL) keep_going = TRUE if(owner.getToxLoss()) keep_going = TRUE + for(var/datum/reagent/toxin/R in owner.reagents.reagent_list) owner.reagents.remove_reagent(R.type, 4) if(owner.reagents.has_reagent(R.type)) diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index 0f1aea93083e..942c7bf3e795 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -680,9 +680,10 @@ uses = 0 return ..() else - H.blood_volume = BLOOD_VOLUME_SAFE + H.setBloodVolume(BLOOD_VOLUME_SAFE) uses -= round(restore_blood/2) to_chat(user,span_warning("Your blood rites have restored [H == user ? "your" : "[H.p_their()]"] blood to safe levels!")) + var/overall_damage = H.getBruteLoss() + H.getFireLoss() + H.getToxLoss() + H.getOxyLoss() if(overall_damage == 0) to_chat(user,span_cult("That cultist doesn't require healing!")) diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 3213ab1e7a71..71f49aa2df7c 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -1054,19 +1054,19 @@ Striking a noncultist, however, will tear their flesh."} var/mob/living/simple_animal/hostile/illusion/M = new(owner.loc) M.faction = list("cult") M.Copy_Parent(owner, 70, 10, 5) - M.move_to_delay = owner.cached_multiplicative_slowdown + M.move_to_delay = owner.movement_delay else var/mob/living/simple_animal/hostile/illusion/escape/E = new(owner.loc) E.Copy_Parent(owner, 70, 10) E.GiveTarget(owner) - E.Goto(owner, owner.cached_multiplicative_slowdown, E.minimum_distance) + E.Goto(owner, owner.movement_delay, E.minimum_distance) else if(prob(50)) var/mob/living/simple_animal/hostile/illusion/H = new(owner.loc) H.Copy_Parent(owner, 100, 20, 5) H.faction = list("cult") H.GiveTarget(owner) - H.move_to_delay = owner.cached_multiplicative_slowdown + H.move_to_delay = owner.movement_delay to_chat(owner, span_danger("[src] betrays you!")) return FALSE diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm index 4432b14f9ef6..ba191bd4d458 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm @@ -94,8 +94,7 @@ return if(owner.blood_volume < BLOOD_VOLUME_NORMAL) - owner.blood_volume = owner.blood_volume + 2 - + owner.adjustBloodVolume(2) var/mob/living/carbon/carbon_owner = owner var/datum/wound/bloodiest_wound diff --git a/code/modules/mob/living/basic/basic.dm b/code/modules/mob/living/basic/basic.dm index f48b39a9283f..1b43b32bec17 100644 --- a/code/modules/mob/living/basic/basic.dm +++ b/code/modules/mob/living/basic/basic.dm @@ -131,7 +131,7 @@ /mob/living/basic/proc/update_basic_mob_varspeed() if(speed == 0) remove_movespeed_modifier(/datum/movespeed_modifier/simplemob_varspeed) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/simplemob_varspeed, multiplicative_slowdown = speed) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/simplemob_varspeed, slowdown = speed) SEND_SIGNAL(src, POST_BASIC_MOB_UPDATE_VARSPEED) /mob/living/basic/relaymove(mob/living/user, direction) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 966a7a69b9bc..22e1319660a1 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -4,6 +4,20 @@ BLOOD SYSTEM ****************************************************/ +/// Adjusts blood volume, returning the difference. +/mob/living/proc/adjustBloodVolume(adj) + var/old_blood_volume = blood_volume + blood_volume = clamp(blood_volume + adj, 0, BLOOD_VOLUME_ABSOLUTE_MAX) + return old_blood_volume - blood_volume + +/mob/living/proc/adjustBloodVolumeUpTo(adj, max) + if(blood_volume >= max) + return 0 + return adjustBloodVolume(min(max-blood_volume, adj)) + +/mob/living/proc/setBloodVolume(amt) + return adjustBloodVolume(amt - blood_volume) + // Takes care blood loss and regeneration /mob/living/carbon/human/handle_blood(delta_time, times_fired) @@ -84,11 +98,7 @@ if(!blood_volume) return - var/old_blood_volume = blood_volume - blood_volume = max(blood_volume - amt, 0) - - // Return the difference - . = old_blood_volume - blood_volume + . = adjustBloodVolume(-amt) //Blood loss still happens in locker, floor stays clean if(isturf(loc) && prob(sqrt(amt)*BLOOD_DRIP_RATE_MOD)) @@ -141,8 +151,9 @@ * * forced- */ /mob/living/carbon/proc/bleed_warn(bleed_amt = 0, forced = FALSE) - if(!blood_volume || !client) + if(!blood_volume || !client || stat != CONSCIOUS) return + if(!COOLDOWN_FINISHED(src, bleeding_message_cd) && !forced) return @@ -182,12 +193,11 @@ return ..() /mob/living/proc/restore_blood() - blood_volume = initial(blood_volume) + setBloodVolume(initial(blood_volume)) /mob/living/carbon/restore_blood() - blood_volume = BLOOD_VOLUME_NORMAL - for(var/i in bodyparts) - var/obj/item/bodypart/BP = i + setBloodVolume(BLOOD_VOLUME_NORMAL) + for(var/obj/item/bodypart/BP as anything in bodyparts) BP.setBleedStacks(0) /**************************************************** @@ -226,7 +236,7 @@ C.reagents.add_reagent(/datum/reagent/toxin, amount * 0.5) return TRUE - C.blood_volume = min(C.blood_volume + round(amount, 0.1), BLOOD_VOLUME_MAX_LETHAL) + C.adjustBloodVolumeUpTo(0.1) return TRUE AM.reagents.add_reagent(blood_id, amount, blood_data, bodytemperature) @@ -383,7 +393,7 @@ else blood_volume_percent = 100 - var/blood_volume_mod = max(0, 1 - getOxyLoss()/(maxHealth/2)) + var/blood_volume_mod = max(0, 1 - getOxyLoss()/ maxHealth) var/oxygenated_mult = 0 if(chem_effects[CE_OXYGENATED] == 1) // Dexalin. oxygenated_mult = 0.5 diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index 2e29f90fe470..1dccda0dc949 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -286,8 +286,11 @@ oxygen_reserve = min(initial(oxygen_reserve), oxygen_reserve+1) if(!oxygen_reserve) //(hardcrit) - add_organ_trait(TRAIT_KNOCKEDOUT) - else + if(!(TRAIT_KNOCKEDOUT in organ_traits)) + add_organ_trait(TRAIT_KNOCKEDOUT) + log_health(owner, "Passed out due to brain oxygen reaching zero. BLOOD OXY: [blood_percent]%") + else if(TRAIT_KNOCKEDOUT in organ_traits) + log_health(owner, "Brain now has enough oxygen.") remove_organ_trait(TRAIT_KNOCKEDOUT) var/can_heal = damage && damage < maxHealth && (damage % damage_threshold_value || CHEM_EFFECT_MAGNITUDE(owner, CE_BRAIN_REGEN) || (!past_damage_threshold(3) && owner.chem_effects[CE_STABLE])) @@ -299,7 +302,7 @@ . |= applyOrganDamage(-1, updating_health = FALSE) if(BLOOD_CIRC_OKAY to BLOOD_CIRC_SAFE) - if(prob(1)) + if(owner.stat == CONSCIOUS && prob(1)) to_chat(owner, span_warning("You feel [pick("dizzy","woozy","faint")]...")) damprob = CHEM_EFFECT_MAGNITUDE(owner, CE_STABLE) ? 30 : 60 if(!past_damage_threshold(2) && prob(damprob)) @@ -311,9 +314,10 @@ if(!past_damage_threshold(4) && prob(damprob)) . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) - if(prob(10)) - owner.Unconscious(rand(1,3) SECONDS) + if(owner.stat == CONSCIOUS && prob(10)) + log_health(owner, "Passed out due to poor blood oxygenation, random chance.") to_chat(owner, span_warning("You feel extremely [pick("dizzy","woozy","faint")]...")) + owner.Unconscious(rand(1,3) SECONDS) if(BLOOD_CIRC_SURVIVE to BLOOD_CIRC_BAD) owner.blur_eyes(6) @@ -321,7 +325,8 @@ if(!past_damage_threshold(6) && prob(damprob)) . |= applyOrganDamage(BRAIN_DECAY_RATE, updating_health = FALSE) - if(prob(15)) + if(owner.stat == CONSCIOUS && prob(15)) + log_health(owner, "Passed out due to poor blood oxygenation, random chance.") owner.Unconscious(rand(3,5) SECONDS) to_chat(owner, span_warning("You feel extremely [pick("dizzy","woozy","faint")]...")) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 0cbb929caf28..1ad644a92851 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1422,11 +1422,13 @@ else visible_message("\The [src] twitches a bit as \his heart restarts!") - shock_stage = min(shock_stage, 100) // 120 is the point at which the heart stops. + shock_stage = min(shock_stage, SHOCK_AMT_FOR_FIBRILLATION - 25) - if(getOxyLoss() >= 75) - setOxyLoss(75) + // Clamp oxy loss to 70 for 200 health mobs. This is a 0.65 modifier for blood oxygenation. + if(getOxyLoss() >= maxHealth * 0.35) + setOxyLoss(maxHealth * 0.35) + COOLDOWN_START(heart, arrhythmia_grace_period, 10 SECONDS) heart.Restart() heart.handle_pulse() return TRUE diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 9449ccf37877..26de8266d94a 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -350,8 +350,9 @@ return //Propagation through pulling, fireman carry if(!(flags & SHOCK_ILLUSION)) - if(undergoing_cardiac_arrest()) - set_heartattack(FALSE) + if(undergoing_cardiac_arrest() && resuscitate()) + log_health(src, "Heart restarted due to elecrocution.") + var/list/shocking_queue = list() shocking_queue += get_all_grabbed_movables() shocking_queue -= source diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm index 343c96b813a1..cb321efeed7c 100644 --- a/code/modules/mob/living/carbon/carbon_movement.dm +++ b/code/modules/mob/living/carbon/carbon_movement.dm @@ -75,6 +75,6 @@ if(!usable_hands) ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT) if(limbless_slowdown) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, multiplicative_slowdown = limbless_slowdown) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, slowdown = limbless_slowdown) else remove_movespeed_modifier(/datum/movespeed_modifier/limbless) diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index e6b8af54e03c..bd1166e92fe2 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -85,9 +85,10 @@ if(HAS_TRAIT(src, TRAIT_TOXIMMUNE)) //Prevents toxin damage, but not healing amount = min(amount, 0) if(!heal) - blood_volume = max(blood_volume - (5*amount), 0) + adjustBloodVolume(-5 * amount) else - blood_volume = max(blood_volume - amount, 0) + adjustBloodVolume(-amount) + else if(HAS_TRAIT(src, TRAIT_TOXIMMUNE)) //Prevents toxin damage, but not healing amount = min(amount, 0) @@ -288,5 +289,6 @@ return 0 var/obj/item/organ/lungs/L = getorganslot(ORGAN_SLOT_LUNGS) if(!L || (L.organ_flags & ORGAN_DEAD)) - return maxHealth / 2 + return maxHealth + return ..() diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index 8ecb2236a460..94f3cde86442 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -23,6 +23,9 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift) /mob/living/carbon/human/death(gibbed) if(stat == DEAD) return + + log_health(src, "Died. BRUTE: [getBruteLoss()] | BURN: [getFireLoss()] | TOX: [getFireLoss()] | OXY:[getOxyLoss()] | BLOOD: [blood_volume] | BLOOD OXY: [get_blood_oxygenation()]% | PAIN:[getPain()]") + stop_sound_channel(CHANNEL_HEARTBEAT) var/obj/item/organ/heart/H = getorganslot(ORGAN_SLOT_HEART) if(H) @@ -52,10 +55,10 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift) /mob/living/carbon/proc/Drain() become_husk(CHANGELING_DRAIN) ADD_TRAIT(src, TRAIT_BADDNA, CHANGELING_DRAIN) - blood_volume = 0 + setBloodVolume(0) return TRUE /mob/living/carbon/proc/makeUncloneable() ADD_TRAIT(src, TRAIT_BADDNA, MADE_UNCLONEABLE) - blood_volume = 0 + setBloodVolume(0) return TRUE diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 7cff083c2240..729d0a060186 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -514,13 +514,8 @@ cpr_image.plane = ABOVE_HUD_PLANE add_overlay(cpr_image) - var/panicking = FALSE - do - if (!do_after(src, target, panicking ? CPR_PANIC_SPEED : (3 SECONDS), DO_PUBLIC, extra_checks = CALLBACK(src, PROC_REF(can_perform_cpr), target))) - to_chat(src, span_warning("You fail to perform CPR on [target]!")) - break - - if (target.health > target.crit_threshold) + while (TRUE) + if (!do_after(src, target, 3 SECONDS, DO_PUBLIC, extra_checks = CALLBACK(src, PROC_REF(can_perform_cpr), target))) break visible_message( @@ -531,26 +526,20 @@ log_combat(src, target, "CPRed") if(target.breathe(TRUE) == BREATH_OKAY) - to_chat(target, span_unconscious("You feel a breath of fresh air enter your lungs. It feels good.")) - target.adjustOxyLoss(-min(target.getOxyLoss(), 8)) - - if (target.health <= target.crit_threshold) - if (!panicking) - to_chat(src, span_warning("[target] still isn't up! You try harder!")) - panicking = TRUE - else - panicking = FALSE + to_chat(target, span_unconscious("You feel a breath of fresh air enter your lungs.")) + target.adjustOxyLoss(-8) - while (panicking) cut_overlay(cpr_image) #undef CPR_PANIC_SPEED /mob/living/carbon/human/proc/can_perform_cpr(mob/living/carbon/target, silent = TRUE) - if (target.stat == DEAD || HAS_TRAIT(target, TRAIT_FAKEDEATH)) - if(!silent) - to_chat(src, span_warning("[target.name] is dead!")) + if(target.body_position != LYING_DOWN) + return FALSE + + if(!target.getorganslot(ORGAN_SLOT_LUNGS)) + to_chat(src, span_warning("[target.p_they()] [target.p_dont()] have lungs.")) return FALSE return TRUE @@ -767,7 +756,15 @@ else hud_used.healthdoll.icon_state = "healthdoll_DEAD" +/mob/living/carbon/human/revive(full_heal, admin_revive, excess_healing) + . = ..() + if(!.) + return + + log_health(src, "Brought back to life.") + /mob/living/carbon/human/fully_heal(admin_revive = FALSE) + log_health(src, "Received an adminheal.") dna?.species.spec_fully_heal(src) if(admin_revive) regenerate_limbs() @@ -948,17 +945,6 @@ /mob/living/carbon/human/updatehealth() . = ..() dna?.species.spec_updatehealth(src) - if(HAS_TRAIT(src, TRAIT_IGNOREDAMAGESLOWDOWN)) - remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown) - remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying) - return - var/health_deficiency = maxHealth - health - if(health_deficiency >= 40) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown, TRUE, multiplicative_slowdown = health_deficiency / 25) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying, TRUE, multiplicative_slowdown = health_deficiency / 25) - else - remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown) - remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying) /mob/living/carbon/human/pre_stamina_change(diff as num, forced) if(diff < 0) //Taking damage, not healing @@ -1176,8 +1162,7 @@ if(prob(getBruteLoss() * 0.6)) makeBloodTrail(new_loc, old_loc, direction, TRUE) - blood_volume = max(blood_volume - 1, 0) - + adjustBloodVolume(-1) if(!prob(10)) return diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 4dcd5a3b3a95..bb78cf5afd5c 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -1,12 +1,11 @@ /mob/living/carbon/human/get_movespeed_modifiers() var/list/considering = ..() if(HAS_TRAIT(src, TRAIT_IGNORESLOWDOWN)) - . = list() for(var/id in considering) var/datum/movespeed_modifier/M = considering[id] - if(M.flags & IGNORE_NOSLOW || M.multiplicative_slowdown < 0) - .[id] = M - return + if(!(M.flags & IGNORE_NOSLOW) && M.slowdown > 0) + considering -= id + return considering /mob/living/carbon/human/slip(knockdown_amount, obj/slipped_on, lube_flags, paralyze, force_drop = FALSE) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 5a683112ca2d..0cb5c5b64244 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -532,7 +532,7 @@ GLOBAL_LIST_EMPTY(features_by_species) fly = new fly.Grant(C) - C.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/species, multiplicative_slowdown=speedmod) + C.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/species, slowdown=speedmod) SEND_SIGNAL(C, COMSIG_SPECIES_GAIN, src, old_species) @@ -1491,7 +1491,7 @@ GLOBAL_LIST_EMPTY(features_by_species) else if(bodytemp < cold_level_1 && !HAS_TRAIT(humi, TRAIT_RESISTCOLD)) // clear any hot moods and apply cold mood // Apply cold slow down - humi.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, multiplicative_slowdown = ((cold_level_1 - humi.bodytemperature) / COLD_SLOWDOWN_FACTOR)) + humi.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, slowdown = ((cold_level_1 - humi.bodytemperature) / COLD_SLOWDOWN_FACTOR)) // Display alerts based how cold it is // Can't be a switch due to http://www.byond.com/forum/post/2750423 if(bodytemp in cold_level_1 to cold_level_2) 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 52420bce80b4..0e9304105d4e 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -186,7 +186,8 @@ bodies -= C // This means that the other bodies maintain a link // so if someone mindswapped into them, they'd still be shared. bodies = null - C.blood_volume = min(C.blood_volume, BLOOD_VOLUME_NORMAL) + if(C.blood_volume < BLOOD_VOLUME_NORMAL) + C.setBloodVolume(BLOOD_VOLUME_NORMAL) ..() /datum/species/jelly/slime/on_species_gain(mob/living/carbon/C, datum/species/old_species) diff --git a/code/modules/mob/living/carbon/human/species_types/vampire.dm b/code/modules/mob/living/carbon/human/species_types/vampire.dm index 3c51a199f9bc..1f635c51afe9 100644 --- a/code/modules/mob/living/carbon/human/species_types/vampire.dm +++ b/code/modules/mob/living/carbon/human/species_types/vampire.dm @@ -216,8 +216,8 @@ to_chat(H, span_notice("You drain some blood!")) playsound(H, 'sound/items/drink.ogg', 30, TRUE, -2) - victim.blood_volume = clamp(victim.blood_volume - drained_blood, 0, BLOOD_VOLUME_MAXIMUM) - H.blood_volume = clamp(H.blood_volume + drained_blood, 0, BLOOD_VOLUME_MAXIMUM) + victim.adjustBloodVolume(-drained_blood) + H.adjustBloodVolumeUpTo(drained_blood, BLOOD_VOLUME_MAXIMUM) if(!victim.blood_volume) to_chat(H, span_notice("You finish off [victim]'s blood supply.")) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index de124a523bd0..b45f09d20839 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -20,9 +20,13 @@ if(stat != DEAD) handle_brain_damage(delta_time, times_fired) - if(handle_bodyparts(delta_time, times_fired)) + var/bodyparts_action = handle_bodyparts(delta_time, times_fired) + if(bodyparts_action & BODYPART_LIFE_UPDATE_HEALTH) updatehealth() + else if(bodyparts_action & BODYPART_LIFE_UPDATE_HEALTH_HUD) + update_health_hud() + if(stat == DEAD) stop_sound_channel(CHANNEL_HEARTBEAT) @@ -135,12 +139,13 @@ breath.adjustGas(gasname, -breath.gas[gasname], update = 0) //update after . = check_breath(breath, forced) + if(breath?.total_moles) AIR_UPDATE_VALUES(breath) loc.assume_air(breath) var/static/sound/breathing = sound('sound/voice/breathing.ogg', volume = 50, channel = CHANNEL_BREATHING) - if(shock_stage >= 10 || (!forced && . && COOLDOWN_FINISHED(src, breath_sound_cd) && environment?.returnPressure() < SOUND_MINIMUM_PRESSURE)) + if((!forced && . && COOLDOWN_FINISHED(src, breath_sound_cd) && environment?.returnPressure() < SOUND_MINIMUM_PRESSURE)) src << breathing COOLDOWN_START(src, breath_sound_cd, 3.5 SECONDS) diff --git a/code/modules/mob/living/carbon/pain.dm b/code/modules/mob/living/carbon/pain.dm index 5bb45966bc01..ae77f3877386 100644 --- a/code/modules/mob/living/carbon/pain.dm +++ b/code/modules/mob/living/carbon/pain.dm @@ -2,7 +2,8 @@ COOLDOWN_DECLARE(pain_cd) COOLDOWN_DECLARE(pain_emote_cd) -/mob/living/carbon/var/shock_stage +/mob/living/carbon + var/shock_stage /mob/living/carbon/getPain() . = 0 @@ -11,9 +12,6 @@ . -= CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER) - if(stat == UNCONSCIOUS) - . *= 0.6 - return max(0, .) /mob/living/carbon/adjustPain(amount, updating_health = TRUE) @@ -25,8 +23,10 @@ return /mob/living/carbon/flash_pain(severity = PAIN_SMALL) - if(client && !client.prefs?.read_preference(/datum/preference/toggle/disable_pain_flash)) - flick(severity, hud_used?.pain) + if(!client || client.prefs?.read_preference(/datum/preference/toggle/disable_pain_flash)) + return + + flick(severity, hud_used?.pain) /mob/living/carbon/apply_pain(amount, def_zone, message, ignore_cd, updating_health = TRUE) if((status_flags & GODMODE) || HAS_TRAIT(src, TRAIT_NO_PAINSHOCK)) @@ -74,24 +74,31 @@ if(. && !is_healing) - switch(.) - if(1 to 20) - flash_pain(PAIN_SMALL) - if(20 to PAIN_AMT_MEDIUM) - flash_pain(PAIN_MEDIUM) - shake_camera(src, 1, 2) - if(PAIN_AMT_MEDIUM to INFINITY) - flash_pain(PAIN_LARGE) - shake_camera(src, 3, 4) - - pain_message(message, amount, ignore_cd) + notify_pain(amount, message, ignore_cd) if(updating_health && .) - updatehealth() + update_health_hud() + +/// Flashes the pain overlay and provides a chat message. +/mob/living/carbon/proc/notify_pain(amount, message, ignore_cd) + if(stat != CONSCIOUS) + return + + if(amount >= PAIN_AMT_AGONIZING) + flash_pain(PAIN_LARGE) + shake_camera(src, 3, 4) + else if(amount >= PAIN_AMT_MEDIUM) + flash_pain(PAIN_MEDIUM) + shake_camera(src, 1, 2) + else if(amount >= PAIN_AMT_LOW) + flash_pain(PAIN_SMALL) + + if(message) + pain_message(message, amount, ignore_cd) /mob/living/carbon/proc/pain_message(message, amount, ignore_cd) set waitfor = FALSE - if(!amount) + if(!amount || (stat != CONSCIOUS)) return FALSE . = COOLDOWN_FINISHED(src, pain_cd) @@ -139,12 +146,22 @@ return COOLDOWN_START(src, pain_emote_cd, 5 SECONDS) - emote(dna.species.get_pain_emote(amount)) + var/emote = dna.species.get_pain_emote(amount) + if(findtext(emote, "me ", 1, 4)) + manual_emote(copytext(emote, 4)) + else + emote(emote) + +#define SHOCK_STRING_MINOR \ + pick("It hurts...",\ + "Uaaaghhhh...",\ + "Agh..."\ + ) -#define PAIN_STRING \ +#define SHOCK_STRING_MAJOR \ pick("The pain is excruciating!",\ "Please, just end the pain!",\ - "Your whole body is going numb!"\ + "I can't feel anything!"\ ) /mob/living/carbon/proc/handle_shock() @@ -180,63 +197,79 @@ if(stat) return + var/message = "" if(shock_stage == SHOCK_TIER_1) - pain_message(PAIN_STRING, shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) + message = SHOCK_STRING_MINOR - if(shock_stage >= SHOCK_TIER_2 && prob(shock_stage - 10)) + if((shock_stage > SHOCK_TIER_2 && prob(2)) || shock_stage == SHOCK_TIER_2) if(shock_stage == SHOCK_TIER_2 && organs_by_slot[ORGAN_SLOT_EYES]) - visible_message("[src] is having trouble keeping [p_their()] eyes open.") + manual_emote("is having trouble keeping [p_their()] eyes open.") blur_eyes(5) set_timed_status_effect(10 SECONDS, /datum/status_effect/speech/stutter, only_if_higher = TRUE) if(shock_stage == SHOCK_TIER_3) - pain_message(PAIN_STRING, shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) + message = SHOCK_STRING_MAJOR else if(shock_stage >= SHOCK_TIER_3) if(prob(20)) set_timed_status_effect(5 SECONDS, /datum/status_effect/speech/stutter, only_if_higher = TRUE) - if(shock_stage >= SHOCK_TIER_4 && prob(5)) - pain_message(PAIN_STRING, shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) + if((shock_stage > SHOCK_TIER_4 && prob(5)) || shock_stage == SHOCK_TIER_4) + message = SHOCK_STRING_MAJOR + manual_emote("stumbles over [p_them()]self.") Knockdown(2 SECONDS) - if(shock_stage >= SHOCK_TIER_5 && prob(10)) - pain_message(PAIN_STRING, shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) + else if((shock_stage > SHOCK_TIER_5 && prob(10)) || shock_stage == SHOCK_TIER_5) + message = SHOCK_STRING_MAJOR + manual_emote("stumbles over [p_them()]self.") Knockdown(2 SECONDS) - if(shock_stage >= SHOCK_TIER_6) - if (prob(2)) - pain_message(pick("You black out!", "You feel like you could die any moment now!", "You're about to lose consciousness!"), shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) + if((shock_stage > SHOCK_TIER_6 && prob(2)) || shock_stage == SHOCK_TIER_6) + if (stat == CONSCIOUS) + pain_message(pick("You black out.", "I feel like I could die any moment now.", "I can't go on anymore."), shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) Unconscious(10 SECONDS) + return // We'll be generous if(shock_stage >= SHOCK_TIER_7) if(shock_stage == SHOCK_TIER_7) visible_message("[src] falls limp!") - Knockdown(40 SECONDS) + Unconscious(20 SECONDS) -#undef PAIN_STRING + if(message) + pain_message(message, shock_stage - CHEM_EFFECT_MAGNITUDE(src, CE_PAINKILLER)/3) + +#undef SHOCK_STRING_MINOR +#undef SHOCK_STRING_MAJOR /mob/living/carbon/proc/handle_pain() if(stat == DEAD) return var/pain = getPain() + /// Brain health scales the pain passout modifier with an importance of 80% + var/brain_health_factor = 1 + ((maxHealth - getBrainLoss()) / maxHealth - 1) * 0.8 + /// Blood circulation scales the pain passout modifier with an importance of 40% + var/blood_circulation_factor = 1 + (get_blood_circulation() / 100 - 1) * 0.4 + + var/pain_passout = min(PAIN_AMT_PASSOUT * brain_health_factor * blood_circulation_factor, PAIN_AMT_PASSOUT) - if(pain >= 15) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/pain, TRUE, min((pain / 40), 15)) + if(pain <= max((pain_passout * 0.075), 10)) + var/slowdown = min(pain * (PAIN_MAX_SLOWDOWN / pain_passout), PAIN_MAX_SLOWDOWN) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/pain, TRUE, slowdown) else remove_movespeed_modifier(/datum/movespeed_modifier/pain) - if(pain >= maxHealth) + if(pain >= pain_passout) if(!stat && !HAS_TRAIT(src, TRAIT_FAKEDEATH)) visible_message( span_danger("[src] slumps over, too weak to continue fighting..."), span_danger("You give into the pain.") ) + log_health(src, "Passed out due to excessive pain: [pain] | Threshold: [pain_passout]") Unconscious(10 SECONDS) return - if(stat == UNCONSCIOUS) + if(stat != CONSCIOUS) return var/pain_timeleft = COOLDOWN_TIMELEFT(src, pain_cd) @@ -260,7 +293,9 @@ if(highest_damage > PAIN_THRESHOLD_REDUCE_PARALYSIS) AdjustSleeping(-(highest_damage / 5) SECONDS) if(highest_damage > PAIN_THRESHOLD_DROP_ITEM && prob(highest_damage / 5)) - dropItemToGround(get_active_held_item()) + var/obj/item/I = get_active_held_item() + if(I && dropItemToGround(I)) + visible_message(span_alert("[src] twitches, dropping their [I].")) var/burning = damaged_part.burn_dam > damaged_part.brute_dam var/msg @@ -277,6 +312,9 @@ // Damage to internal organs hurts a lot. for(var/obj/item/organ/I as anything in organs) + if(istype(I, /obj/item/organ/brain)) + continue + if(prob(1) && (!(I.organ_flags & (ORGAN_SYNTHETIC|ORGAN_DEAD)) && I.damage > 5)) var/obj/item/bodypart/parent = I.ownerlimb if(parent.bodypart_flags & BP_NO_PAIN) diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 2aa203125402..2474c9d02785 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -183,7 +183,7 @@ return . = oxyloss - oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth/2) + oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth) if(updating_health) updatehealth() @@ -191,11 +191,10 @@ if(!forced && status_flags & GODMODE) return . = oxyloss - oxyloss = clamp(amount, 0, maxHealth/2) + oxyloss = clamp(amount, 0, maxHealth) if(updating_health) updatehealth() - /mob/living/proc/getToxLoss() return toxloss diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 23181ecae488..0187259f775e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -937,7 +937,7 @@ // Handle movespeed stuff var/speed_change = max(0, gravity - STANDARD_GRAVITY) if(speed_change) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/gravity, multiplicative_slowdown=speed_change) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/gravity, slowdown=speed_change) else remove_movespeed_modifier(/datum/movespeed_modifier/gravity) @@ -1864,7 +1864,7 @@ GLOBAL_LIST_EMPTY(fire_appearances) var/limbless_slowdown = (default_num_legs - usable_legs) * 3 if(!usable_legs && usable_hands < default_num_hands) limbless_slowdown += (default_num_hands - usable_hands) * 3 - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, multiplicative_slowdown = limbless_slowdown) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, slowdown = limbless_slowdown) else remove_movespeed_modifier(/datum/movespeed_modifier/limbless) diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 7190917ecb8f..c9275284fa10 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -92,7 +92,7 @@ /mob/living/proc/update_turf_movespeed(turf/open/T) if(isopenturf(T)) if(T.slowdown != current_turf_slowdown) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/turf_slowdown, multiplicative_slowdown = T.slowdown) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/turf_slowdown, slowdown = T.slowdown) current_turf_slowdown = T.slowdown else if(current_turf_slowdown) remove_movespeed_modifier(/datum/movespeed_modifier/turf_slowdown) @@ -116,7 +116,7 @@ var/obj/structure/S = pulling slowdown_total += S.drag_slowdown - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/grabbing, multiplicative_slowdown = slowdown_total) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/grabbing, slowdown = slowdown_total) /mob/living/can_z_move(direction, turf/start, z_move_flags, mob/living/rider) // Check physical climbing ability diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index e86d3818830e..bfb6bfd247d2 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -432,7 +432,7 @@ /mob/living/simple_animal/proc/update_simplemob_varspeed() if(speed == 0) remove_movespeed_modifier(/datum/movespeed_modifier/simplemob_varspeed) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/simplemob_varspeed, multiplicative_slowdown = speed) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/simplemob_varspeed, slowdown = speed) /mob/living/simple_animal/get_status_tab_items() . = ..() diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index af9398812a32..752aeaa6b6e3 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -105,7 +105,7 @@ AIproc = 0 break - var/sleeptime = cached_multiplicative_slowdown + var/sleeptime = movement_delay if(sleeptime <= 0) sleeptime = 1 diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 1afc9cc108a4..e1b890be7330 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -156,7 +156,7 @@ mod += (health_deficiency / 25) if(health <= 0) mod += 2 - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/slime_healthmod, multiplicative_slowdown = mod) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/slime_healthmod, slowdown = mod) /mob/living/simple_animal/slime/adjust_bodytemperature() . = ..() @@ -166,7 +166,7 @@ else if(bodytemperature < 283.222) mod = ((283.222 - bodytemperature) / 10) * 1.75 if(mod) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/slime_tempmod, multiplicative_slowdown = mod) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/slime_tempmod, slowdown = mod) /mob/living/simple_animal/slime/ObjBump(obj/O) if(!client && powerlevel > 0) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 91b610570189..54169340d5a1 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -139,21 +139,22 @@ msg = copytext_char(msg, 1, MAX_MESSAGE_LEN) if(type) - if(type & MSG_VISUAL && is_blind() )//Vision related + if((type & MSG_VISUAL) && is_blind() )//Vision related if(!alt_msg) return else msg = alt_msg type = alt_type - if(type & MSG_AUDIBLE && !can_hear())//Hearing related + if((type & MSG_AUDIBLE) && !can_hear())//Hearing related if(!alt_msg) return else msg = alt_msg type = alt_type - if(type & MSG_VISUAL && is_blind()) + if((type & MSG_VISUAL) && is_blind()) return + // voice muffling if(stat == UNCONSCIOUS) if(type & MSG_AUDIBLE) //audio @@ -201,7 +202,7 @@ var/raw_msg = message if(visible_message_flags & EMOTE_MESSAGE) - message = "[src][separation][message]" + message = "[src][separation][message]" for(var/mob/M in hearers) if(!M.client) @@ -224,7 +225,7 @@ if(!msg) continue - if(visible_message_flags & EMOTE_MESSAGE && runechat_prefs_check(M, visible_message_flags) && !M.is_blind()) + if((visible_message_flags & EMOTE_MESSAGE) && runechat_prefs_check(M, visible_message_flags) && !M.is_blind()) M.create_chat_message(src, raw_message = raw_msg, runechat_flags = visible_message_flags) M.show_message(msg, msg_type, blind_message, MSG_AUDIBLE) @@ -1383,7 +1384,7 @@ if(!speedies) remove_movespeed_modifier(/datum/movespeed_modifier/equipment_speedmod) else - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/equipment_speedmod, multiplicative_slowdown = speedies) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/equipment_speedmod, slowdown = speedies) /// Gets the combined speed modification of all worn items /// Except base mob type doesnt really wear items @@ -1428,16 +1429,16 @@ datum_flags |= DF_VAR_EDITED return - var/slowdown_edit = (var_name == NAMEOF(src, cached_multiplicative_slowdown)) + var/slowdown_edit = (var_name == NAMEOF(src, movement_delay)) var/diff - if(slowdown_edit && isnum(cached_multiplicative_slowdown) && isnum(var_value)) + if(slowdown_edit && isnum(movement_delay) && isnum(var_value)) remove_movespeed_modifier(/datum/movespeed_modifier/admin_varedit) - diff = var_value - cached_multiplicative_slowdown + diff = var_value - movement_delay . = ..() if(. && slowdown_edit && isnum(diff)) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/admin_varedit, multiplicative_slowdown = diff) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/admin_varedit, slowdown = diff) /mob/proc/set_active_storage(new_active_storage) if(active_storage) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index ffcfcfa2a852..87a813137bdc 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -39,7 +39,7 @@ /// List of movement speed modifiers ignored by this mob. List -> List (id) -> List (sources) var/list/movespeed_mod_immunities //Lazy list, see mob_movespeed.dm /// The calculated mob speed slowdown based on the modifiers list - var/cached_multiplicative_slowdown + var/movement_delay /// List of action speed modifiers applying to this mob var/list/actionspeed_modification //Lazy list, see mob_movespeed.dm /// List of action speed modifiers ignored by this mob. List -> List (id) -> List (sources) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index fa5ae6d5f890..4205c0ab392d 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -463,6 +463,8 @@ GLOBAL_LIST_INIT(bodyzone_gurps_mods, list( colored_message = "(EMOTE) [colored_message]" if(LOG_RADIO_EMOTE) colored_message = "(RADIOEMOTE) [colored_message]" + if(LOG_HEALTH) + colored_message = "(HEALTH) [colored_message]" var/list/timestamped_message = list("\[[time_stamp(format = "YYYY-MM-DD hh:mm:ss")]\] [key_name(src)] [loc_name(src)] (Event #[LAZYLEN(logging[smessage_type])])" = colored_message) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 6a163815f5f6..bad69cafbd4b 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -124,7 +124,7 @@ return FALSE //We are now going to move - var/add_delay = mob.cached_multiplicative_slowdown + var/add_delay = mob.movement_delay var/new_glide_size = DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? 2 : 1 ) ) mob.set_glide_size(new_glide_size) // set it now in case of pulled objects //If the move was recent, count using old_move_delay diff --git a/code/modules/movespeed/_movespeed_modifier.dm b/code/modules/movespeed/_movespeed_modifier.dm index c5c5a457f484..7406766ecaf9 100644 --- a/code/modules/movespeed/_movespeed_modifier.dm +++ b/code/modules/movespeed/_movespeed_modifier.dm @@ -36,8 +36,8 @@ Key procs var/priority = 0 var/flags = NONE - /// Multiplicative slowdown - var/multiplicative_slowdown = 0 + /// How many deciseconds of delay to add between each movement. Can be negative. + var/slowdown = 0 /// Movetypes this applies to var/movetypes = ALL @@ -107,10 +107,10 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache) 1. Ensures type_id_datum one way or another refers to a /variable datum. This makes sure it can't be cached. This includes if it's already in the modification list. 2. Instantiate a new datum if type_id_datum isn't already instantiated + in the list, using the type. Obviously, wouldn't work for ID only. 3. Add the datum if necessary using the regular add proc - 4. If any of the rest of the args are not null (see: multiplicative slowdown), modify the datum + 4. If any of the rest of the args are not null (see: slowdown), modify the datum 5. Update if necessary */ -/mob/proc/add_or_update_variable_movespeed_modifier(datum/movespeed_modifier/type_id_datum, update = TRUE, multiplicative_slowdown) +/mob/proc/add_or_update_variable_movespeed_modifier(datum/movespeed_modifier/type_id_datum, update = TRUE, slowdown) var/modified = FALSE var/inject = FALSE var/datum/movespeed_modifier/final @@ -133,8 +133,8 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache) if(!LAZYACCESS(movespeed_modification, final.id)) inject = TRUE modified = TRUE - if(!isnull(multiplicative_slowdown)) - final.multiplicative_slowdown = multiplicative_slowdown + if(!isnull(slowdown)) + final.slowdown = slowdown modified = TRUE if(inject) add_movespeed_modifier(final, FALSE) @@ -156,10 +156,10 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache) /// Set or update the global movespeed config on a mob /mob/proc/update_config_movespeed() - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_config_speedmod, multiplicative_slowdown = get_config_multiplicative_speed()) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_config_speedmod, slowdown = get_config_move_delay()) /// Get the global config movespeed of a mob by type -/mob/proc/get_config_multiplicative_speed() +/mob/proc/get_config_move_delay() if(!islist(GLOB.mob_config_movespeed_type_lookup) || !GLOB.mob_config_movespeed_type_lookup[type]) return 0 else @@ -176,7 +176,7 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache) if(M.blacklisted_movetypes & movement_type) // There's a movetype here that disables this modifier, skip continue var/conflict = M.conflicts_with - var/amt = M.multiplicative_slowdown + var/amt = M.slowdown if(conflict) // Conflicting modifiers prioritize the larger slowdown or the larger speedup // We purposefuly don't handle mixing speedups and slowdowns on the same id @@ -185,24 +185,19 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache) else continue . += amt - cached_multiplicative_slowdown = . + + movement_delay = . SEND_SIGNAL(src, COMSIG_MOB_MOVESPEED_UPDATED) /// Get the move speed modifiers list of the mob /mob/proc/get_movespeed_modifiers() . = LAZYCOPY(movespeed_modification) - for(var/id in movespeed_mod_immunities) - . -= id + (.):Remove(movespeed_mod_immunities) /// Calculate the total slowdown of all movespeed modifiers -/mob/proc/total_multiplicative_slowdown() +/mob/proc/total_slowdown() . = 0 for(var/id in get_movespeed_modifiers()) var/datum/movespeed_modifier/M = movespeed_modification[id] - . += M.multiplicative_slowdown + . += M.slowdown -/// Checks if a move speed modifier is valid and not missing any data -/proc/movespeed_data_null_check(datum/movespeed_modifier/M) //Determines if a data list is not meaningful and should be discarded. - . = TRUE - if(M.multiplicative_slowdown) - . = FALSE diff --git a/code/modules/movespeed/modifiers/components.dm b/code/modules/movespeed/modifiers/components.dm index 30b41e89152c..70e9a2c83599 100644 --- a/code/modules/movespeed/modifiers/components.dm +++ b/code/modules/movespeed/modifiers/components.dm @@ -1,14 +1,14 @@ /datum/movespeed_modifier/shrink_ray movetypes = GROUND - multiplicative_slowdown = 4 + slowdown = 4 flags = IGNORE_NOSLOW /datum/movespeed_modifier/snail_crawl - multiplicative_slowdown = -7 + slowdown = -7 movetypes = GROUND /datum/movespeed_modifier/tenacious - multiplicative_slowdown = -0.7 + slowdown = -0.7 movetypes = GROUND /datum/movespeed_modifier/sanity @@ -16,10 +16,10 @@ movetypes = (~FLYING) /datum/movespeed_modifier/sanity/insane - multiplicative_slowdown = 1 + slowdown = 1 /datum/movespeed_modifier/sanity/crazy - multiplicative_slowdown = 0.5 + slowdown = 0.5 /datum/movespeed_modifier/sanity/disturbed - multiplicative_slowdown = 0.25 + slowdown = 0.25 diff --git a/code/modules/movespeed/modifiers/drugs.dm b/code/modules/movespeed/modifiers/drugs.dm index a8f017bea9f6..548f26eecc51 100644 --- a/code/modules/movespeed/modifiers/drugs.dm +++ b/code/modules/movespeed/modifiers/drugs.dm @@ -1,4 +1,4 @@ /datum/movespeed_modifier/stimulants movetypes = GROUND - multiplicative_slowdown = 1 + slowdown = 1 id = MOVESPEED_ID_STIMULANTS diff --git a/code/modules/movespeed/modifiers/innate.dm b/code/modules/movespeed/modifiers/innate.dm index 46fc82269eac..e60077729a50 100644 --- a/code/modules/movespeed/modifiers/innate.dm +++ b/code/modules/movespeed/modifiers/innate.dm @@ -1,9 +1,9 @@ /datum/movespeed_modifier/strained_muscles - multiplicative_slowdown = -0.55 + slowdown = -0.55 blacklisted_movetypes = (FLYING|FLOATING) /datum/movespeed_modifier/pai_spacewalk - multiplicative_slowdown = 2 + slowdown = 2 flags = IGNORE_NOSLOW /datum/movespeed_modifier/species @@ -12,4 +12,4 @@ /datum/movespeed_modifier/dna_vault_speedup blacklisted_movetypes = (FLYING|FLOATING) - multiplicative_slowdown = -0.4 + slowdown = -0.4 diff --git a/code/modules/movespeed/modifiers/items.dm b/code/modules/movespeed/modifiers/items.dm index e1ec36c3a157..5fd586dd23b0 100644 --- a/code/modules/movespeed/modifiers/items.dm +++ b/code/modules/movespeed/modifiers/items.dm @@ -3,16 +3,16 @@ movetypes = FLOATING /datum/movespeed_modifier/jetpack/cybernetic - multiplicative_slowdown = -0.5 + slowdown = -0.5 /datum/movespeed_modifier/jetpack/fullspeed - multiplicative_slowdown = -0.5 + slowdown = -0.5 /datum/movespeed_modifier/die_of_fate - multiplicative_slowdown = 1 + slowdown = 1 /datum/movespeed_modifier/berserk - multiplicative_slowdown = -0.2 + slowdown = -0.2 /datum/movespeed_modifier/sphere - multiplicative_slowdown = -0.5 + slowdown = -0.5 diff --git a/code/modules/movespeed/modifiers/misc.dm b/code/modules/movespeed/modifiers/misc.dm index e3aba912966a..6bf8bbc23a49 100644 --- a/code/modules/movespeed/modifiers/misc.dm +++ b/code/modules/movespeed/modifiers/misc.dm @@ -2,5 +2,5 @@ variable = TRUE /datum/movespeed_modifier/yellow_orb - multiplicative_slowdown = -0.65 + slowdown = -0.65 blacklisted_movetypes = (FLYING|FLOATING) diff --git a/code/modules/movespeed/modifiers/mobs.dm b/code/modules/movespeed/modifiers/mobs.dm index 50883711c836..a3fb52f9648d 100644 --- a/code/modules/movespeed/modifiers/mobs.dm +++ b/code/modules/movespeed/modifiers/mobs.dm @@ -1,5 +1,5 @@ /datum/movespeed_modifier/obesity - multiplicative_slowdown = 1.5 + slowdown = 1.5 /datum/movespeed_modifier/monkey_reagent_speedmod variable = TRUE @@ -14,27 +14,20 @@ variable = TRUE /datum/movespeed_modifier/slaughter - multiplicative_slowdown = -1 + slowdown = -1 /datum/movespeed_modifier/resonance - multiplicative_slowdown = 0.75 - -/datum/movespeed_modifier/damage_slowdown - blacklisted_movetypes = FLOATING|FLYING - variable = TRUE - -/datum/movespeed_modifier/damage_slowdown_flying - movetypes = FLYING - variable = TRUE + slowdown = 0.75 /datum/movespeed_modifier/pain + blacklisted_movetypes = FLOATING variable = TRUE /datum/movespeed_modifier/shock - multiplicative_slowdown = 3 + slowdown = 3 /datum/movespeed_modifier/asystole - multiplicative_slowdown = 10 + slowdown = 10 /datum/movespeed_modifier/equipment_speedmod variable = TRUE @@ -45,13 +38,13 @@ blacklisted_movetypes = FLOATING /datum/movespeed_modifier/grab_slowdown/aggressive - multiplicative_slowdown = 3 + slowdown = 3 /datum/movespeed_modifier/grab_slowdown/neck - multiplicative_slowdown = 6 + slowdown = 6 /datum/movespeed_modifier/grab_slowdown/kill - multiplicative_slowdown = 9 + slowdown = 9 /datum/movespeed_modifier/slime_reagentmod variable = TRUE @@ -60,7 +53,7 @@ variable = TRUE /datum/movespeed_modifier/config_walk_run - multiplicative_slowdown = 1 + slowdown = 1 id = MOVESPEED_ID_MOB_WALK_RUN flags = IGNORE_NOSLOW @@ -68,15 +61,15 @@ /datum/movespeed_modifier/config_walk_run/walk/sync() var/mod = CONFIG_GET(number/movedelay/walk_delay) - multiplicative_slowdown = isnum(mod)? mod : initial(multiplicative_slowdown) + slowdown = isnum(mod)? mod : initial(slowdown) /datum/movespeed_modifier/config_walk_run/run/sync() var/mod = CONFIG_GET(number/movedelay/run_delay) - multiplicative_slowdown = isnum(mod)? mod : initial(multiplicative_slowdown) + slowdown = isnum(mod)? mod : initial(slowdown) /datum/movespeed_modifier/config_walk_run/sprint/sync() var/mod = CONFIG_GET(number/movedelay/sprint_delay) - multiplicative_slowdown = isnum(mod) ? mod : initial(multiplicative_slowdown) + slowdown = isnum(mod) ? mod : initial(slowdown) /datum/movespeed_modifier/turf_slowdown movetypes = GROUND @@ -91,10 +84,10 @@ variable = TRUE /datum/movespeed_modifier/shove - multiplicative_slowdown = SHOVE_SLOWDOWN_STRENGTH + slowdown = SHOVE_SLOWDOWN_STRENGTH /datum/movespeed_modifier/human_carry - multiplicative_slowdown = HUMAN_CARRY_SLOWDOWN + slowdown = HUMAN_CARRY_SLOWDOWN /datum/movespeed_modifier/limbless variable = TRUE @@ -106,7 +99,7 @@ flags = IGNORE_NOSLOW /datum/movespeed_modifier/tarantula_web - multiplicative_slowdown = 5 + slowdown = 5 /datum/movespeed_modifier/gravity blacklisted_movetypes = FLOATING @@ -114,17 +107,17 @@ flags = IGNORE_NOSLOW /datum/movespeed_modifier/carbon_softcrit - multiplicative_slowdown = SOFTCRIT_ADD_SLOWDOWN + slowdown = SOFTCRIT_ADD_SLOWDOWN flags = IGNORE_NOSLOW /datum/movespeed_modifier/slime_tempmod variable = TRUE /datum/movespeed_modifier/living_exhaustion - multiplicative_slowdown = STAMINA_EXHAUSTION_MOVESPEED_SLOWDOWN + slowdown = STAMINA_EXHAUSTION_MOVESPEED_SLOWDOWN flags = IGNORE_NOSLOW /datum/movespeed_modifier/carbon_crawling - multiplicative_slowdown = CRAWLING_ADD_SLOWDOWN + slowdown = CRAWLING_ADD_SLOWDOWN flags = IGNORE_NOSLOW /datum/movespeed_modifier/mob_config_speedmod @@ -132,21 +125,21 @@ flags = IGNORE_NOSLOW /datum/movespeed_modifier/metabolicboost - multiplicative_slowdown = -1.5 + slowdown = -1.5 /datum/movespeed_modifier/dragon_rage - multiplicative_slowdown = -0.5 + slowdown = -0.5 /datum/movespeed_modifier/dragon_depression - multiplicative_slowdown = 5 + slowdown = 5 /datum/movespeed_modifier/morph_disguised - multiplicative_slowdown = 1 + slowdown = 1 /datum/movespeed_modifier/auto_wash - multiplicative_slowdown = 3 + slowdown = 3 /datum/movespeed_modifier/atmos_pressure - multiplicative_slowdown = 3 + slowdown = 3 id = MOVESPEED_ID_MOB_ATMOS_AFFLICTION variable = TRUE diff --git a/code/modules/movespeed/modifiers/reagent.dm b/code/modules/movespeed/modifiers/reagent.dm index 4c3b300f1c88..6a2c2b4ba7b3 100644 --- a/code/modules/movespeed/modifiers/reagent.dm +++ b/code/modules/movespeed/modifiers/reagent.dm @@ -2,55 +2,55 @@ blacklisted_movetypes = (FLYING|FLOATING) /datum/movespeed_modifier/reagent/stimulants - multiplicative_slowdown = -0.55 + slowdown = -0.55 /datum/movespeed_modifier/reagent/ephedrine - multiplicative_slowdown = -0.5 + slowdown = -0.5 /datum/movespeed_modifier/reagent/pepperspray - multiplicative_slowdown = 0.25 + slowdown = 0.25 /datum/movespeed_modifier/reagent/monkey_energy - multiplicative_slowdown = -0.35 + slowdown = -0.35 /datum/movespeed_modifier/reagent/changelinghaste - multiplicative_slowdown = -0.8 + slowdown = -0.8 /datum/movespeed_modifier/reagent/methamphetamine - multiplicative_slowdown = -0.25 + slowdown = -0.25 /datum/movespeed_modifier/reagent/nitrium - multiplicative_slowdown = -0.65 + slowdown = -0.65 /datum/movespeed_modifier/reagent/cannabis - multiplicative_slowdown = 0.4 + slowdown = 0.4 /datum/movespeed_modifier/reagent/freon - multiplicative_slowdown = 1.6 + slowdown = 1.6 /datum/movespeed_modifier/reagent/halon - multiplicative_slowdown = 1.8 + slowdown = 1.8 /datum/movespeed_modifier/reagent/lenturi - multiplicative_slowdown = 1.5 + slowdown = 1.5 /datum/movespeed_modifier/reagent/nuka_cola - multiplicative_slowdown = -0.35 + slowdown = -0.35 /datum/movespeed_modifier/reagent/nooartrium - multiplicative_slowdown = 2 + slowdown = 2 /datum/movespeed_modifier/inaprovaline - multiplicative_slowdown = 1.5 + slowdown = 1.5 /datum/movespeed_modifier/tramadol - multiplicative_slowdown = 1.5 + slowdown = 1.5 /datum/movespeed_modifier/morphine - multiplicative_slowdown = 1.5 + slowdown = 1.5 /datum/movespeed_modifier/hyperzine - multiplicative_slowdown = -0.4 + slowdown = -0.4 /datum/movespeed_modifier/impedrezene - multiplicative_slowdown = 2 + slowdown = 2 diff --git a/code/modules/movespeed/modifiers/status_effects.dm b/code/modules/movespeed/modifiers/status_effects.dm index 6e3a6e9056d4..0e3236442898 100644 --- a/code/modules/movespeed/modifiers/status_effects.dm +++ b/code/modules/movespeed/modifiers/status_effects.dm @@ -1,15 +1,15 @@ /datum/movespeed_modifier/status_effect/bloodchill - multiplicative_slowdown = 3 + slowdown = 3 /datum/movespeed_modifier/status_effect/bonechill - multiplicative_slowdown = 3 + slowdown = 3 /datum/movespeed_modifier/status_effect/lightpink - multiplicative_slowdown = -0.5 + slowdown = -0.5 blacklisted_movetypes = (FLYING|FLOATING) /datum/movespeed_modifier/status_effect/tarfoot - multiplicative_slowdown = 0.5 + slowdown = 0.5 blacklisted_movetypes = (FLYING|FLOATING) /datum/movespeed_modifier/status_effect/sepia @@ -17,10 +17,10 @@ blacklisted_movetypes = (FLYING|FLOATING) /datum/movespeed_modifier/status_effect/power_chord - multiplicative_slowdown = -0.2 + slowdown = -0.2 /datum/movespeed_modifier/status_effect/hazard_area - multiplicative_slowdown = 4 + slowdown = 4 /datum/movespeed_modifier/status_effect/disorient - multiplicative_slowdown = 1 + slowdown = 1 diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 5ee733f2e675..07ac1dd5183e 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -149,7 +149,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) switch(location) if(CHEM_BLOOD) if(type == M.dna?.species.exotic_blood) - M.blood_volume = min(M.blood_volume + round(volume, 0.1), BLOOD_VOLUME_MAXIMUM) + M.adjustBloodVolumeUpTo(round(volume, 0.1), BLOOD_VOLUME_MAXIMUM) holder.del_reagent(type) return else @@ -162,7 +162,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) if(CHEM_INGEST) if(type == M.dna?.species.exotic_blood) - M.blood_volume = min(M.blood_volume + round(volume/5, 0.1), BLOOD_VOLUME_MAXIMUM) + M.adjustBloodVolumeUpTo(round(volume / 5, 0.1), BLOOD_VOLUME_MAXIMUM) holder.del_reagent(type) return else diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 6e66cb2ab1f7..33329eddd94d 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1421,6 +1421,7 @@ All effects don't start immediately, but rather get worse over time; the rate is C.adjustOrganLoss(ORGAN_SLOT_BRAIN, 2 * removed, updating_health = FALSE) if(current_cycle > 50 && prob(15)) if(C.set_heartattack(TRUE)) + log_health(C, "Heart stopped due to ethanol (neurotoxin) consumption.") if(C.stat == CONSCIOUS) C.visible_message(span_userdanger("[C] clutches at [C.p_their()] chest as if [C.p_their()] heart stopped!")) . = TRUE diff --git a/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm b/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm index f101fb1c06ad..0a3fb672387f 100644 --- a/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm @@ -75,7 +75,7 @@ /datum/reagent/iron/affect_blood(mob/living/carbon/C, removed) . = ..() - C.blood_volume = min(C.blood_volume + (2 * removed), BLOOD_VOLUME_MAX_LETHAL) + C.adjustBloodVolume(2 * removed) /datum/reagent/lithium name = "Lithium" diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index d16d90ed73ad..4fc8f417a1c0 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -67,7 +67,7 @@ REMOVE_TRAITS_NOT_IN(C, list(SPECIES_TRAIT, ROUNDSTART_TRAIT, ORGAN_TRAIT)) C.reagents.remove_all_type(/datum/reagent/toxin, 2 * removed, FALSE, TRUE) if(C.blood_volume < BLOOD_VOLUME_NORMAL) - C.blood_volume = BLOOD_VOLUME_NORMAL + C.setBloodVolume(BLOOD_VOLUME_NORMAL) C.cure_all_traumas(TRAUMA_RESILIENCE_MAGIC) for(var/obj/item/organ/organ as anything in C.processing_organs) @@ -108,7 +108,7 @@ /datum/reagent/medicine/inaprovaline/affect_blood(mob/living/carbon/C, removed) APPLY_CHEM_EFFECT(C, CE_STABLE, 1) - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 10) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 30) /datum/reagent/medicine/inaprovaline/overdose_start(mob/living/carbon/C) C.add_movespeed_modifier(/datum/movespeed_modifier/inaprovaline) @@ -135,7 +135,7 @@ value = 4.9 /datum/reagent/medicine/bicaridine/affect_blood(mob/living/carbon/C, removed) - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 10) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 20) C.adjustBruteLoss(-6 * removed, updating_health = FALSE) return TRUE @@ -301,7 +301,7 @@ taste_description = "sourness" reagent_state = LIQUID color = "#cb68fc" - overdose_threshold =30 + overdose_threshold = 30 metabolization_rate = 0.05 ingest_met = 0.02 value = 3.1 @@ -396,7 +396,7 @@ C.remove_movespeed_modifier(/datum/movespeed_modifier/morphine) /datum/reagent/medicine/morphine/affect_blood(mob/living/carbon/C, removed) - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 80) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 120) C.set_timed_status_effect(4 SECONDS, /datum/status_effect/dizziness, only_if_higher = TRUE) if(prob(75)) C.drowsyness++ @@ -405,7 +405,7 @@ /datum/reagent/medicine/morphine/overdose_process(mob/living/carbon/C) C.set_timed_status_effect(4 SECONDS, /datum/status_effect/drugginess, only_if_higher = TRUE) - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 10) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 50) /datum/reagent/medicine/tramadol/oxycodone name = "Oxycodone" @@ -441,7 +441,7 @@ holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5) C.adjustToxLoss(3 * removed, updating_health = FALSE) // It used to be incredibly deadly due to an oversight. Not anymore! - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 20) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 70) APPLY_CHEM_EFFECT(C, CE_STIMULANT, 10) return TRUE @@ -480,7 +480,7 @@ value = 5.9 /datum/reagent/medicine/alkysine/affect_blood(mob/living/carbon/C, removed) - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 10) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 30) APPLY_CHEM_EFFECT(C, CE_BRAIN_REGEN, 1) C.adjustOrganLoss(ORGAN_SLOT_BRAIN, -10 * removed, updating_health = FALSE) if(ishuman(C)) @@ -605,7 +605,7 @@ if(class == CHEM_BLOOD) ADD_TRAIT(C, TRAIT_NOCRITDAMAGE, CHEM_TRAIT_SOURCE(class)) ADD_TRAIT(C, TRAIT_NOSOFTCRIT,CHEM_TRAIT_SOURCE(class)) - to_chat(C, span_danger("Energy rushes through your veins!")) + to_chat(C, span_alert("Energy rushes through your veins!")) /datum/reagent/medicine/epinephrine/on_mob_end_metabolize(mob/living/carbon/C, class) if(class == CHEM_BLOOD) @@ -617,13 +617,14 @@ APPLY_CHEM_EFFECT(C, CE_PAINKILLER, min(30*volume, 80)) APPLY_CHEM_EFFECT(C, CE_PULSE, 1) else if(volume < 1) - APPLY_CHEM_EFFECT(C, CE_PAINKILLER, min(10*volume, 20)) + APPLY_CHEM_EFFECT(C, CE_PAINKILLER, min(15*volume, 20)) APPLY_CHEM_EFFECT(C, CE_PULSE, 2) APPLY_CHEM_EFFECT(C, CE_STIMULANT, 2) if(volume >= 4 && C.undergoing_cardiac_arrest()) - holder.remove_reagent(src, 4) if(C.resuscitate()) + log_health(C, "Resuscitated due to epinephrine.") + holder.remove_reagent(type, 4) var/obj/item/organ/heart = C.getorganslot(ORGAN_SLOT_HEART) heart.applyOrganDamage(heart.maxHealth * 0.075) to_chat(C, span_userdanger("Adrenaline rushes through your body, you refuse to give up!")) @@ -689,7 +690,7 @@ metabolization_rate = 0.02 /datum/reagent/medicine/spaceacillin/affect_blood(mob/living/carbon/C, removed) - APPLY_CHEM_EFFECT(C, CE_ANTIBIOTIC, 1) + APPLY_CHEM_EFFECT(C, CE_ANTIBIOTIC, volume) /datum/reagent/medicine/haloperidol name = "Haloperidol" @@ -770,7 +771,7 @@ /datum/reagent/medicine/saline_glucose name = "Saline-Glucose" - description = "Promotes blood rejuvination in living creatures." + description = "Promotes blood rejuvenation in living creatures." reagent_state = LIQUID color = "#DCDCDC" metabolization_rate = 0.1 @@ -778,20 +779,19 @@ taste_description = "sweetness and salt" var/last_added = 0 var/maximum_reachable = BLOOD_VOLUME_NORMAL - 10 //So that normal blood regeneration can continue with salglu active - var/extra_regen = 0.25 // in addition to acting as temporary blood, also add about half this much to their actual blood per second - + /// In addition to acting as temporary blood, this much blood is fully regenerated per unit used. + var/extra_regen = 1 /datum/reagent/medicine/saline_glucose/affect_blood(mob/living/carbon/C, removed) . = ..() if(last_added) - C.blood_volume -= last_added + C.adjustBloodVolume(-last_added) last_added = 0 if(C.blood_volume < maximum_reachable) //Can only up to double your effective blood level. var/amount_to_add = min(C.blood_volume, 5*volume) - var/new_blood_level = min(C.blood_volume + amount_to_add, maximum_reachable) - last_added = new_blood_level - C.blood_volume - C.blood_volume = new_blood_level + (extra_regen * removed) + last_added = C.adjustBloodVolumeUpTo(amount_to_add + maximum_reachable) + C.adjustBloodVolume(extra_regen * removed) /datum/reagent/medicine/synthflesh name = "Synthflesh" diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index b129b28196b1..064f8e1eca8b 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -242,7 +242,7 @@ if(isnull(blood_type) || !C.dna.blood_type.is_compatible(blood_type.type)) C.reagents.add_reagent(/datum/reagent/toxin, removed) else - C.blood_volume = min(C.blood_volume + round(removed, 0.1), BLOOD_VOLUME_MAX_LETHAL) + C.adjustBloodVolume(round(removed, 0.1)) /datum/reagent/blood/affect_touch(mob/living/carbon/C, removed) for(var/datum/disease/strain as anything in data?["viruses"]) @@ -1103,13 +1103,13 @@ if(class == CHEM_BLOOD) ADD_TRAIT(C, TRAIT_SLEEPIMMUNE, type) ADD_TRAIT(C, TRAIT_STUNRESISTANCE, type) - C.add_movespeed_mod_immunities(type, /datum/movespeed_modifier/damage_slowdown) + C.add_movespeed_mod_immunities(type, /datum/movespeed_modifier/pain) /datum/reagent/medicine/changelingadrenaline/on_mob_end_metabolize(mob/living/carbon/C, class) if(class == CHEM_BLOOD) REMOVE_TRAIT(C, TRAIT_SLEEPIMMUNE, type) REMOVE_TRAIT(C, TRAIT_STUNRESISTANCE, type) - C.remove_movespeed_mod_immunities(type, /datum/movespeed_modifier/damage_slowdown) + C.remove_movespeed_mod_immunities(type, /datum/movespeed_modifier/pain) C.remove_status_effect(/datum/status_effect/dizziness) C.remove_status_effect(/datum/status_effect/jitter) @@ -1168,7 +1168,8 @@ C.adjust_drowsyness(2 * removed) if(ishuman(C)) var/mob/living/carbon/human/H = C - H.blood_volume = max(H.blood_volume - (10 * removed), 0) + H.adjustBloodVolume(-10 * removed) + if(prob(20)) C.losebreath += 2 C.adjust_timed_status_effect(2 SECONDS, /datum/status_effect/confusion, max_duration = 5 SECONDS) diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 49db897e3657..3a0077b06a27 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -710,6 +710,7 @@ . = TRUE if(3) if(C.set_heartattack(TRUE)) + log_health(C, "Heart stopped due to initropidil.") if(C.stat < UNCONSCIOUS) C.visible_message(span_userdanger("[C] clutches at [C.p_their()] chest!")) else diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index b823d3ee5a7c..e9df394cb2a4 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -668,11 +668,11 @@ /datum/status_effect/stabilized/sepia/tick() if(prob(50) && mod > -1) mod-- - owner.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/status_effect/sepia, multiplicative_slowdown = -0.5) + owner.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/status_effect/sepia, slowdown = -0.5) else if(mod < 1) mod++ // yeah a value of 0 does nothing but replacing the trait in place is cheaper than removing and adding repeatedly - owner.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/status_effect/sepia, multiplicative_slowdown = 0) + owner.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/status_effect/sepia, slowdown = 0) return ..() /datum/status_effect/stabilized/sepia/on_remove() diff --git a/code/modules/spells/spell_types/shapeshift/_shapeshift.dm b/code/modules/spells/spell_types/shapeshift/_shapeshift.dm index ff8b55013d33..637d0307b2ca 100644 --- a/code/modules/spells/spell_types/shapeshift/_shapeshift.dm +++ b/code/modules/spells/spell_types/shapeshift/_shapeshift.dm @@ -163,11 +163,11 @@ stored.forceMove(src) stored.notransform = TRUE if(source.convert_damage) - var/damage_percent = (stored.maxHealth - stored.health) / stored.maxHealth; - var/damapply = damage_percent * shape.maxHealth; + var/damage_percent = (stored.maxHealth - stored.health) / stored.maxHealth + var/damapply = damage_percent * shape.maxHealth - shape.apply_damage(damapply, source.convert_damage_type, forced = TRUE); - shape.blood_volume = stored.blood_volume; + shape.apply_damage(damapply, source.convert_damage_type, forced = TRUE) + shape.setBloodVolume(stored.blood_volume) RegisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH), PROC_REF(shape_death)) RegisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH), PROC_REF(caster_death)) @@ -234,7 +234,7 @@ stored.apply_damage(damapply, source.convert_damage_type, forced = TRUE) if(source.convert_damage) - stored.blood_volume = shape.blood_volume; + stored.setBloodVolume(shape.blood_volume) // This guard is important because restore() can also be called on COMSIG_PARENT_QDELETING for shape, as well as on death. // This can happen in, for example, [/proc/wabbajack] where the mob hit is qdel'd. diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index 7fe20c8d7f32..9c1e6a173041 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -93,8 +93,10 @@ var/brute_ratio = 0 ///The % of current_damage that is burn var/burn_ratio = 0 - /// How much pain this limb is applying. - VAR_PRIVATE/pain = 0 + /// How much pain is on this limb from wounds. + VAR_PRIVATE/wound_pain = 0 + /// How much temporary pain is on this limb + VAR_PRIVATE/temporary_pain = 0 ///The minimum damage a part must have before it's bones may break. Defaults to max_damage * BODYPART_MINIMUM_BREAK_MOD var/minimum_break_damage = 0 /// Bleed multiplier @@ -477,8 +479,10 @@ /obj/item/bodypart/proc/on_life(delta_time, times_fired, stam_heal) SHOULD_CALL_PARENT(TRUE) if(owner.stat != DEAD) - pain = max(pain - (owner.body_position == LYING_DOWN ? 3 : 1), 0) . |= wound_life() + if(temporary_pain) + temporary_pain = owner.body_position == LYING_DOWN ? max(0, temporary_pain - 3) : max(0, temporary_pain - 1) + . |= BODYPART_LIFE_UPDATE_HEALTH_HUD . |= update_germs() /obj/item/bodypart/proc/wound_life() @@ -495,6 +499,7 @@ // wounds can disappear after 10 minutes at the earliest if(W.damage <= 0 && W.created + (10 MINUTES) <= world.time) qdel(W) + stack_trace("Wound with zero health collected") continue // let the GC handle the deletion of the wound @@ -576,14 +581,12 @@ return update_damage() || . #endif + if(can_break_bones || can_jostle_bones) + brute -= damage_internal_organs(round(brute/2, DAMAGE_PRECISION), null, sharpness) // Absorb some brute damage + burn -= damage_internal_organs(null, round(burn/2, DAMAGE_PRECISION)) //blunt damage is gud at fracturing if(brute && (can_break_bones || can_jostle_bones)) - if(LAZYLEN(contained_organs)) - brute -= damage_internal_organs(round(brute/2, DAMAGE_PRECISION), null, sharpness) // Absorb some brute damage - if(!IS_ORGANIC_LIMB(src)) - burn -= damage_internal_organs(null, round(burn/2, DAMAGE_PRECISION)) - if((bodypart_flags & BP_BROKEN_BONES) && can_jostle_bones) jostle_bones(brute) else if(can_break_bones && (brute_dam + brute > minimum_break_damage) && prob((brute_dam + brute * (1 + !sharpness)) * BODYPART_BONES_BREAK_CHANCE_MOD)) @@ -612,7 +615,9 @@ create_wound(WOUND_BURN, burn, update_damage = FALSE) //Initial pain spike - owner?.apply_pain(0.8*burn + 0.6*brute, body_zone, updating_health = FALSE) + if(owner) + var/pain_reduction = CHEM_EFFECT_MAGNITUDE(owner, CE_PAINKILLER) / length(owner.bodyparts) + owner?.notify_pain(getPain() - pain_reduction) if(owner && total > 15 && prob(total*4) && !(bodypart_flags & BP_NO_PAIN)) owner.bloodstream.add_reagent(/datum/reagent/medicine/epinephrine, round(total/10)) @@ -628,7 +633,7 @@ if(disturbed) to_chat(owner, span_warning("Ow! Your burns were disturbed.")) - owner.apply_pain(0.5*burn, body_zone, updating_health = FALSE) + owner.apply_pain(0.2*burn, body_zone, updating_health = FALSE) if(owner && can_break_bones && istype(src, /obj/item/bodypart/head) && (bodypart_flags & BP_HAS_BLOOD) && sharpness == NONE && (owner.stat == CONSCIOUS) && owner.has_mouth()) if(prob(8) && owner.bleed(5)) @@ -757,9 +762,12 @@ /obj/item/bodypart/proc/update_damage() var/old_brute = brute_dam var/old_burn = burn_dam + var/old_pain = wound_pain + real_wound_count = 0 brute_dam = 0 burn_dam = 0 + wound_pain = 0 //update damage counts for(var/datum/wound/W as anything in wounds) @@ -772,12 +780,16 @@ else brute_dam += W.damage + wound_pain += W.damage * W.pain_factor real_wound_count += W.amount current_damage = round(brute_dam + burn_dam, DAMAGE_PRECISION) burn_dam = round(burn_dam, DAMAGE_PRECISION) brute_dam = round(brute_dam, DAMAGE_PRECISION) + wound_pain = min(round(wound_pain, DAMAGE_PRECISION), max_damage) + var/limb_loss_threshold = max_damage + brute_ratio = brute_dam / (limb_loss_threshold * 2) burn_ratio = burn_dam / (limb_loss_threshold * 2) @@ -791,6 +803,9 @@ if(old_brute != brute_dam || old_burn != burn_dam) . |= BODYPART_LIFE_UPDATE_HEALTH + if(old_pain != wound_pain) + . |= BODYPART_LIFE_UPDATE_HEALTH_HUD + if(.) refresh_bleed_rate() diff --git a/code/modules/surgery/bodyparts/germs_bodypart.dm b/code/modules/surgery/bodyparts/germs_bodypart.dm index eb86bfc515fe..156099a7ce15 100644 --- a/code/modules/surgery/bodyparts/germs_bodypart.dm +++ b/code/modules/surgery/bodyparts/germs_bodypart.dm @@ -18,36 +18,41 @@ INFECTION_LEVEL_THREE above this germ level the player will take additional toxi Note that amputating the affected organ does in fact remove the infection from the player's body. */ /obj/item/bodypart/proc/update_germs() - if(!IS_ORGANIC_LIMB(src)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs. germ_level = 0 return if(owner.bodytemperature > TCRYO) //cryo stops germs from moving and doing their bad stuffs - if(!CHEM_EFFECT_MAGNITUDE(owner, CE_ANTIBIOTIC)) - // Syncing germ levels with external wounds - handle_germ_sync() + // Syncing germ levels with external wounds + handle_germ_sync() + if(germ_level && CHEM_EFFECT_MAGNITUDE(owner, CE_ANTIBIOTIC)) // Handle antibiotics and curing infections handle_antibiotics() - // Handle the effects of infections - . = handle_germ_effects() + if(germ_level) + // Handle the effects of infections + . = handle_germ_effects() /// Syncing germ levels with external wounds /obj/item/bodypart/proc/handle_germ_sync() + if(!length(wounds)) + return + + // Infection can occur even while on anti biotics for(var/datum/wound/W as anything in wounds) - //Open wounds can become infected if((2*owner.germ_level > W.germ_level) && W.infection_check()) W.germ_level++ - if (W.germ_level > germ_level || prob(min(W.germ_level, 30))) - germ_level++ + + if(!CHEM_EFFECT_MAGNITUDE(owner, CE_ANTIBIOTIC)) + // Spread germs from wounds to bodypart + for(var/datum/wound/W as anything in wounds) + if (W.germ_level > germ_level || prob(min(W.germ_level, 30))) + germ_level++ + break // max 1 germ per cycle /// Handle antibiotics and curing infections /obj/item/bodypart/proc/handle_antibiotics() - if(!germ_level) - return - if (germ_level < INFECTION_LEVEL_ONE) germ_level = 0 //cure instantly else if (germ_level < INFECTION_LEVEL_TWO) @@ -60,7 +65,7 @@ Note that amputating the affected organ does in fact remove the infection from t /// Handle the effects of infections /obj/item/bodypart/proc/handle_germ_effects() - var/antibiotics = owner.reagents.get_reagent_amount(/datum/reagent/medicine/spaceacillin) + var/antibiotics = CHEM_EFFECT_MAGNITUDE(owner, CE_ANTIBIOTIC) //** Handle the effects of infections if(germ_level < INFECTION_LEVEL_TWO) if(isnull(owner) || owner.stat != DEAD) @@ -123,4 +128,5 @@ Note that amputating the affected organ does in fact remove the infection from t update_disabled() germ_level++ - return owner.adjustToxLoss(1, FALSE) + if(owner.adjustToxLoss(1, FALSE)) + return BODYPART_LIFE_UPDATE_HEALTH diff --git a/code/modules/surgery/bodyparts/injuries.dm b/code/modules/surgery/bodyparts/injuries.dm index 7b4edb5eaf73..f3ea04f954f2 100644 --- a/code/modules/surgery/bodyparts/injuries.dm +++ b/code/modules/surgery/bodyparts/injuries.dm @@ -126,7 +126,7 @@ O.applyOrganDamage(rand(3,5)) if(owner) - owner.apply_pain(50, body_zone, "You feel something moving in your [plaintext_zone]!") + owner.notify_pain(max_damage * BROKEN_BONE_PAIN_FACTOR, "You feel something moving in your [plaintext_zone]!", TRUE) /// Updates the interaction speed modifier of this limb, used by Limping and similar to determine delay. /obj/item/bodypart/proc/update_interaction_speed() @@ -200,7 +200,7 @@ if(val) bodypart_flags |= BP_DISLOCATED if(!painless) - owner?.apply_pain(20, body_zone, "A surge of pain shoots through your [plaintext_zone].") + owner?.apply_pain(max_damage * DISLOCATED_LIMB_PAIN_FACTOR, body_zone, "A surge of pain shoots through your [plaintext_zone].") else bodypart_flags &= BP_DISLOCATED diff --git a/code/modules/surgery/bodyparts/pain.dm b/code/modules/surgery/bodyparts/pain.dm index 2da6993e59fd..f3af3be7cdaf 100644 --- a/code/modules/surgery/bodyparts/pain.dm +++ b/code/modules/surgery/bodyparts/pain.dm @@ -3,9 +3,9 @@ if(bodypart_flags & BP_NO_PAIN) return - var/last_pain = pain - pain = clamp(pain + amount, 0, max_damage) - return pain - last_pain + var/last_pain = temporary_pain + temporary_pain = clamp(temporary_pain + amount, 0, max_damage) + return temporary_pain - last_pain /// Returns the amount of pain this bodypart is contributing /obj/item/bodypart/proc/getPain() @@ -14,10 +14,10 @@ var/lasting_pain = 0 if(bodypart_flags & BP_BROKEN_BONES) - lasting_pain += 10 + lasting_pain += max_damage * BROKEN_BONE_PAIN_FACTOR - else if(bodypart_flags & BP_DISLOCATED) - lasting_pain += 5 + if(bodypart_flags & BP_DISLOCATED) + lasting_pain += max_damage * DISLOCATED_LIMB_PAIN_FACTOR var/organ_dam = 0 for(var/obj/item/organ/O as anything in contained_organs) @@ -26,4 +26,4 @@ organ_dam += min(O.damage, O.maxHealth) - return pain + lasting_pain + (0.7 * brute_dam) + (0.8 * burn_dam) + (0.3 * organ_dam) + return min(wound_pain + temporary_pain + lasting_pain + (0.3 * organ_dam), max_damage) diff --git a/code/modules/surgery/bodyparts/wounds/_wounds.dm b/code/modules/surgery/bodyparts/wounds/_wounds.dm index a4db60d05aa0..5efed5214ce0 100644 --- a/code/modules/surgery/bodyparts/wounds/_wounds.dm +++ b/code/modules/surgery/bodyparts/wounds/_wounds.dm @@ -6,6 +6,7 @@ ///The bodypart this wound is on var/obj/item/bodypart/parent + var/pain_factor = 0 ///Number representing the current stage var/current_stage = 0 ///Description of the wound. diff --git a/code/modules/surgery/bodyparts/wounds/bruises.dm b/code/modules/surgery/bodyparts/wounds/bruises.dm index d08d468b6f33..096667d6944e 100644 --- a/code/modules/surgery/bodyparts/wounds/bruises.dm +++ b/code/modules/surgery/bodyparts/wounds/bruises.dm @@ -1,5 +1,6 @@ /** BRUISES **/ /datum/wound/bruise + pain_factor = 1.25 stages = list( "monumental bruise" = 80, "huge bruise" = 50, diff --git a/code/modules/surgery/bodyparts/wounds/burns.dm b/code/modules/surgery/bodyparts/wounds/burns.dm index 517b5ed3fd6b..30b853abfcb1 100644 --- a/code/modules/surgery/bodyparts/wounds/burns.dm +++ b/code/modules/surgery/bodyparts/wounds/burns.dm @@ -1,5 +1,6 @@ /** BURNS **/ /datum/wound/burn + pain_factor = 1.875 wound_type = WOUND_BURN max_bleeding_stage = 0 diff --git a/code/modules/surgery/bodyparts/wounds/create_wound.dm b/code/modules/surgery/bodyparts/wounds/create_wound.dm index 592a9a2e2b9f..ba7a25dcf748 100644 --- a/code/modules/surgery/bodyparts/wounds/create_wound.dm +++ b/code/modules/surgery/bodyparts/wounds/create_wound.dm @@ -28,8 +28,8 @@ fluid_loss_severity = FLUIDLOSS_BURN_WIDE if (WOUND_LASER) fluid_loss_severity = FLUIDLOSS_BURN_CONCENTRATED - var/fluid_loss = (damage/(owner.maxHealth)) * BLOOD_VOLUME_NORMAL * fluid_loss_severity - owner.bleed(fluid_loss) + var/fluid_loss = (damage / (owner.maxHealth)) * BLOOD_VOLUME_NORMAL * fluid_loss_severity + owner.adjustBloodVolume(-fluid_loss) //Check whether we can widen an existing wound if(!surgical && LAZYLEN(wounds) && prob(max(50+(real_wound_count-1)*10,90))) diff --git a/code/modules/surgery/bodyparts/wounds/cuts.dm b/code/modules/surgery/bodyparts/wounds/cuts.dm index 7ba6570c6f7d..b81691bc3879 100644 --- a/code/modules/surgery/bodyparts/wounds/cuts.dm +++ b/code/modules/surgery/bodyparts/wounds/cuts.dm @@ -1,5 +1,6 @@ /** CUTS **/ /datum/wound/cut + pain_factor = 1.25 bleed_threshold = 5 wound_type = WOUND_CUT diff --git a/code/modules/surgery/bodyparts/wounds/punctures.dm b/code/modules/surgery/bodyparts/wounds/punctures.dm index 4982ea87b2fd..7c924b133505 100644 --- a/code/modules/surgery/bodyparts/wounds/punctures.dm +++ b/code/modules/surgery/bodyparts/wounds/punctures.dm @@ -1,5 +1,6 @@ /** PUNCTURES **/ /datum/wound/puncture + pain_factor = 1.25 bleed_threshold = 10 wound_type = WOUND_PIERCE diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 14385c9b71e2..8fd9d52e2046 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -108,9 +108,10 @@ var/mob/living/carbon/human/human_owner = owner if(!istype(human_owner)) return - human_owner.set_heartattack(FALSE) - if(human_owner.stat == CONSCIOUS) - to_chat(human_owner, span_notice("You feel your heart beating again!")) + if(human_owner.resuscitate()) + log_health(human_owner, "Heart restarted due to reviver implant.") + if(human_owner.stat == CONSCIOUS) + to_chat(human_owner, span_notice("You feel your heart beating again!")) /obj/item/organ/cyberimp/chest/thrusters diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index 575acdf9e39a..d9b07e2cd7df 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -34,6 +34,9 @@ /// Data containing information about a pump that just occured. var/list/external_pump + /// A grace period applied upon being resuscitated, so bad RNG wont immediately stop the heart. + COOLDOWN_DECLARE(arrhythmia_grace_period) + /obj/item/organ/heart/update_icon_state() icon_state = "[base_icon_state]-[pulse ? "on" : "off"]" return ..() @@ -104,15 +107,15 @@ . = TRUE // Now pulse mod is impacted by shock stage and other things too - if(owner.shock_stage > 30) + if(owner.shock_stage > SHOCK_TIER_2) pulse_mod++ - if(owner.shock_stage > 80) + if(owner.shock_stage > SHOCK_TIER_5) pulse_mod++ - var/oxy = owner.get_blood_oxygenation() - if(oxy < BLOOD_CIRC_BAD + 10) //brain wants us to get MOAR OXY + var/blood_oxygenation = owner.get_blood_oxygenation() + if(blood_oxygenation < BLOOD_CIRC_BAD + 10) //brain wants us to get MOAR OXY pulse_mod++ - if(oxy < BLOOD_CIRC_BAD) //MOAR + if(blood_oxygenation < BLOOD_CIRC_BAD) //MOAR pulse_mod++ //If heart is stopped, it isn't going to restart itself randomly. @@ -120,12 +123,29 @@ return else if(can_heartattack)//and if it's beating, let's see if it should - var/should_stop = prob(80) && owner.get_blood_circulation() < BLOOD_CIRC_SURVIVE //cardiovascular shock, not enough liquid to pump - should_stop ||= prob(max(0, owner.getBrainLoss() - owner.maxHealth * 0.75)) //brain failing to work heart properly - should_stop ||= (prob(5) && pulse == PULSE_THREADY) //erratic heart patterns, usually caused by oxyloss - if(should_stop) // The heart has stopped due to going into traumatic or cardiovascular shock. + // Cardiovascular shock, not enough liquid to pump + var/blood_circulation = owner.get_blood_circulation() + var/should_stop = prob(80) && (blood_circulation < BLOOD_CIRC_SURVIVE) + if(should_stop) + log_health(owner, "Heart stopped due to poor blood circulation: [blood_circulation]%") + + // Severe brain damage, unable to operate the heart. + if(!should_stop) + var/brainloss_stop_chance = max(0, owner.getBrainLoss() - owner.maxHealth * 0.75) + should_stop = prob(brainloss_stop_chance) + if(should_stop) + log_health(owner, "Heart stopped due to brain damage: [brainloss_stop_chance]% chance. ") + + // Erratic heart patterns, usually caused by oxyloss. + if(!should_stop && COOLDOWN_FINISHED(src, arrhythmia_grace_period)) + should_stop = (prob(5) && pulse == PULSE_THREADY) + if(should_stop) + log_health(owner, "Heart stopped due to cardiac arrhythmia. Oxyloss: [owner.getOxyLoss()]") + + // The heart has stopped due to going into traumatic or cardiovascular shock. + if(should_stop) if(owner.stat != DEAD) - to_chat(owner, span_danger("Your heart has stopped!")) + to_chat(owner, span_alert("Your heart has stopped.")) if(pulse != NONE) Stop() return @@ -137,9 +157,9 @@ pulse = clamp(PULSE_NORM + pulse_mod, PULSE_SLOW, PULSE_THREADY) // If fibrillation, then it can be PULSE_THREADY - var/fibrillation = oxy <= BLOOD_CIRC_SURVIVE || (prob(30) && owner.shock_stage > 120) + var/fibrillation = blood_oxygenation <= BLOOD_CIRC_SURVIVE || (prob(30) && SHOCK_AMT_FOR_FIBRILLATION > 120) - if(pulse && fibrillation) //I SAID MOAR OXYGEN + if(pulse && fibrillation) //I SAID MOAR OXYGEN pulse = PULSE_THREADY // Stablising chemicals pull the heartbeat towards the center diff --git a/code/modules/surgery/organs/liver.dm b/code/modules/surgery/organs/liver.dm index 8e1ddd1113b6..c41e3869d295 100755 --- a/code/modules/surgery/organs/liver.dm +++ b/code/modules/surgery/organs/liver.dm @@ -125,7 +125,7 @@ if(owner.blood_volume < BLOOD_VOLUME_NORMAL) if(!HAS_TRAIT(owner, TRAIT_NOHUNGER)) owner.adjust_nutrition(-0.1 * HUNGER_DECAY) - owner.blood_volume = min(owner.blood_volume + 0.1, BLOOD_VOLUME_NORMAL) + owner.adjustBloodVolumeUpTo(0.1, BLOOD_VOLUME_NORMAL) //We got it covered in on_life() with more detailed thing /obj/item/organ/liver/handle_regeneration() diff --git a/code/modules/surgery/organs/stomach/_stomach.dm b/code/modules/surgery/organs/stomach/_stomach.dm index b4d019192e86..b448c45fb9a0 100644 --- a/code/modules/surgery/organs/stomach/_stomach.dm +++ b/code/modules/surgery/organs/stomach/_stomach.dm @@ -186,7 +186,7 @@ /obj/item/organ/stomach/proc/handle_hunger_slowdown(mob/living/carbon/human/human) var/hungry = (500 - human.nutrition) / 5 //So overeat would be 100 and default level would be 80 if(hungry >= 70) - human.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/hunger, multiplicative_slowdown = (hungry / 50)) + human.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/hunger, slowdown = (hungry / 50)) else human.remove_movespeed_modifier(/datum/movespeed_modifier/hunger) diff --git a/code/modules/surgery/organs/stomach/stomach_ethereal.dm b/code/modules/surgery/organs/stomach/stomach_ethereal.dm index 51ceab30a26e..809ec912c3f6 100644 --- a/code/modules/surgery/organs/stomach/stomach_ethereal.dm +++ b/code/modules/surgery/organs/stomach/stomach_ethereal.dm @@ -32,7 +32,7 @@ return ..() /obj/item/organ/stomach/ethereal/handle_hunger_slowdown(mob/living/carbon/human/human) - human.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/hunger, multiplicative_slowdown = (1.5 * (1 - crystal_charge / 100))) + human.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/hunger, slowdown = (1.5 * (1 - crystal_charge / 100))) /obj/item/organ/stomach/ethereal/proc/charge(datum/source, amount, repairs) SIGNAL_HANDLER