[MIRROR] Adds deflection messages for no damage attacks against objects (#5694)

* Adds deflection messages for no damage attacks against objects (#58873)

* Adds deflection messages for no damage attacks

* Changes the addition to ", which doesn't leave a mark" instead

* Adds deflection messages for no damage attacks against objects

Co-authored-by: cacogen <25089914+cacogen@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-05-14 22:14:12 +01:00
committed by GitHub
co-authored by cacogen
parent 1ae9709100
commit dbfeabd7a7
3 changed files with 21 additions and 11 deletions
+12 -5
View File
@@ -234,6 +234,7 @@
terminated++
hits++
var/obj/item/bodypart/hit_part
var/no_damage = FALSE
if(iscarbon(target) && hit_zone)
var/mob/living/carbon/hit_carbon = target
hit_part = hit_carbon.get_bodypart(hit_zone)
@@ -248,9 +249,14 @@
wound_info_by_part[hit_part][CLOUD_POSITION_W_BONUS] += P.wound_bonus
wound_info_by_part[hit_part][CLOUD_POSITION_BW_BONUS] += P.bare_wound_bonus
P.wound_bonus = CANT_WOUND // actual wounding will be handled aggregate
else if(isobj(target))
var/obj/hit_object = target
if(hit_object.damage_deflection > P.damage || !P.damage)
no_damage = TRUE
targets_hit[target]++
if(targets_hit[target] == 1)
LAZYADDASSOC(targets_hit[target], "hits", 1)
LAZYSET(targets_hit[target], "no damage", no_damage)
if(targets_hit[target]["hits"] == 1)
RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/on_target_qdel, override=TRUE)
UnregisterSignal(P, list(COMSIG_PARENT_QDELETING, COMSIG_PROJECTILE_RANGE_OUT, COMSIG_PROJECTILE_SELF_ON_HIT))
if(terminated == num_pellets)
@@ -289,7 +295,8 @@
var/proj_name = initial(P.name)
for(var/atom/target in targets_hit)
var/num_hits = targets_hit[target]
var/num_hits = targets_hit[target]["hits"]
var/did_damage = targets_hit[target]["no damage"]
UnregisterSignal(target, COMSIG_PARENT_QDELETING)
var/obj/item/bodypart/hit_part
if(isbodypart(target))
@@ -304,10 +311,10 @@
hit_part.painless_wound_roll(wound_type, damage_dealt, w_bonus, bw_bonus, initial(P.sharpness))
if(num_hits > 1)
target.visible_message("<span class='danger'>[target] is hit by [num_hits] [proj_name]s[hit_part ? " in the [hit_part.name]" : ""]!</span>", null, null, COMBAT_MESSAGE_RANGE, target)
target.visible_message("<span class='danger'>[target] is hit by [num_hits] [proj_name]s[hit_part ? " in the [hit_part.name]" : ""][did_damage ? ", which don't leave a mark" : ""]!</span>", null, null, COMBAT_MESSAGE_RANGE, target)
to_chat(target, "<span class='userdanger'>You're hit by [num_hits] [proj_name]s[hit_part ? " in the [hit_part.name]" : ""]!</span>")
else
target.visible_message("<span class='danger'>[target] is hit by a [proj_name][hit_part ? " in the [hit_part.name]" : ""]!</span>", null, null, COMBAT_MESSAGE_RANGE, target)
target.visible_message("<span class='danger'>[target] is hit by a [proj_name][hit_part ? " in the [hit_part.name]" : ""][did_damage ? ", which doesn't leave a mark" : ""]!</span>", null, null, COMBAT_MESSAGE_RANGE, target)
to_chat(target, "<span class='userdanger'>You're hit by a [proj_name][hit_part ? " in the [hit_part.name]" : ""]!</span>")
for(var/M in purple_hearts)