Skip to content

Commit

Permalink
Weighs misfire chances + sanitizes code (#4120)
Browse files Browse the repository at this point in the history
## 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:
  • Loading branch information
Erikafox authored Feb 23, 2025
1 parent 6e74956 commit 85f5ead
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85f5ead

Please sign in to comment.