From 85f5eadf159d125e0817c507969ede8daae20642 Mon Sep 17 00:00:00 2001 From: Erika Fox <94164348+Erikafox@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:47:31 -0500 Subject: [PATCH] Weighs misfire chances + sanitizes code (#4120) ## About The Pull Request weighs misfire bodyzone chances ## Why It's Good For The Game more mechanically interesting than #4119. more mechanically interesting than prior system ## Changelog :cl: balance: misfire targetting is now weighed towards the legs /:cl: --- code/modules/projectiles/gun.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 2a9e975bc158..c387cc88b081 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -1011,15 +1011,16 @@ human_holder = src for(var/obj/item/gun/at_risk in get_all_contents()) var/chance_to_fire = round(GUN_NO_SAFETY_MALFUNCTION_CHANCE_MEDIUM * at_risk.safety_multiplier) + var/bodyzone = pick_weight(list(BODY_ZONE_HEAD = 1, BODY_ZONE_CHEST = 9, BODY_ZONE_L_ARM = 4, BODY_ZONE_R_ARM = 4, BODY_ZONE_L_LEG = 41, BODY_ZONE_R_LEG = 41)) if(human_holder) // gun is less likely to go off in a holster if(at_risk == human_holder.s_store) chance_to_fire = round(GUN_NO_SAFETY_MALFUNCTION_CHANCE_LOW * at_risk.safety_multiplier) + bodyzone = pick_weight(list(BODY_ZONE_CHEST = 10, BODY_ZONE_L_LEG = 45, BODY_ZONE_R_LEG = 45)) if(at_risk.safety == FALSE && prob(chance_to_fire)) - var/bodyzone = pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG,BODY_ZONE_R_LEG) if(at_risk.process_fire(src,src,FALSE, null, bodyzone) == TRUE) log_combat(src,src,"misfired",at_risk,"caused by [cause]") - visible_message(span_danger("\The [at_risk.name]'s trigger gets caught as [src] falls, suddenly going off into [src]'s [bodyzone]!"), span_danger("\The [at_risk.name]'s trigger gets caught on something as you fall, suddenly going off into your [bodyzone]!")) + visible_message(span_danger("\The [at_risk.name]'s trigger gets caught as [src] falls, suddenly going off into [src]'s [get_bodypart(bodyzone)]!"), span_danger("\The [at_risk.name]'s trigger gets caught on something as you fall, suddenly going off into your [get_bodypart(bodyzone)]!")) human_holder.force_scream() //I need to refactor this into an attachment