Fixes explosions only damaging the chest (#22145)

Explosions used to randomly pick a limb, based on the weighted list of
their size, then do a little damage to every limb.
This broke when un-targetted damage was defaulted to the torso.

This restores the random organ and fixes DAMAGE_FLAG_DISPERSED to
disperse damage.
This commit is contained in:
FenodyreeAv
2026-04-04 22:23:46 +00:00
committed by GitHub
parent ab375d25f4
commit d5f4da3e39
3 changed files with 23 additions and 5 deletions
@@ -326,13 +326,15 @@
if (prob(50))
Paralyse(10)
var/target_zone = ran_zone()
// focus most of the blast on one organ
apply_damage(0.7 * b_loss, DAMAGE_BRUTE, null, DAMAGE_FLAG_EXPLODE, used_weapon = "Explosive blast")
apply_damage(0.7 * f_loss, DAMAGE_BURN, null, DAMAGE_FLAG_EXPLODE, used_weapon = "Explosive blast")
apply_damage(0.7 * b_loss, DAMAGE_BRUTE, target_zone, "Explosive blast", DAMAGE_FLAG_EXPLODE)
apply_damage(0.7 * f_loss, DAMAGE_BURN, target_zone, "Explosive blast", DAMAGE_FLAG_EXPLODE)
// distribute the remaining 30% on all limbs equally (including the one already dealt damage)
apply_damage(0.3 * b_loss, DAMAGE_BRUTE, null, DAMAGE_FLAG_EXPLODE | DAMAGE_FLAG_DISPERSED, used_weapon = "Explosive blast")
apply_damage(0.3 * f_loss, DAMAGE_BURN, null, DAMAGE_FLAG_EXPLODE | DAMAGE_FLAG_DISPERSED, used_weapon = "Explosive blast")
apply_damage(0.3 * b_loss, DAMAGE_BRUTE, null, "Explosive blast", DAMAGE_FLAG_EXPLODE | DAMAGE_FLAG_DISPERSED)
apply_damage(0.3 * f_loss, DAMAGE_BURN, null, "Explosive blast", DAMAGE_FLAG_EXPLODE | DAMAGE_FLAG_DISPERSED)
UpdateDamageIcon()
@@ -451,7 +451,17 @@ This function restores all organs.
to_chat(src, SPAN_DANGER("You are now visible."))
set_invisibility(0)
var/obj/item/organ/external/organ = isorgan(def_zone) ? def_zone : (isnull(def_zone) ? get_organ(BP_CHEST) : get_organ(def_zone))
var/obj/item/organ/external/organ
if(isorgan(def_zone))
organ = def_zone
else if(isnull(def_zone))
if(damage_flags & DAMAGE_FLAG_DISPERSED)
organ = null
else
organ = get_organ(BP_CHEST) //Default to the chest if there is no zone, and its not dispersed damage.
else
organ = get_organ(def_zone)
if(!organ)
if(!def_zone)
if(damage_flags & DAMAGE_FLAG_DISPERSED)