From c2c371de63137e72c745d426ddc596646e06d890 Mon Sep 17 00:00:00 2001 From: X0-11 Date: Thu, 29 Feb 2024 12:51:20 +0000 Subject: [PATCH] tweaks how slowdown applies to humanmobs --- code/__defines/mobs.dm | 2 ++ .../mob/living/carbon/human/human_movement.dm | 13 +++++++++---- code/modules/mob/mob.dm | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 4d02300401276..635b7e47a1cb9 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -262,3 +262,5 @@ #define SUPPRESSION_SCREAM_CHANCE 5 #define SUPPRESSION_SHAKE_CHANCE 10 #define SCREAM_COOLDOWN 1.5 SECOND +#define HEALTHDEFICIENCY_THRESHOLD 0.2 //20% health loss before we start feeling any sort of slowdown. +#define HEALTHDEFICIENCY_HPLOSS_ONEPOINTSLOWDOWN_MOD 0.175 //17.5% hp loss per slowdown point \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 8273db0139b57..0dff13e25855a 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -20,7 +20,8 @@ handle_embedded_and_stomach_objects() //Moving with objects stuck in you can cause bad times. var/health_deficiency = (maxHealth - health) - if(health_deficiency >= 40) tally += (health_deficiency / 35) + //20% health loss, then we start giving slowdown. + if(health_deficiency >= (maxHealth*HEALTHDEFICIENCY_THRESHOLD)) tally += (health_deficiency / (maxHealth * HEALTHDEFICIENCY_HPLOSS_ONEPOINTSLOWDOWN_MOD)) if(can_feel_pain()) if(get_shock() >= 20) tally += (get_shock() / 30) //halloss shouldn't slow you down if you can't even feel it @@ -44,7 +45,8 @@ if(ignore_equipment_threshold && equipment_slowdown > ignore_equipment_threshold) equipment_slowdown -= ignore_equipment_threshold - equipment_slowdown *= species.equipment_slowdown_multiplier + if(equipment_slowdown > 0) //Only use our modifier if it's actually slowing us down. Speedups are unmodded. + equipment_slowdown *= species.equipment_slowdown_multiplier tally += equipment_slowdown @@ -61,10 +63,13 @@ if(aiming && aiming.aiming_at) tally += 5 // Iron sights make you slower, it's a well-known fact. + var/species_coldtemp = 283.222 + if(species) + species_coldtemp = species.cold_discomfort_level if(FAT in src.mutations) tally += 1.5 - if (bodytemperature < 283.222) - tally += (283.222 - bodytemperature) / 10 * 1.75 + if (bodytemperature < species_coldtemp) + tally += (species_coldtemp - bodytemperature) / 10 * 1.75 tally += max(2 * stance_damage, 0) //damaged/missing feet or legs is slow diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index b21468d2c315d..337146d222ab0 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -145,9 +145,9 @@ /mob/proc/movement_delay() . = 0 - if(istype(loc, /turf)) - var/turf/T = loc - . += T.movement_delay + var/turf/T = get_turf(src) + if(src.elevation == T.elevation) + . += T.get_movement_delay() . += currently_firing if(pulling)