Attack Proc fixes (#1259)

Baymerge changed the attack proc, i think by removing a default value, and a lot of things broke because they weren't using the function correctly.

This proc does three main things.

Adds a default to /obj/item/proc/attack to target the chest when no target zone is supplied.

Fixes the lack of a target zone in many attack procs, properly defining it so it'll get passed to the parent, and ensure that bodypart-specific targeting works.

Removes most instances of code to retrieve the user's selected zone, and instead to use the zone passed into the attack function. saves duplication of effort.
This commit is contained in:
NanakoAC
2016-12-24 01:34:23 +00:00
committed by skull132
parent b0ae247b01
commit 6cef8c9074
24 changed files with 67 additions and 64 deletions

View File

@@ -39,7 +39,7 @@
if(10 to 50) icon_state = "half"
if(51 to INFINITY) icon_state = "full"
/obj/item/weapon/reagent_containers/blood/attack(mob/living/carbon/human/M as mob, mob/living/carbon/human/user as mob)
/obj/item/weapon/reagent_containers/blood/attack(mob/living/carbon/human/M as mob, mob/living/carbon/human/user as mob, var/target_zone)
if (user == M && (user.mind.vampire))
if (reagents.get_reagent_amount("blood"))
user.visible_message("<span class='warning'>[user] raises \the [src] up to \his[user] mouth and bites into it.</span>", "<span class='notice'>You raise \the [src] up to your mouth and bite into it, starting to drain its contents.<br>You need to stand still.</span>")

View File

@@ -119,17 +119,17 @@
/obj/item/weapon/reagent_containers/food/drinks/bottle/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
var/blocked = ..()
if(user.a_intent != I_HURT)
return
if(!smash_check(1))
return //won't always break on the first hit
// You are going to knock someone out for longer if they are not wearing a helmet.
var/weaken_duration = 0
if(blocked < 2)
weaken_duration = smash_duration + min(0, force - target.getarmor(hit_zone, "melee") + 10)
var/mob/living/carbon/human/H = target
if(istype(H) && H.headcheck(hit_zone))
var/obj/item/organ/affecting = H.get_organ(hit_zone) //headcheck should ensure that affecting is not null
@@ -165,7 +165,7 @@
edge = 0
var/icon/broken_outline = icon('icons/obj/drinks.dmi', "broken")
/obj/item/weapon/broken_bottle/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
/obj/item/weapon/broken_bottle/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob, var/target_zone)
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return ..()