Guards against qdeletion in afterattack (#94211)

This commit is contained in:
Bloop
2025-12-10 11:33:06 +01:00
committed by GitHub
parent 8afc2f0cae
commit 2ab2be0f37
13 changed files with 31 additions and 20 deletions
@@ -29,7 +29,7 @@
return
if(bartender_check(target, thrower) && throwingdatum)
return
splash_reagents(target, thrower || throwingdatum?.get_thrower(), allow_closed_splash = TRUE)
splash_reagents(QDELETED(target) ? target.drop_location() : target, thrower || throwingdatum?.get_thrower(), allow_closed_splash = TRUE)
var/obj/item/broken_bottle/B = new (loc)
B.mimic_broken(src, target, break_top)
qdel(src)
@@ -379,7 +379,7 @@
/obj/item/reagent_containers/cup/glass/bottle/juice/smallcarton/smash(atom/target, mob/thrower, datum/thrownthing/throwingdatum, break_top)
if(bartender_check(target, thrower) && throwingdatum)
return
splash_reagents(target, thrower || throwingdatum?.get_thrower(), allow_closed_splash = TRUE)
splash_reagents(QDELETED(target) ? target.drop_location() : target, thrower || throwingdatum?.get_thrower(), allow_closed_splash = TRUE)
var/obj/item/broken_bottle/bottle_shard = new(drop_location())
bottle_shard.mimic_broken(src, target)
qdel(src)
@@ -151,25 +151,25 @@
return
var/head_hitter = user.zone_selected == BODY_ZONE_HEAD && isliving(target)
// An attack that targets the head of a living mob will attempt to knock them down
if(head_hitter)
var/mob/living/living_target = target
var/knockdown_effectiveness = 0
if(!HAS_TRAIT(target, TRAIT_HEAD_INJURY_BLOCKED))
knockdown_effectiveness = bottle_knockdown_duration + ((force / 10) * 1 SECONDS) - living_target.getarmor(BODY_ZONE_HEAD, MELEE)
if(prob(knockdown_effectiveness))
living_target.Knockdown(min(knockdown_effectiveness, 20 SECONDS))
if(!QDELETED(target))
// An attack that targets the head of a living mob will attempt to knock them down
if(head_hitter)
var/mob/living/living_target = target
var/knockdown_effectiveness = 0
if(!HAS_TRAIT(target, TRAIT_HEAD_INJURY_BLOCKED))
knockdown_effectiveness = bottle_knockdown_duration + ((force / 10) * 1 SECONDS) - living_target.getarmor(BODY_ZONE_HEAD, MELEE)
if(prob(knockdown_effectiveness))
living_target.Knockdown(min(knockdown_effectiveness, 20 SECONDS))
// Displays a custom message which follows the attack
if(target == user)
target.visible_message(
user.visible_message(
span_warning("[user] smashes [src] [head_hitter ? "over [user.p_their()] head" : "against [user.p_them()]selves"]!"),
span_warning("You smash [src] [head_hitter ? "over your head" : "against yourself"]!"),
)
else
target.visible_message(
user.visible_message(
span_warning("[user] smashes [src] [head_hitter ? "over [target]'s head" : "against [target]"]!"),
span_warning("[user] smashes [src] [head_hitter ? "over your head" : "against you"]!"),
)
@@ -916,7 +916,8 @@
break
..()
if(firestarter && active)
target.fire_act()
if(!QDELETED(target))
target.fire_act()
new /obj/effect/hotspot(get_turf(target))
/obj/item/reagent_containers/cup/glass/bottle/molotov/item_interaction(mob/living/user, obj/item/item, list/modifiers)