Being drunk or having a broken arm hurts accuracy with ranged weapons. Also cleans up a fair bit of hand handling to be more readable (#87904)

## About The Pull Request

1. Having a broken arm will affect your accuracy when firing a weapon
with that arm, even potentially causing damage to you if it's a weapon
with recoil. This effect is not applied under the effects of a
painkiller.

2. The sister effect of this (punching someone with a broken arm) now
also has an interact with painkillers (it can no longer block your
attack).

3. Being drunk heavily affects ranged weapon accuracy, unless you're the
bartender

4. A lot of hand handling cleanup, using new macros to make it a lot
more readable at a glance

## Why It's Good For The Game

We have this system for modifying firearm accuracy but we don't really
use it commonly, and I feel like it slots in well with a lot of places

For broken arms, it adds some more depth to the wound system, in the
same way that trying to punch someone with a broken arm causes pain. (I
actually want to expand this to melee weapon accuracy and attacking with
melee weapons in general, but that's for a later time)

For drunkenness, it just adds to the drunk shenanigans. It also slightly
reduces the effectiveness of drinks as combat healing chemicals, such as
quadsec - makes it a bit more of a trade off.

## Changelog

🆑 Melbert
balance: Having a broken arm affects your accuracy with ranged weapons
fired with that arm. Utilizing a painkiller will nullify this effect,
however.
balance: Painkillers will prevent your punches from being cancelled due
to having a broken arm. You'll still take damage, though.
balance: Being drunk now affects your accuracy with ranged weapon. The
bartender is immune to this effect via their skillchip.
code: A lot of code involving left and right hand handling has been
cleaned up, easier to read. Report any oddities, like left and rights
being flipped
/🆑
This commit is contained in:
MrMelbert
2024-11-19 19:31:06 +01:00
committed by GitHub
parent e6bbfbdf08
commit d3bc3e8cb4
36 changed files with 125 additions and 104 deletions
+1 -1
View File
@@ -39,7 +39,7 @@
SIGNAL_HANDLER
var/list/held_overlays = list()
for(var/obj/item/held in holding_mob.held_items)
var/is_right = holding_mob.get_held_index_of_item(held) % 2 == 0
var/is_right = IS_RIGHT_INDEX(holding_mob.get_held_index_of_item(held))
var/icon_file = is_right ? held.righthand_file : held.lefthand_file
var/mutable_appearance/held_overlay = held.build_worn_icon(default_layer = HANDS_LAYER, default_icon_file = icon_file, isinhands = TRUE)
held_overlay.pixel_y += y_offset
+1 -1
View File
@@ -194,7 +194,7 @@
return
var/flinch_chance = 50
var/gun_hand = (source.get_held_index_of_item(weapon) % 2) ? BODY_ZONE_L_ARM : BODY_ZONE_R_ARM
var/gun_hand = IS_LEFT_INDEX(source.get_held_index_of_item(weapon)) ? BODY_ZONE_L_ARM : BODY_ZONE_R_ARM
if(isbodypart(def_zone))
var/obj/item/bodypart/hitting = def_zone
+2 -2
View File
@@ -115,8 +115,8 @@
return
if(!is_weak)
var/appendage_zone = feeder.held_items.Find(source)
appendage_zone = appendage_zone == 0 ? BODY_ZONE_CHEST : (appendage_zone % 2 ? BODY_ZONE_R_ARM : BODY_ZONE_L_ARM)
var/appendage_zone = feeder.get_held_index_of_item(source)
appendage_zone = appendage_zone == 0 ? BODY_ZONE_CHEST : (IS_RIGHT_INDEX(appendage_zone) ? BODY_ZONE_R_ARM : BODY_ZONE_L_ARM)
try_infect(feeder, appendage_zone)
for(var/datum/disease/disease as anything in diseases)
+2 -4
View File
@@ -160,11 +160,9 @@
if(!base_icon_state)
return
// Even hand indexes are right hands,
// Odd hand indexes are left hand
// ...But also, we swap it intentionally here,
// We swap it intentionally here,
// so right icon is shown on the left (Because hands)
if(user.get_held_index_of_item(src) % 2 == 1)
if(IS_LEFT_INDEX(user.get_held_index_of_item(src)))
icon_state = "[base_icon_state]_right"
else
icon_state = "[base_icon_state]_left"
@@ -165,10 +165,7 @@
var/obj/item/cigarette/cig = item
var/clumsy = HAS_TRAIT(user, TRAIT_CLUMSY)
if(clumsy)
var/which_hand = BODY_ZONE_L_ARM
if(!(user.active_hand_index % 2))
which_hand = BODY_ZONE_R_ARM
var/obj/item/bodypart/dust_arm = user.get_bodypart(which_hand)
var/obj/item/bodypart/dust_arm = user.get_active_hand()
dust_arm.dismember()
user.visible_message(span_danger("The [item] flashes out of existence on contact with \the [atom_source], resonating with a horrible sound..."),\
span_danger("Oops! The [item] flashes out of existence on contact with \the [atom_source], taking your arm with it! That was clumsy of you!"))