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
+3
View File
@@ -183,8 +183,11 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
#define EMBED_CHANCE_SPEED_BONUS 10
//Gun weapon weight
/// Default normal ol' gun. Akimboable, one handed.
#define WEAPON_LIGHT 1
/// Can't be used akimbo, but only needs one hand to fire
#define WEAPON_MEDIUM 2
/// Can't be used akimbo, and needs two hands to fire
#define WEAPON_HEAVY 3
//Gun trigger guards
#define TRIGGER_GUARD_ALLOW_ALL -1
-18
View File
@@ -34,24 +34,6 @@
Therefore, the top right corner (except during admin shenanigans) is at "15,15"
*/
/proc/ui_hand_position(i) //values based on old hand ui positions (CENTER:-/+16,SOUTH:5)
var/x_off = i % 2 ? 0 : -1
var/y_off = round((i-1) / 2)
return"CENTER+[x_off]:16,SOUTH+[y_off]:5"
/proc/ui_equip_position(mob/M)
var/y_off = round((M.held_items.len-1) / 2) //values based on old equip ui position (CENTER: +/-16,SOUTH+1:5)
return "CENTER:-16,SOUTH+[y_off+1]:5"
/proc/ui_swaphand_position(mob/M, which = 1) //values based on old swaphand ui positions (CENTER: +/-16,SOUTH+1:5)
var/x_off = which == 1 ? -1 : 0
var/y_off = round((M.held_items.len-1) / 2)
return "CENTER+[x_off]:16,SOUTH+[y_off+1]:5"
/proc/ui_perk_position(perk_count)
var/y_off = perk_count < 1 ? 0 : perk_count/2
return "WEST+0.5:12,NORTH-2-[y_off]:20"
// Middle
#define around_player "CENTER-1,CENTER-1"
+4
View File
@@ -135,6 +135,10 @@ DEFINE_BITFIELD(no_equip_flags, list(
//defines for the index of hands
#define LEFT_HANDS 1
#define RIGHT_HANDS 2
/// Checks if the value is "left" - same as ISEVEN, but used primarily for hand or foot index contexts
#define IS_RIGHT_INDEX(value) (value % 2 == 0)
/// Checks if the value is "right" - same as ISODD, but used primarily for hand or foot index contexts
#define IS_LEFT_INDEX(value) (value % 2 != 0)
//flags for female outfits: How much the game can safely "take off" the uniform without it looking weird
/// For when there's simply no need for a female version of this uniform.
+17
View File
@@ -0,0 +1,17 @@
/proc/ui_hand_position(i) //values based on old hand ui positions (CENTER:-/+16,SOUTH:5)
var/x_off = IS_LEFT_INDEX(i) ? 0 : -1
var/y_off = round((i-1) / 2)
return"CENTER+[x_off]:16,SOUTH+[y_off]:5"
/proc/ui_equip_position(mob/M)
var/y_off = round((M.held_items.len-1) / 2) //values based on old equip ui position (CENTER: +/-16,SOUTH+1:5)
return "CENTER:-16,SOUTH+[y_off+1]:5"
/proc/ui_swaphand_position(mob/M, which = LEFT_HANDS) //values based on old swaphand ui positions (CENTER: +/-16,SOUTH+1:5)
var/x_off = which == LEFT_HANDS ? -1 : 0
var/y_off = round((M.held_items.len-1) / 2)
return "CENTER+[x_off]:16,SOUTH+[y_off+1]:5"
/proc/ui_perk_position(perk_count)
var/y_off = perk_count < 1 ? 0 : perk_count/2
return "WEST+0.5:12,NORTH-2-[y_off]:20"
+2 -2
View File
@@ -182,11 +182,11 @@
static_inventory += using
using = new /atom/movable/screen/blob/node_blob(null, src)
using.screen_loc = ui_hand_position(2)
using.screen_loc = ui_hand_position(RIGHT_HANDS)
static_inventory += using
using = new /atom/movable/screen/blob/factory_blob(null, src)
using.screen_loc = ui_hand_position(1)
using.screen_loc = ui_hand_position(LEFT_HANDS)
static_inventory += using
using = new /atom/movable/screen/blob/readapt_strain(null, src)
+2 -2
View File
@@ -15,11 +15,11 @@
infodisplay += healths
using = new /atom/movable/screen/guardian/manifest(null, src)
using.screen_loc = ui_hand_position(2)
using.screen_loc = ui_hand_position(RIGHT_HANDS)
static_inventory += using
using = new /atom/movable/screen/guardian/recall(null, src)
using.screen_loc = ui_hand_position(1)
using.screen_loc = ui_hand_position(LEFT_HANDS)
static_inventory += using
using = new owner.toggle_button_type(null, src)
+1 -1
View File
@@ -505,7 +505,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
var/i = 1
for(var/atom/movable/screen/swap_hand/SH in static_inventory)
SH.screen_loc = ui_swaphand_position(mymob,!(i % 2) ? 2: 1)
SH.screen_loc = ui_swaphand_position(mymob, IS_RIGHT_INDEX(i) ? RIGHT_HANDS : LEFT_HANDS)
i++
for(var/atom/movable/screen/human/equip/E in static_inventory)
E.screen_loc = ui_equip_position(mymob)
+2 -2
View File
@@ -241,7 +241,7 @@
. = ..()
if(!handcuff_overlay)
var/state = (!(held_index % 2)) ? "markus" : "gabrielle"
var/state = IS_RIGHT_INDEX(held_index) ? "markus" : "gabrielle"
handcuff_overlay = mutable_appearance('icons/hud/screen_gen.dmi', state)
if(!hud?.mymob)
@@ -257,7 +257,7 @@
. += blocked_overlay
if(held_index == hud.mymob.active_hand_index)
. += (held_index % 2) ? "lhandactive" : "rhandactive"
. += IS_LEFT_INDEX(held_index) ? "lhandactive" : "rhandactive"
/atom/movable/screen/inventory/hand/Click(location, control, params)
// At this point in client Click() code we have passed the 1/10 sec check and little else
+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!"))
+1 -1
View File
@@ -306,7 +306,7 @@
newRod.activated()
if(!itemUser.has_hand_for_held_index(hand))
//If user does not have the corresponding hand anymore, give them one and return the rod to their hand
var/zone = (hand % 2) ? BODY_ZONE_L_ARM : BODY_ZONE_R_ARM
var/zone = IS_LEFT_INDEX(hand) ? BODY_ZONE_L_ARM : BODY_ZONE_R_ARM
if(itemUser.regenerate_limb(zone, FALSE))
itemUser.put_in_hand(newRod, hand, forced = TRUE)
else
@@ -106,6 +106,7 @@
. = ..()
owner.sound_environment_override = SOUND_ENVIRONMENT_PSYCHOTIC
owner.add_mood_event(id, /datum/mood_event/drunk)
RegisterSignal(owner, COMSIG_MOB_FIRED_GUN, PROC_REF(drunk_gun_fired))
/datum/status_effect/inebriated/drunk/on_remove()
clear_effects()
@@ -123,6 +124,19 @@
if(owner.sound_environment_override == SOUND_ENVIRONMENT_PSYCHOTIC)
owner.sound_environment_override = SOUND_ENVIRONMENT_NONE
UnregisterSignal(owner, COMSIG_MOB_FIRED_GUN)
/datum/status_effect/inebriated/drunk/proc/drunk_gun_fired(datum/source, obj/item/gun/gun, atom/firing_at, params, zone, bonus_spread_values)
SIGNAL_HANDLER
// excusing the bartender, because shotgun
if(HAS_TRAIT(owner, TRAIT_DRUNKEN_BRAWLER))
return
// what makes me a good demoman?
if(istype(gun, /obj/item/gun/grenadelauncher) || istype(gun, /obj/item/gun/ballistic/revolver/grenadelauncher))
return
bonus_spread_values[MAX_BONUS_SPREAD_INDEX] += (drunk_value * 0.5)
/datum/status_effect/inebriated/drunk/set_drunk_value(set_to)
. = ..()
if(QDELETED(src))
+36 -5
View File
@@ -61,9 +61,10 @@
/datum/wound/blunt/bone/set_victim(new_victim)
if (victim)
UnregisterSignal(victim, COMSIG_LIVING_UNARMED_ATTACK)
UnregisterSignal(victim, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_MOB_FIRED_GUN))
if (new_victim)
RegisterSignal(new_victim, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(attack_with_hurt_hand))
RegisterSignal(new_victim, COMSIG_MOB_FIRED_GUN, PROC_REF(firing_with_messed_up_hand))
return ..()
@@ -120,19 +121,49 @@
// With a severe or critical wound, you have a 15% or 30% chance to proc pain on hit
if(prob((severity - 1) * 15))
// And you have a 70% or 50% chance to actually land the blow, respectively
if(prob(70 - 20 * (severity - 1)))
to_chat(victim, span_userdanger("The fracture in your [limb.plaintext_zone] shoots with pain as you strike [target]!"))
limb.receive_damage(brute=rand(1,5))
if(HAS_TRAIT(victim, TRAIT_ANALGESIA) || prob(70 - 20 * (severity - 1)))
if(!HAS_TRAIT(victim, TRAIT_ANALGESIA))
to_chat(victim, span_danger("The fracture in your [limb.plaintext_zone] shoots with pain as you strike [target]!"))
victim.apply_damage(rand(1, 5), BRUTE, limb, wound_bonus = CANT_WOUND, wound_clothing = FALSE)
else
victim.visible_message(span_danger("[victim] weakly strikes [target] with [victim.p_their()] broken [limb.plaintext_zone], recoiling from pain!"), \
span_userdanger("You fail to strike [target] as the fracture in your [limb.plaintext_zone] lights up in unbearable pain!"), vision_distance=COMBAT_MESSAGE_RANGE)
INVOKE_ASYNC(victim, TYPE_PROC_REF(/mob, emote), "scream")
victim.Stun(0.5 SECONDS)
limb.receive_damage(brute=rand(3,7))
victim.apply_damage(rand(3, 7), BRUTE, limb, wound_bonus = CANT_WOUND, wound_clothing = FALSE)
return COMPONENT_CANCEL_ATTACK_CHAIN
return NONE
/// If we're a human who's firing a gun with a broken arm, we might hurt ourselves doing so
/datum/wound/blunt/bone/proc/firing_with_messed_up_hand(datum/source, obj/item/gun/gun, atom/firing_at, params, zone, bonus_spread_values)
SIGNAL_HANDLER
switch(limb.body_zone)
if(BODY_ZONE_L_ARM)
// Heavy guns use both hands so they will always get a penalty
// (Yes, this means having two broken arms will make heavy weapons SOOO much worse)
// Otherwise make sure THIS hand is firing THIS gun
if(gun.weapon_weight <= WEAPON_MEDIUM && !IS_LEFT_INDEX(victim.get_held_index_of_item(gun)))
return
if(BODY_ZONE_R_ARM)
// Ditto but for right arm
if(gun.weapon_weight <= WEAPON_MEDIUM && !IS_RIGHT_INDEX(victim.get_held_index_of_item(gun)))
return
else
// This is not arm wound, so we don't care
return
if(gun.recoil > 0 && severity >= WOUND_SEVERITY_SEVERE && prob(25 * (severity - 1)))
if(!HAS_TRAIT(victim, TRAIT_ANALGESIA))
to_chat(victim, span_danger("The fracture in your [limb.plaintext_zone] explodes with pain as [gun] kicks back!"))
victim.apply_damage(rand(1, 3) * (severity - 1) * gun.weapon_weight, BRUTE, limb, wound_bonus = CANT_WOUND, wound_clothing = FALSE)
if(!HAS_TRAIT(victim, TRAIT_ANALGESIA))
bonus_spread_values[MAX_BONUS_SPREAD_INDEX] += (15 * severity * (limb.current_gauze?.splint_factor || 1))
/datum/wound/blunt/bone/receive_damage(wounding_type, wounding_dmg, wound_bonus)
if(!victim || wounding_dmg < WOUND_MINIMUM_DAMAGE)
return
+5 -6
View File
@@ -80,12 +80,11 @@ at the cost of risking a vicious bite.**/
return
if(critter_infested && prob(50) && iscarbon(user))
var/mob/living/carbon/bite_victim = user
var/obj/item/bodypart/affecting = bite_victim.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm")
to_chat(user, span_danger("You feel a sharp pain as an unseen creature sinks its [pick("fangs", "beak", "proboscis")] into your arm!"))
if(affecting?.receive_damage(30))
bite_victim.update_damage_overlays()
playsound(src,'sound/items/weapons/bite.ogg', 70, TRUE)
return
var/obj/item/bodypart/affecting = bite_victim.get_active_hand()
to_chat(user, span_danger("You feel a sharp pain as an unseen creature sinks its [pick("fangs", "beak", "proboscis")] into your [affecting.plaintext_zone]!"))
bite_victim.apply_damage(30, BRUTE, affecting)
playsound(src,'sound/items/weapons/bite.ogg', 70, TRUE)
return
to_chat(user, span_warning("You find nothing of value..."))
/obj/structure/moisture_trap/attackby(obj/item/I, mob/user, params)
@@ -71,7 +71,7 @@
if(HAS_TRAIT_FROM_ONLY(user, TRAIT_PARALYSIS_L_ARM, CHANGELING_TRAIT) || HAS_TRAIT_FROM_ONLY(user, TRAIT_PARALYSIS_R_ARM, CHANGELING_TRAIT))
user.balloon_alert(user, "not enough muscle!") // no cheesing repuprosed glands
return
if(user.active_hand_index % 2 == 0) //we regen the arm before changing it into the weapon
if(IS_RIGHT_INDEX(user.active_hand_index)) //we regen the arm before changing it into the weapon
limb_regen = user.regenerate_limb(BODY_ZONE_R_ARM, 1)
else
limb_regen = user.regenerate_limb(BODY_ZONE_L_ARM, 1)
@@ -116,22 +116,6 @@
demolition_mod = 1.5
sharpness = SHARP_EDGED
/obj/item/mutant_hand/shattered_risen/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
/obj/item/mutant_hand/shattered_risen/visual_equipped(mob/user, slot)
. = ..()
// Even hand indexes are right hands,
// Odd hand indexes are left hand
// ...But also, 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)
icon_state = "[base_icon_state]_right"
else
icon_state = "[base_icon_state]_left"
/datum/heretic_knowledge/rune_carver
name = "Carving Knife"
desc = "Allows you to transmute a knife, a shard of glass, and a piece of paper to create a Carving Knife. \
@@ -158,9 +158,8 @@
return ..()
/obj/item/soulstone/proc/hot_potato(mob/living/user)
to_chat(user, span_userdanger("Holy magics residing in \the [src] burn your hand!"))
var/obj/item/bodypart/affecting = user.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm")
affecting.receive_damage( 0, 10 ) // 10 burn damage
to_chat(user, span_userdanger("Holy magics residing in [src] burn your hand!"))
user.apply_damage(10, BURN, user.get_active_hand())
user.emote("scream")
user.update_damage_overlays()
user.dropItemToGround(src)
+2 -2
View File
@@ -100,12 +100,12 @@
/obj/item/assembly_holder/update_overlays()
. = ..()
for(var/i in 1 to LAZYLEN(assemblies))
if(i % 2 == 1)
if(IS_LEFT_INDEX(i))
var/obj/item/assembly/assembly = assemblies[i]
. += "[assembly.icon_state]_left"
for(var/left_overlay in assembly.attached_overlays)
. += "[left_overlay]_l"
if(i % 2 == 0)
if(IS_RIGHT_INDEX(i))
var/obj/item/assembly/assembly = assemblies[i]
var/mutable_appearance/right = mutable_appearance(icon, "[assembly.icon_state]_left")
right.transform = matrix(-1, 0, 0, 0, 1, 0)
+2 -2
View File
@@ -157,7 +157,7 @@
return FALSE
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
var/which_hand = BODY_ZONE_PRECISE_L_HAND
if(!(user.active_hand_index % 2))
if(IS_RIGHT_INDEX(user.active_hand_index))
which_hand = BODY_ZONE_PRECISE_R_HAND
triggered(user, which_hand)
user.visible_message(span_warning("[user] accidentally sets off [src], breaking their fingers."), \
@@ -206,7 +206,7 @@
if(finder)
finder.visible_message(span_warning("[finder] accidentally sets off [src], breaking their fingers."), \
span_warning("You accidentally trigger [src]!"))
triggered(finder, (finder.active_hand_index % 2 == 0) ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND)
triggered(finder, (IS_RIGHT_INDEX(finder.active_hand_index)) ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND)
return TRUE //end the search!
else
visible_message(span_warning("[src] snaps shut!"))
+1 -1
View File
@@ -332,7 +332,7 @@
QDEL_NULL(fishing_line)
var/beam_color = line?.line_color || default_line_color
fishing_line = new(firer, target, icon_state = "fishing_line", beam_color = beam_color, emissive = FALSE, override_target_pixel_y = target_py)
fishing_line.lefthand = firer.get_held_index_of_item(src) % 2 == 1
fishing_line.lefthand = IS_LEFT_INDEX(firer.get_held_index_of_item(src))
RegisterSignal(fishing_line, COMSIG_BEAM_BEFORE_DRAW, PROC_REF(check_los))
RegisterSignal(fishing_line, COMSIG_QDELETING, PROC_REF(clear_line))
INVOKE_ASYNC(fishing_line, TYPE_PROC_REF(/datum/beam/, Start))
+1 -2
View File
@@ -367,8 +367,7 @@ GLOBAL_LIST_INIT(bibleitemstates, list(
uses -= 1
to_chat(user, span_userdanger("You try to open the book AND IT BITES YOU!"))
playsound(src.loc, 'sound/effects/snap.ogg', 50, TRUE)
var/active_hand_zone = (!(user.active_hand_index % RIGHT_HANDS) ? BODY_ZONE_R_ARM : BODY_ZONE_L_ARM)
user.apply_damage(5, BRUTE, active_hand_zone, attacking_item = src)
user.apply_damage(5, BRUTE, user.get_active_hand(), attacking_item = src)
to_chat(user, span_notice("Your name appears on the inside cover, in blood."))
owner_name = user.real_name
+3 -3
View File
@@ -16,7 +16,7 @@
//So we're treating each "pair" of limbs as a team, so "both" refers to them
/mob/proc/get_inactive_hand_index()
var/other_hand = 0
if(!(active_hand_index % 2))
if(IS_RIGHT_INDEX(active_hand_index))
other_hand = active_hand_index-1 //finding the matching "left" limb
else
other_hand = active_hand_index+1 //finding the matching "right" limb
@@ -33,7 +33,7 @@
//Odd = left. Even = right
/mob/proc/held_index_to_dir(i)
if(!(i % 2))
if(IS_RIGHT_INDEX(i))
return "r"
return "l"
@@ -132,7 +132,7 @@
if(i > 2)
hand += "upper "
var/num = 0
if(!(i % 2))
if(IS_RIGHT_INDEX(i))
num = i-2
hand += "right hand"
else
+1 -1
View File
@@ -618,7 +618,7 @@
/obj/item/organ/brain/proc/get_attacking_limb(mob/living/carbon/human/target)
var/obj/item/bodypart/arm/active_hand = owner.get_active_hand()
if(target.body_position == LYING_DOWN && owner.usable_legs)
var/obj/item/bodypart/found_bodypart = owner.get_bodypart((active_hand.held_index % 2) ? BODY_ZONE_L_LEG : BODY_ZONE_R_LEG)
var/obj/item/bodypart/found_bodypart = owner.get_bodypart(IS_LEFT_INDEX(active_hand.held_index) ? BODY_ZONE_L_LEG : BODY_ZONE_R_LEG)
return found_bodypart || active_hand
return active_hand
@@ -272,7 +272,7 @@
break
var/icon_file = I.lefthand_file
if(get_held_index_of_item(I) % 2 == 0)
if(IS_RIGHT_INDEX(get_held_index_of_item(I)))
icon_file = I.righthand_file
hands += I.build_worn_icon(default_layer = HANDS_LAYER, default_icon_file = icon_file, isinhands = TRUE)
@@ -130,7 +130,7 @@
/mob/living/carbon/human/proc/check_chunky_fingers()
if(HAS_TRAIT_NOT_FROM(src, TRAIT_CHUNKYFINGERS, RIGHT_ARM_TRAIT) && HAS_TRAIT_NOT_FROM(src, TRAIT_CHUNKYFINGERS, LEFT_ARM_TRAIT))
return TRUE
return (active_hand_index % 2) ? HAS_TRAIT_FROM(src, TRAIT_CHUNKYFINGERS, LEFT_ARM_TRAIT) : HAS_TRAIT_FROM(src, TRAIT_CHUNKYFINGERS, RIGHT_ARM_TRAIT)
return IS_LEFT_INDEX(active_hand_index) ? HAS_TRAIT_FROM(src, TRAIT_CHUNKYFINGERS, LEFT_ARM_TRAIT) : HAS_TRAIT_FROM(src, TRAIT_CHUNKYFINGERS, RIGHT_ARM_TRAIT)
/mob/living/carbon/human/get_policy_keywords()
. = ..()
@@ -550,7 +550,7 @@ There are several things that need to be remembered:
t_state = worn_item.icon_state
var/mutable_appearance/hand_overlay
var/icon_file = held_index % 2 == 0 ? worn_item.righthand_file : worn_item.lefthand_file
var/icon_file = IS_RIGHT_INDEX(held_index) ? worn_item.righthand_file : worn_item.lefthand_file
hand_overlay = worn_item.build_worn_icon(default_layer = HANDS_LAYER, default_icon_file = icon_file, isinhands = TRUE)
var/obj/item/bodypart/arm/held_in_hand = hand_bodyparts[held_index]
held_in_hand?.held_hand_offset?.apply_offset(hand_overlay)
@@ -424,7 +424,7 @@
hand_bodyparts.len = amt
for(var/i in old_limbs+1 to amt)
var/path = /obj/item/bodypart/arm/left
if(!(i % 2))
if(IS_RIGHT_INDEX(i))
path = /obj/item/bodypart/arm/right
var/obj/item/bodypart/BP = new path ()
+4 -6
View File
@@ -576,15 +576,13 @@
else if(istype(user) && user.dna.check_mutation(/datum/mutation/human/telekinesis))
to_chat(user, span_notice("You telekinetically remove the light [fitting]."))
else
var/obj/item/bodypart/affecting = user.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm")
if(affecting?.receive_damage( 0, 5 )) // 5 burn damage
user.update_damage_overlays()
var/obj/item/bodypart/affecting = user.get_active_hand()
user.apply_damage(5, BURN, affecting, wound_bonus = CANT_WOUND)
if(HAS_TRAIT(user, TRAIT_LIGHTBULB_REMOVER))
to_chat(user, span_notice("You feel your [affecting] burning, and the light beginning to budge."))
to_chat(user, span_notice("You feel your [affecting.plaintext_zone] burning, but the light begins to budge..."))
if(!do_after(user, 5 SECONDS, target = src))
return
if(affecting?.receive_damage( 0, 10 )) // 10 more burn damage
user.update_damage_overlays()
user.apply_damage(10, BURN, user.get_active_hand(), wound_bonus = CANT_WOUND)
to_chat(user, span_notice("You manage to remove the light [fitting], shattering it in process."))
break_light_tube()
else
@@ -211,9 +211,6 @@ Burning extracts:
effect_desc = "The user gets a dull arm blade in the hand it is used in."
/obj/item/slimecross/burning/green/do_effect(mob/user)
var/which_hand = "l_hand"
if(!(user.active_hand_index % 2))
which_hand = "r_hand"
var/mob/living/L = user
if(!istype(user))
return
@@ -226,7 +223,7 @@ Burning extracts:
else
user.visible_message(span_danger("[src] sublimates the flesh around [user]'s arm, transforming the bone into a gruesome blade!"))
user.emote("scream")
L.apply_damage(30,BURN,which_hand)
L.apply_damage(30, BURN, L.get_active_hand())
..()
/obj/item/slimecross/burning/pink
@@ -252,9 +252,6 @@ Chilling extracts:
effect_desc = "Creates a bone gun in the hand it is used in, which uses blood as ammo."
/obj/item/slimecross/chilling/green/do_effect(mob/user)
var/which_hand = "l_hand"
if(!(user.active_hand_index % 2))
which_hand = "r_hand"
var/mob/living/L = user
if(!istype(user))
return
@@ -267,7 +264,7 @@ Chilling extracts:
else
user.visible_message(span_danger("[src] chills and snaps off the front of the bone on [user]'s arm, leaving behind a strange, gun-like structure!"))
user.emote("scream")
L.apply_damage(30,BURN,which_hand)
L.apply_damage(30, BURN, L.get_active_hand())
..()
/obj/item/slimecross/chilling/pink
+5 -4
View File
@@ -40,11 +40,12 @@
///Get the bodypart for whatever hand we have active, Only relevant for carbons
/mob/proc/get_active_hand()
RETURN_TYPE(/obj/item/bodypart)
return FALSE
/mob/living/carbon/get_active_hand()
var/which_hand = BODY_ZONE_PRECISE_L_HAND
if(!(active_hand_index % RIGHT_HANDS))
if(IS_RIGHT_INDEX(active_hand_index))
which_hand = BODY_ZONE_PRECISE_R_HAND
return get_bodypart(check_zone(which_hand))
@@ -54,7 +55,7 @@
/mob/living/carbon/get_inactive_hand()
var/which_hand = BODY_ZONE_PRECISE_R_HAND
if(!(active_hand_index % RIGHT_HANDS))
if(IS_RIGHT_INDEX(active_hand_index))
which_hand = BODY_ZONE_PRECISE_L_HAND
return get_bodypart(check_zone(which_hand))
@@ -64,7 +65,7 @@
/mob/living/carbon/has_left_hand(check_disabled = TRUE)
for(var/obj/item/bodypart/hand_instance in hand_bodyparts)
if(!(hand_instance.held_index % RIGHT_HANDS) || (check_disabled && hand_instance.bodypart_disabled))
if(IS_RIGHT_INDEX(hand_instance.held_index) || (check_disabled && hand_instance.bodypart_disabled))
continue
return TRUE
return FALSE
@@ -80,7 +81,7 @@
/mob/living/carbon/has_right_hand(check_disabled = TRUE)
for(var/obj/item/bodypart/hand_instance in hand_bodyparts)
if(hand_instance.held_index % RIGHT_HANDS || (check_disabled && hand_instance.bodypart_disabled))
if(IS_LEFT_INDEX(hand_instance.held_index) || (check_disabled && hand_instance.bodypart_disabled))
continue
return TRUE
return FALSE
@@ -38,7 +38,7 @@
/datum/tutorial/switch_hands/proc/create_hand_preview(initial_screen_loc)
hand_preview = animate_ui_element(
"hand_[hand_to_watch % 2 == 0 ? "r" : "l"]",
"hand_[user.held_index_to_dir(hand_to_watch)]",
initial_screen_loc,
ui_hand_position(hand_to_watch),
TIME_TO_START_MOVING_HAND_ICON,
@@ -50,7 +50,7 @@
switch (stage)
if (STAGE_SHOULD_SWAP_HAND)
var/hand_name = hand_to_watch % 2 == 0 ? "right" : "left"
var/hand_name = IS_RIGHT_INDEX(hand_to_watch) ? "right" : "left"
show_instruction(keybinding_message(
/datum/keybinding/mob/swap_hands,
"Press '%KEY%' to use your [hand_name] hand",
+1
View File
@@ -435,6 +435,7 @@
#include "code\__HELPERS\heap.dm"
#include "code\__HELPERS\hearted.dm"
#include "code\__HELPERS\honkerblast.dm"
#include "code\__HELPERS\hud.dm"
#include "code\__HELPERS\icon_smoothing.dm"
#include "code\__HELPERS\icons.dm"
#include "code\__HELPERS\jatum.dm"