Files
Bubberstation/code/modules/mob/living/basic/cult/constructs/construct_ai.dm
LemonInTheDark 9696dd1a1d Targeting Datums Renamed (and global) (#79513)
## About The Pull Request

[Implements the backend required to make targeting datums
global](6901ead12e)

It's inconsistent with the rest of basic ai for these to have a high
degree of state, plus like, such a waste yaknow?

[Implements
GET_TARGETING_STRATEGY](d79c29134d)

Regexes used:
new.*(/datum/targetting_datum[^,(]*)\(*\)* -> GET_TARGETING_STRATEGY($1)

Renamed all instances of targetting to targeting (also targetting datum
-> targeting strategy)

I've used GET_TARGETING_STRATEGY at the source where the keys are
actually used, rather then in the listing. This works out just fine.

## Why It's Good For The Game

Not a misspelled name through the whole codebase, very slightly less
memory load for basically no downside (slight cpu cost maybe but not a
significant one.

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
2023-11-09 14:44:24 +00:00

91 lines
3.0 KiB
Plaintext

/**
* Artificers
*
* Artificers will seek out and heal the most wounded construct or shade they can see.
* If there is no one to heal, they will run away from any non-allied mobs.
*/
/datum/ai_controller/basic_controller/artificer
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/same_faction/construct,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_WOUNDED_ONLY = TRUE,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_wounded_target,
/datum/ai_planning_subtree/basic_melee_attack_subtree,
/datum/ai_planning_subtree/target_retaliate/to_flee,
/datum/ai_planning_subtree/flee_target/from_flee_key,
)
/**
* Juggernauts
*
* Juggernauts slowly walk toward non-allied mobs and pummel them to death.
*/
/datum/ai_controller/basic_controller/juggernaut
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/attack_obstacle_in_path,
/datum/ai_planning_subtree/basic_melee_attack_subtree,
)
/**
* Proteons
*
* Proteons perform cowardly hit-and-run attacks, fleeing melee when struck but returning to fight again.
*/
/datum/ai_controller/basic_controller/proteon
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/target_retaliate/to_flee,
/datum/ai_planning_subtree/flee_target/from_flee_key,
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/attack_obstacle_in_path,
/datum/ai_planning_subtree/basic_melee_attack_subtree,
)
/**
* Wraiths
*
* Wraiths seek out the most injured non-allied mob to beat to death.
*/
/datum/ai_controller/basic_controller/wraith
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_wounded_target,
/datum/ai_planning_subtree/attack_obstacle_in_path,
/datum/ai_planning_subtree/basic_melee_attack_subtree,
)
/// Targeting strategy that will only allow mobs that constructs can heal.
/datum/targeting_strategy/basic/same_faction/construct
target_wounded_key = BB_TARGET_WOUNDED_ONLY
/datum/targeting_strategy/basic/same_faction/construct/can_attack(mob/living/living_mob, atom/the_target, vision_range, check_faction = TRUE)
if(isconstruct(the_target) || istype(the_target, /mob/living/basic/shade))
return ..()
return FALSE