fix bileworm ai going insane after eating someone (#80954)

## About The Pull Request
bileworms will no longer infintely try to eat what they already ate

## Why It's Good For The Game
fixes #80948

## Changelog
🆑
fix: fix bileworm ai going insane after eating someone
/🆑
This commit is contained in:
Ben10Omintrix
2024-01-15 21:59:34 +01:00
committed by GitHub
parent fd00deb9de
commit e7e698e9c4
@@ -22,11 +22,16 @@
//because one ability is always INFINITY cooldown, this actually works to check which ability should be used
//sometimes it will try to spew bile on infinity cooldown, but that's okay because as soon as resurface is ready it will attempt that
if(!QDELETED(resurface) && resurface.next_use_time <= world.time)
if(resurface?.IsAvailable())
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability/and_plan_execute, BB_BILEWORM_RESURFACE, BB_BASIC_MOB_CURRENT_TARGET)
else
return SUBTREE_RETURN_FINISH_PLANNING
var/datum/action/cooldown/mob_cooldown/bile = controller.blackboard[BB_BILEWORM_SPEW_BILE]
if(bile?.IsAvailable())
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability/and_plan_execute, BB_BILEWORM_SPEW_BILE, BB_BASIC_MOB_CURRENT_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING //focus on the fight
return SUBTREE_RETURN_FINISH_PLANNING //focus on the fight
/datum/ai_planning_subtree/bileworm_execute
@@ -35,9 +40,15 @@
var/atom/movable/target = controller.blackboard[BB_BASIC_MOB_EXECUTION_TARGET]
if(QDELETED(target) || !isliving(target))
return
var/datum/action/cooldown/mob_cooldown/devour = controller.blackboard[BB_BILEWORM_DEVOUR]
if(!(devour?.IsAvailable()))
return
var/mob/living/living_target = target
if(living_target.stat < UNCONSCIOUS)
return
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability, BB_BILEWORM_DEVOUR, BB_BASIC_MOB_EXECUTION_TARGET)
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability/and_clear_target, BB_BILEWORM_DEVOUR, BB_BASIC_MOB_EXECUTION_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING //focus on devouring this fool