[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
+5 -3
View File
@@ -207,11 +207,13 @@
/obj/attacked_by(obj/item/I, mob/living/user)
if(I.force)
user.visible_message("<span class='danger'>[user] hits [src] with [I]!</span>", \
"<span class='danger'>You hit [src] with [I]!</span>", null, COMBAT_MESSAGE_RANGE)
var/no_damage = TRUE
if(take_damage(I.force, I.damtype, MELEE, 1))
no_damage = FALSE
//only witnesses close by and the victim see a hit message.
log_combat(user, src, "attacked", I)
take_damage(I.force, I.damtype, MELEE, 1)
user.visible_message("<span class='danger'>[user] hits [src] with [I][no_damage ? ", which doesn't leave a mark" : ""]!</span>", \
"<span class='danger'>You hit [src] with [I][no_damage ? ", which doesn't leave a mark" : ""]!</span>", null, COMBAT_MESSAGE_RANGE)
/mob/living/attacked_by(obj/item/I, mob/living/user)
send_item_attack_message(I, user)
+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)
+4 -3
View File
@@ -75,10 +75,11 @@
/obj/bullet_act(obj/projectile/P)
. = ..()
playsound(src, P.hitsound, 50, TRUE)
var/no_damage = FALSE
if(!QDELETED(src) && !take_damage(P.damage, P.damage_type, P.flag, 0, turn(P.dir, 180), P.armour_penetration)) //Bullet on_hit effect might have already destroyed this object
no_damage = TRUE
if(P.suppressed != SUPPRESSED_VERY)
visible_message("<span class='danger'>[src] is hit by \a [P]!</span>", null, null, COMBAT_MESSAGE_RANGE)
if(!QDELETED(src)) //Bullet on_hit effect might have already destroyed this object
take_damage(P.damage, P.damage_type, P.flag, 0, turn(P.dir, 180), P.armour_penetration)
visible_message("<span class='danger'>[src] is hit by \a [P][no_damage ? ", which doesn't leave a mark" : ""]!</span>", null, null, COMBAT_MESSAGE_RANGE)
///Called to get the damage that hulks will deal to the obj.
/obj/proc/hulk_damage()