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
🆑
fix: Fixes runtimes caused by opportunistic melee AI behaviors
/🆑
This commit is contained in:
SmArtKar
2025-12-16 22:04:10 -05:00
committed by GitHub
parent 2d5b08caf2
commit 9e51eaba4a
@@ -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
. = ..()