wire up ai idling to spatial grid (#30711)

* wire up ai idling to spatial grid

* lint

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: warriorstar-orion <orion@snowfrost.garden>

* stupid loadbearing src

* some spatial grid cleanup

* make sure to remove controllers in the GLOB

* immediately set targets and state for hiveloord brood

* properly fail behaviors when movement targets are lost

* Apply suggestions from code review

Comment formatting

Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/ai/ai_controller.dm

Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/ai/ai_controller.dm

Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Apply suggestions from code review

Comment formatting

Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/ai/ai_controller.dm

Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Signed-off-by: warriorstar-orion <orion@snowfrost.garden>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
This commit is contained in:
warriorstar-orion
2025-12-09 18:46:38 -05:00
committed by GitHub
parent 9e87289bd8
commit be48d7598f
17 changed files with 351 additions and 127 deletions
@@ -44,8 +44,8 @@
ai_movement = /datum/ai_movement/jps // Not gonna get stuck on walls now, are ya?
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/basic_melee_attack_subtree,
/datum/ai_planning_subtree/simple_find_target,
)
/// Same as hivelords, but go after corpses too
@@ -118,17 +118,21 @@
if(!target)
// Only summon if we have a hostile target
return
controller.queue_behavior(/datum/ai_behavior/summon_brood)
controller.queue_behavior(/datum/ai_behavior/summon_brood, target_key)
/datum/ai_behavior/summon_brood
action_cooldown = 3 SECONDS
behavior_flags = AI_BEHAVIOR_MOVE_AND_PERFORM
required_distance = 0
/datum/ai_behavior/summon_brood/perform(seconds_per_tick, datum/ai_controller/controller)
/datum/ai_behavior/summon_brood/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
. = ..()
var/mob/living/basic/mining/hivelord/summoner = controller.pawn
var/mob/living/basic/mining/hivelordbrood/A = new summoner.brood_type(summoner.loc)
A.admin_spawned = summoner.admin_spawned
A.faction = summoner.faction.Copy()
var/mob/living/target = controller.blackboard[target_key]
if(istype(target) && istype(A.ai_controller))
A.ai_controller.set_ai_status(AI_STATUS_ON)
A.ai_controller.set_blackboard_key(target_key, target)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED