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
+2
View File
@@ -69,6 +69,8 @@ GLOBAL_DATUM(bridge_axe, /obj/item/fireaxe)
return
if(target.resistance_flags & INDESTRUCTIBLE)
return
if(QDELETED(target))
return
if(istype(target, /obj/structure/window) || istype(target, /obj/structure/grille))
target.atom_destruction("fireaxe")
+1 -1
View File
@@ -157,7 +157,7 @@
// This is where stun gets applied
/obj/item/melee/baton/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
if(!isliving(target) || !active || !COOLDOWN_FINISHED(src, cooldown_check) || HAS_TRAIT_FROM(target, TRAIT_IWASBATONED, REF(user)))
if(!isliving(target) || !active || !COOLDOWN_FINISHED(src, cooldown_check) || HAS_TRAIT_FROM(target, TRAIT_IWASBATONED, REF(user)) || QDELETED(target))
return
// worst check in the chain but - right click = harmbaton
if(LAZYACCESS(modifiers, RIGHT_CLICK) && !stun_on_harmbaton)
+1 -1
View File
@@ -219,7 +219,7 @@
return ..()
/obj/item/melee/beesword/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
if(iscarbon(target))
if(iscarbon(target) && !QDELETED(target))
var/mob/living/carbon/carbon_target = target
carbon_target.reagents.add_reagent(/datum/reagent/toxin, 4)
+2
View File
@@ -1073,6 +1073,8 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
/obj/item/melee/flyswatter/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
if(is_type_in_typecache(target, splattable))
to_chat(user, span_warning("You easily splat [target]."))
if(QDELETED(target))
return
if(isliving(target))
new /obj/effect/decal/cleanable/insectguts(target.drop_location())
var/mob/living/bug = target
+1 -1
View File
@@ -64,7 +64,7 @@
return
charged = FALSE
if(isliving(target))
if(isliving(target) && !QDELETED(target))
var/mob/living/smacked = target
smacked.take_bodypart_damage(20, 0)
playsound(user, 'sound/items/weapons/marauder.ogg', 50, TRUE)
@@ -227,6 +227,8 @@
)
/obj/item/melee/arm_blade/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
if(QDELETED(target))
return
if(istype(target, /obj/structure/table))
var/obj/smash = target
smash.deconstruct(FALSE)
@@ -166,7 +166,7 @@
/obj/item/melee/sickly_blade/dark/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
. = ..()
if(!infused || target == user || !isliving(target))
if(!infused || target == user || !isliving(target) || QDELETED(target))
return
var/datum/antagonist/heretic/heretic_datum = GET_HERETIC(user)
var/mob/living/living_target = target
@@ -859,7 +859,7 @@ GLOBAL_LIST_INIT(nullrod_variants, init_nullrod_variants())
if(user == living_target)
return
if(living_target.stat == DEAD)
if(living_target.stat == DEAD || QDELETED(living_target))
return
sneak_attack(living_target, user)
@@ -38,7 +38,7 @@
hitsound = 'sound/items/weapons/bladeslice.ogg'
/obj/item/knife/envy/afterattack(atom/target, mob/living/carbon/human/user, list/modifiers, list/attack_modifiers)
if(!istype(user) || !ishuman(target))
if(!istype(user) || !ishuman(target) || QDELETED(target))
return
var/mob/living/carbon/human/H = target
@@ -100,6 +100,8 @@
return ..()
/obj/item/gun/ballistic/automatic/pistol/clandestine/fisher/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
if(QDELETED(target))
return
var/obj/projectile/energy/fisher/melee/simulated_hit = new
simulated_hit.firer = user
simulated_hit.on_hit(target)
@@ -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)
+2
View File
@@ -12,6 +12,8 @@
sharpness = SHARP_EDGED
/obj/item/mutant_hand/zombie/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers)
if(QDELETED(target))
return
if(ishuman(target))
try_to_zombie_infect(target, user, user.zone_selected)
else if(isliving(target))