diff --git a/code/datums/components/armor/_armor.dm b/code/datums/components/armor/_armor.dm index 74b21bac2d9..7b64d9f6502 100644 --- a/code/datums/components/armor/_armor.dm +++ b/code/datums/components/armor/_armor.dm @@ -30,10 +30,11 @@ armor_flags = armor_type if(hidden) hidden = TRUE - -// Takes in incoming damage value -// Applies state changes to self, holder, and whatever else caused by damage mitigation -// Returns modified damage, a list to allow for flag modification or damage conversion, in the same format as the arguments. +/** + * Takes in incoming damage value + * Applies state changes to self, holder, and whatever else caused by damage mitigation + * Returns modified damage, a list to allow for flag modification or damage conversion, in the same format as the arguments. + */ /datum/component/armor/proc/apply_damage_modifications(damage, damage_type, damage_flags, mob/living/victim, armor_pen, silent = FALSE) if(armor_flags & ARMOR_TYPE_EXOSUIT) if(prob(get_blocked(damage_type, damage_flags, armor_pen) * 100)) //extra removal of sharp and edge on account of us being big robots @@ -42,7 +43,6 @@ if(damage <= 0) return args.Copy() - var/blocked = get_blocked(damage_type, damage_flags, armor_pen, damage) on_blocking(damage, damage_type, damage_flags, armor_pen, blocked) @@ -66,7 +66,14 @@ /datum/component/armor/proc/on_blocking(damage, damage_type, damage_flags, armor_pen, blocked) -// A simpler proc used as a helper for above but can also be used externally. Does not modify state. +/** + * A simpler proc used as a helper for above but can also be used externally. Does not modify state. + * Returns a value between 0 and 1, representing the percentage of damage blocked by this armor component. + * armor_pen is subtracted from the armor value before calculating the percentage blocked. + * armor_range_mult is used to determine the range of damage that is mitigated by this armor + * under_armor_mult is used to determine how much damage is mitigated when the incoming damage is less than or equal to the armor value + * over_armor_mult is used to determine how much damage is mitigated when the incoming damage is greater than the armor value + */ /datum/component/armor/proc/get_blocked(damage_type, damage_flags, armor_pen = 0, damage = 5) var/key = get_armor_key(damage_type, damage_flags) if(!key) diff --git a/code/modules/heavy_vehicle/components/body.dm b/code/modules/heavy_vehicle/components/body.dm index ec8d2ea0430..60f9077739b 100644 --- a/code/modules/heavy_vehicle/components/body.dm +++ b/code/modules/heavy_vehicle/components/body.dm @@ -30,6 +30,13 @@ var/pilot_coverage = 100 var/transparent_cabin = FALSE var/hide_pilot = TRUE + ///Percentage chance for a projectile to hit the pilot if the hatch is open or penetrated. 100% means the pilot will always be hit, 0% means the pilot will never be hit. Side hits divide this value by 4. + var/cockpit_hatch_size = 80 + ///Multiplier for damage dealt to the pilot when hit by projectiles that penetrate the mech's cockpit. + var/cockpit_pilot_damage_multiplier = 0.5 + ///Multiplier for armour piercing value of a hit to the pilot when hit by projectiles that penetrate the mech's cockpit. + var/cockpit_pilot_armour_piercing_multiplier = 0.5 + has_hardpoints = list(HARDPOINT_BACK, HARDPOINT_LEFT_SHOULDER, HARDPOINT_RIGHT_SHOULDER) /** @@ -70,6 +77,12 @@ QDEL_NULL(air_supply) . = ..() +/obj/item/mech_component/chassis/mechanics_hints(mob/user, distance, is_adjacent) + . = ..() + . += SPAN_NOTICE("This chasis covers [pilot_coverage]% of the pilot's body.") + . += SPAN_NOTICE("When open or destroyed the cockpit hatch will allow [cockpit_hatch_size]% of incoming attacks to hit the pilot.") + . += SPAN_NOTICE("When closed but destroyed the cockpit hatch will reduce damage to the pilot by [round((1 - cockpit_pilot_damage_multiplier) * 100, 0.1)]%.") + /obj/item/mech_component/chassis/get_missing_parts_text() . = ..() diff --git a/code/modules/heavy_vehicle/mech_damage.dm b/code/modules/heavy_vehicle/mech_damage.dm index 22cdc53ceb6..da448864b99 100644 --- a/code/modules/heavy_vehicle/mech_damage.dm +++ b/code/modules/heavy_vehicle/mech_damage.dm @@ -17,10 +17,10 @@ if(!hatch_closed) //Open hatches only expose the pilot to attacks from the front and a little bit from the sides. if(incoming_attack_direction) if (dir & incoming_attack_direction) - if(prob(80)) //80% chance to hit the pilot from the front if the hatch is open. If this is 100% turrets will shoot mechs with open hatches forever. + if(prob(body.cockpit_hatch_size)) //80% chance to hit the pilot from the front if the hatch is open. If this is 100% turrets will shoot mechs with open hatches forever. return TRUE if ((turn(dir, 90) & incoming_attack_direction) || (turn(dir, -90) & incoming_attack_direction)) - if(prob(20)) //20% chance to hit the pilot from the sides if the hatch is open. + if(prob(body.cockpit_hatch_size / 4)) //20% chance to hit the pilot from the sides if the hatch is open. return TRUE return FALSE @@ -120,8 +120,9 @@ if(target == body && body.damage_state == MECH_COMPONENT_DAMAGE_DAMAGED_TOTAL) //If the cockpit is destroyed, subsequent damage is applied to the pilot, modified by the mech's armour. if(body && LAZYLEN(pilots)) var/mob/living/pilot = pick(pilots) - visible_message(SPAN_DANGER("\The [used_weapon] pierces the mangled cockpit of \the [src], striking the pilot inside!")) - pilot.apply_damage(damage, damagetype, def_zone, used_weapon, damage_flags, armor_pen, silent = FALSE) + if(prob(body.cockpit_hatch_size)) + visible_message(SPAN_DANGER("\The [used_weapon] pierces the mangled cockpit of \the [src], striking the pilot inside!")) + pilot.apply_damage(damage * body.cockpit_pilot_damage_multiplier, damagetype, def_zone, used_weapon, damage_flags, armor_pen * body.cockpit_pilot_armour_piercing_multiplier, silent = FALSE) //Only 2 types of damage concern mechs and vehicles switch(damagetype) diff --git a/code/modules/heavy_vehicle/premade/combat.dm b/code/modules/heavy_vehicle/premade/combat.dm index 34d63c61d2c..2b55d832ae0 100644 --- a/code/modules/heavy_vehicle/premade/combat.dm +++ b/code/modules/heavy_vehicle/premade/combat.dm @@ -57,6 +57,8 @@ name = "sealed exosuit chassis" hatch_descriptor = "canopy" pilot_coverage = 100 + cockpit_hatch_size = 60 + cockpit_pilot_damage_multiplier = 0.4 exosuit_desc_string = "an armored chassis" desc = "A lightweight composite frame keeps the armor of this chassis respectable, but the interior spacious." icon_state = "combat_body" diff --git a/code/modules/heavy_vehicle/premade/cult.dm b/code/modules/heavy_vehicle/premade/cult.dm index 7a168930d53..a045fafcdfb 100644 --- a/code/modules/heavy_vehicle/premade/cult.dm +++ b/code/modules/heavy_vehicle/premade/cult.dm @@ -61,6 +61,8 @@ desc = "Despite its looks, this protective chassis provides supreme comfort to its pilot during their conquest." hatch_descriptor = "bloodied ribcage" pilot_coverage = 100 + cockpit_hatch_size = 60 + cockpit_pilot_damage_multiplier = 0.4 exosuit_desc_string = "a bloodied chassis" icon_state = "cult_body" max_damage = 150 diff --git a/code/modules/heavy_vehicle/premade/heavy.dm b/code/modules/heavy_vehicle/premade/heavy.dm index 43590de0fb2..2b5c3f7fe62 100644 --- a/code/modules/heavy_vehicle/premade/heavy.dm +++ b/code/modules/heavy_vehicle/premade/heavy.dm @@ -53,6 +53,8 @@ hatch_descriptor = "hatch" desc = "The HI-Koloss chassis is a veritable juggernaut, capable of protecting a pilot even in the most hostile of environments. It handles like a battlecruiser, however." pilot_coverage = 100 + cockpit_hatch_size = 70 + cockpit_pilot_damage_multiplier = 0.3 exosuit_desc_string = "a heavily armored chassis" icon_state = "heavy_body" max_damage = 300 diff --git a/code/modules/heavy_vehicle/premade/light.dm b/code/modules/heavy_vehicle/premade/light.dm index 3480f1d8b6c..8a3c71c1ead 100644 --- a/code/modules/heavy_vehicle/premade/light.dm +++ b/code/modules/heavy_vehicle/premade/light.dm @@ -53,6 +53,8 @@ /obj/item/mech_component/chassis/light name = "light exosuit chassis" pilot_coverage = 100 + cockpit_hatch_size = 50 + cockpit_pilot_damage_multiplier = 0.8 transparent_cabin = TRUE hatch_descriptor = "canopy" exosuit_desc_string = "an open and light chassis" diff --git a/code/modules/heavy_vehicle/premade/military.dm b/code/modules/heavy_vehicle/premade/military.dm index 46943b76fc5..614a88017d9 100644 --- a/code/modules/heavy_vehicle/premade/military.dm +++ b/code/modules/heavy_vehicle/premade/military.dm @@ -40,6 +40,8 @@ hatch_descriptor = "hatch" desc = "A cramped compartment and a senseless amount of armor is all this steel coffin contains." pilot_coverage = 100 + cockpit_hatch_size = 60 + cockpit_pilot_damage_multiplier = 0.2 exosuit_desc_string = "a heavily armored chassis" icon_state = "strider_body" max_damage = 750 diff --git a/code/modules/heavy_vehicle/premade/powerloader.dm b/code/modules/heavy_vehicle/premade/powerloader.dm index 1d444a47a19..598c0f8cbc4 100644 --- a/code/modules/heavy_vehicle/premade/powerloader.dm +++ b/code/modules/heavy_vehicle/premade/powerloader.dm @@ -75,6 +75,8 @@ name = "open exosuit chassis" hatch_descriptor = "roll cage" pilot_coverage = 40 + cockpit_hatch_size = 90 + cockpit_pilot_damage_multiplier = 0.6 ///The hatch is thick, but the pilot coverage is poor. exosuit_desc_string = "an industrial rollcage" desc = "A Xion industrial brand roll cage. Technically OSHA compliant. Technically. This variant has an extra compartment for a copilot, but has no sealed atmosphere." max_damage = 200 diff --git a/code/modules/heavy_vehicle/premade/pra.dm b/code/modules/heavy_vehicle/premade/pra.dm index f724850bcdb..d04a3e46d10 100644 --- a/code/modules/heavy_vehicle/premade/pra.dm +++ b/code/modules/heavy_vehicle/premade/pra.dm @@ -54,6 +54,8 @@ name = "\improper P'kus-3 chassis" hatch_descriptor = "canopy" pilot_coverage = 100 + cockpit_hatch_size = 70 + cockpit_pilot_damage_multiplier = 0.8 exosuit_desc_string = "a light armored chassis" desc = "A lightweight composite frame keeps the armor of this chassis respectable, but the interior spacious." icon_state = "egg_body" @@ -97,6 +99,8 @@ icon_state = "strong_egg_body" max_damage = 150 power_use = 250 + cockpit_hatch_size = 40 + cockpit_pilot_damage_multiplier = 0.5 cell_type = /obj/item/cell/mecha/nuclear diff --git a/html/changelogs/Fenodyree-NerfPilotDamage.yml b/html/changelogs/Fenodyree-NerfPilotDamage.yml new file mode 100644 index 00000000000..14b80c33f18 --- /dev/null +++ b/html/changelogs/Fenodyree-NerfPilotDamage.yml @@ -0,0 +1,7 @@ +author: Fenodyree + +delete-after: True + +changes: + - balance: "Reduces the damage and armour penetration of shots hitting the mech pilot after going through the hatch. The amount depends on the mech's cockpit design. Values range between 30% and 80% of the original damage and armour penetration." +