Fixes attack and defense messages using the wrong var (#5289)

This fix an issue where attacking clothed people on their leg would claim they were attack in their l_leg and etc.
This commit is contained in:
Alberyk
2018-09-16 20:52:46 +03:00
committed by Erki
parent 76909527fd
commit e7d3b392bb
2 changed files with 20 additions and 15 deletions
@@ -214,13 +214,10 @@ emp_act
var/obj/item/organ/external/affecting = get_organ(hit_zone)
if(!affecting)
return //should be prevented by attacked_with_item() but for sanity.
var/use_name = affecting.name
if(LAZYLEN(get_clothing_list_organ(affecting)))
use_name = affecting.limb_name
visible_message("<span class='danger'>[src] has been [LAZYPICK(I.attack_verb, "attacked")] in the [use_name] with [I] by [user]!</span>")
visible_message("<span class='danger'>[src] has been [LAZYPICK(I.attack_verb, "attacked")] in the [affecting.name] with [I] by [user]!</span>")
var/blocked = run_armor_check(hit_zone, "melee", I.armor_penetration, "Your armor has protected your [use_name].", "Your armor has softened the blow to your [use_name].")
var/blocked = run_armor_check(hit_zone, "melee", I.armor_penetration, "Your armor has protected your [affecting.name].", "Your armor has softened the blow to your [affecting.name].")
standard_weapon_hit_effects(I, user, effective_force, blocked, hit_zone)
return blocked
@@ -94,10 +94,11 @@ var/global/list/sparring_attack_cache = list()
/datum/unarmed_attack/proc/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
var/obj/item/organ/external/affecting = target.get_organ(zone)
var/organ = affecting.name
if(LAZYLEN(target.get_clothing_list_organ(affecting)))
organ = affecting.limb_name
user.visible_message("<span class='warning'>[user] [pick(attack_verb)] [target] in the [organ]!</span>")
if(!affecting)
return
user.visible_message("<span class='warning'>[user] [pick(attack_verb)] [target] in the [affecting.name]!</span>")
playsound(user.loc, attack_sound, 25, 1, -1)
/datum/unarmed_attack/proc/handle_eye_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target)
@@ -134,9 +135,11 @@ var/global/list/sparring_attack_cache = list()
/datum/unarmed_attack/punch/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
var/obj/item/organ/external/affecting = target.get_organ(zone)
if(!affecting)
return
var/organ = affecting.name
if(LAZYLEN(target.get_clothing_list_organ(affecting)))
organ = affecting.limb_name
attack_damage = Clamp(attack_damage, 1, 5) // We expect damage input of 1 to 5 for this proc. But we leave this check juuust in case.
@@ -208,9 +211,11 @@ var/global/list/sparring_attack_cache = list()
/datum/unarmed_attack/kick/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
var/obj/item/organ/external/affecting = target.get_organ(zone)
if(!affecting)
return
var/organ = affecting.name
if(LAZYLEN(target.get_clothing_list_organ(affecting)))
organ = affecting.limb_name
attack_damage = Clamp(attack_damage, 1, 5)
@@ -253,9 +258,12 @@ var/global/list/sparring_attack_cache = list()
/datum/unarmed_attack/stomp/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
var/obj/item/organ/external/affecting = target.get_organ(zone)
if(!affecting)
return
var/organ = affecting.name
if(LAZYLEN(target.get_clothing_list_organ(affecting)))
organ = affecting.limb_name
var/obj/item/clothing/shoes = user.shoes
attack_damage = Clamp(attack_damage, 1, 5)