Tweaks ai escape_captivity behavior (#94224)

## About The Pull Request

Now: AI will break chairs they're buckled in
After PR: Ai will prefer to resist out of chairs if possible

Fixes #94222 , partially

Really I think this shouldn't be a subtree, orrrrr if it is it should be
enabled by combat.
It's weird that buckling a pet into a pet bed encourages them to get up
ASAP.
If a mob is completely docile or otherwise not trying to act, they
shouldn't freak out and break whatever they're sat in.

Alternatively pets need a behavior for seeking out a bed (but that's
more effort)

## Changelog

🆑 Melbert
fix: AI mobs will prefer to resist out of simple buckles (like being sat
in a chair or bed) rather than try to break the chair.
/🆑
This commit is contained in:
MrMelbert
2025-11-30 18:26:11 -06:00
committed by GitHub
parent 031de12e2b
commit 42f4df09a7
6 changed files with 17 additions and 5 deletions
@@ -8,11 +8,13 @@
/datum/ai_planning_subtree/escape_captivity/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
var/mob/living/living_pawn = controller.pawn
if (living_pawn.buckled && !ismob(living_pawn.buckled))
if (!pacifist && !living_pawn.can_hold_items() || living_pawn.usable_hands < 1) // If we don't have hands then prioritise slapping the shit out of whatever we are attached to
controller.queue_behavior(/datum/ai_behavior/break_out_of_object, living_pawn.buckled)
else
if (isobj(living_pawn.buckled))
// we can just stand up we don't need to freak out
if (pacifist || !HAS_TRAIT(living_pawn.buckled, TRAIT_DANGEROUS_BUCKLE))
controller.queue_behavior(/datum/ai_behavior/resist)
// otherwise beat the shit out of we we gotta get out NOW
else
controller.queue_behavior(/datum/ai_behavior/break_out_of_object, living_pawn.buckled)
return SUBTREE_RETURN_FINISH_PLANNING
if (!isturf(living_pawn.loc) && !ismob(living_pawn.loc) && !istype(living_pawn.loc, /obj/item/mob_holder))
@@ -26,7 +28,7 @@
controller.queue_behavior(/datum/ai_behavior/break_out_of_object, contained_in)
else
controller.queue_behavior(/datum/ai_behavior/resist)
return SUBTREE_RETURN_FINISH_PLANNING
return SUBTREE_RETURN_FINISH_PLANNING
var/mob/puller = living_pawn.pulledby
if (puller && puller.grab_state > GRAB_PASSIVE)