From 9e51eaba4a2a6632694c9107fe208be3ac6560bc Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Wed, 17 Dec 2025 04:04:10 +0100 Subject: [PATCH] Fixes runtimes caused by opportunistic melee AI behaviors (#94475) ## About The Pull Request Opportunistic melee behavior did not check for target's existence unlike its parent, which means it could runtime if the target got destroyed before the behavior ran ## Changelog :cl: fix: Fixes runtimes caused by opportunistic melee AI behaviors /:cl: --- .../ai/basic_mobs/basic_subtrees/attack_adjacent_target.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/datums/ai/basic_mobs/basic_subtrees/attack_adjacent_target.dm b/code/datums/ai/basic_mobs/basic_subtrees/attack_adjacent_target.dm index 7dd626b1dc4..98cf1654f71 100644 --- a/code/datums/ai/basic_mobs/basic_subtrees/attack_adjacent_target.dm +++ b/code/datums/ai/basic_mobs/basic_subtrees/attack_adjacent_target.dm @@ -27,6 +27,8 @@ /datum/ai_behavior/basic_melee_attack/opportunistic/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key) var/atom/movable/atom_pawn = controller.pawn var/atom/atom_target = controller.blackboard[target_key] + if (QDELETED(atom_target)) + return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED if(!atom_target.IsReachableBy(atom_pawn)) return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED . = ..()