mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 08:36:00 +01:00
fixes a few problems in ai targetting (#82998)
## About The Pull Request fixes #82964 , fixes #82866 ## Why It's Good For The Game fixes several problems with ai targetting. this pr resolves civil war that was brewing between several mobs. also fixes a major problem where mobs would only search for targets and not perform any other behaviors. also fixes a small problem where mobs would constantly stop and start while chasing targets ## Changelog 🆑 fix: mobs in the same faction will no longer be at odds against one another fix: mobs can now perform behaviors alongside searching for targets fix: mobs will no longer be starting and stopping when chasing targets /🆑
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
|
||||
pawn.visible_message(span_notice("[pawn] calms down.")) // We can blackboard key this if anyone else actually wants to customise it
|
||||
controller.clear_blackboard_key(BB_BASIC_MOB_RETALIATE_LIST)
|
||||
controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
|
||||
controller.CancelActions() // Otherwise they will try and get one last kick in
|
||||
return AI_BEHAVIOR_DELAY
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
var/check_faction = FALSE
|
||||
|
||||
/datum/ai_planning_subtree/target_retaliate/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
||||
. = ..()
|
||||
controller.queue_behavior(/datum/ai_behavior/target_from_retaliate_list, BB_BASIC_MOB_RETALIATE_LIST, target_key, targeting_strategy_key, hiding_place_key, check_faction)
|
||||
|
||||
/datum/ai_planning_subtree/target_retaliate/check_faction
|
||||
@@ -35,7 +34,6 @@
|
||||
var/vision_range = 9
|
||||
|
||||
/datum/ai_behavior/target_from_retaliate_list/perform(seconds_per_tick, datum/ai_controller/controller, shitlist_key, target_key, targeting_strategy_key, hiding_location_key, check_faction)
|
||||
. = ..()
|
||||
var/mob/living/living_mob = controller.pawn
|
||||
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
|
||||
if(!targeting_strategy)
|
||||
@@ -58,7 +56,6 @@
|
||||
enemies_list += potential_target
|
||||
|
||||
if(!length(enemies_list))
|
||||
controller.clear_blackboard_key(target_key)
|
||||
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
|
||||
|
||||
var/atom/new_target = pick_final_target(controller, enemies_list)
|
||||
@@ -75,7 +72,7 @@
|
||||
/datum/ai_behavior/target_from_retaliate_list/proc/pick_final_target(datum/ai_controller/controller, list/enemies_list)
|
||||
return pick(enemies_list)
|
||||
|
||||
/datum/ai_behavior/target_from_retaliate_list/finish_action(datum/ai_controller/controller, succeeded, check_faction)
|
||||
/datum/ai_behavior/target_from_retaliate_list/finish_action(datum/ai_controller/controller, succeeded, shitlist_key, target_key, targeting_strategy_key, hiding_location_key, check_faction)
|
||||
. = ..()
|
||||
if (succeeded || check_faction)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user