[MIRROR] Targeting Datums Renamed (and global) [MDB IGNORE] (#24885)

* 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>

* Targeting Datums Renamed (and global)

* Update dogs.dm

* Modular

* Modular

* Modular

* Merge skew?

* Revert "Merge skew?"

This reverts commit 0889389ab5cb5c56655f1860d9173ba87efe9a22.

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-11-09 22:37:48 +01:00
committed by GitHub
parent 3a15520a9d
commit bbd547ec95
160 changed files with 446 additions and 441 deletions

View File

@@ -1,4 +1,5 @@
#define GET_AI_BEHAVIOR(behavior_type) SSai_behaviors.ai_behaviors[behavior_type]
#define GET_TARGETING_STRATEGY(targeting_type) SSai_behaviors.targeting_strategies[targeting_type]
#define HAS_AI_CONTROLLER_TYPE(thing, type) istype(thing?.ai_controller, type)
#define AI_STATUS_ON 1

View File

@@ -40,26 +40,28 @@
///Basic Mob Keys
///Targetting subtrees
///Targeting subtrees
#define BB_BASIC_MOB_CURRENT_TARGET "BB_basic_current_target"
#define BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION "BB_basic_current_target_hiding_location"
#define BB_TARGETTING_DATUM "targetting_datum"
#define BB_TARGETING_STRATEGY "targeting_strategy"
///some behaviors that check current_target also set this on deep crit mobs
#define BB_BASIC_MOB_EXECUTION_TARGET "BB_basic_execution_target"
///Blackboard key for a whitelist typecache of "things we can target while trying to move"
#define BB_OBSTACLE_TARGETTING_WHITELIST "BB_targetting_whitelist"
#define BB_OBSTACLE_TARGETING_WHITELIST "BB_targeting_whitelist"
/// Key for the minimum status at which we want to target mobs (does not need to be specified if CONSCIOUS)
#define BB_TARGET_MINIMUM_STAT "BB_target_minimum_stat"
/// Flag for whether to target only wounded mobs
#define BB_TARGET_WOUNDED_ONLY "BB_target_wounded_only"
/// What typepath the holding object targeting strategy should look for
#define BB_TARGET_HELD_ITEM "BB_target_held_item"
/// Blackboard key storing how long your targetting datum has held a particular target
/// Blackboard key storing how long your targeting strategy has held a particular target
#define BB_BASIC_MOB_HAS_TARGET_TIME "BB_basic_mob_has_target_time"
///Targetting keys for something to run away from, if you need to store this separately from current target
///Targeting keys for something to run away from, if you need to store this separately from current target
#define BB_BASIC_MOB_FLEE_TARGET "BB_basic_flee_target"
#define BB_BASIC_MOB_FLEE_TARGET_HIDING_LOCATION "BB_basic_flee_target_hiding_location"
#define BB_FLEE_TARGETTING_DATUM "flee_targetting_datum"
#define BB_FLEE_TARGETING_STRATEGY "flee_targeting_strategy"
#define BB_BASIC_MOB_FLEE_DISTANCE "BB_basic_flee_distance"
#define DEFAULT_BASIC_FLEE_DISTANCE 9
@@ -115,9 +117,9 @@
///Range for a MOD AI controller.
#define MOD_AI_RANGE 200
///should we skip the faction check for the targetting datum?
///should we skip the faction check for the targeting strategy?
#define BB_ALWAYS_IGNORE_FACTION "BB_always_ignore_factions"
///are we in some kind of temporary state of ignoring factions when targetting? can result in volatile results if multiple behaviours touch this
///are we in some kind of temporary state of ignoring factions when targeting? can result in volatile results if multiple behaviours touch this
#define BB_TEMPORARILY_IGNORE_FACTION "BB_temporarily_ignore_factions"
///currently only used by clowns, a list of what can the mob speak randomly

View File

@@ -7,9 +7,9 @@
/// Current target turf in your migration
#define BB_CARP_MIGRATION_TARGET "BB_carp_migration_target"
/// Targetting keys for magicarp spells
/// Targeting keys for magicarp spells
#define BB_MAGICARP_SPELL_TARGET "BB_magicarp_spell_target"
#define BB_MAGICARP_SPELL_SPECIAL_TARGETTING "BB_magicarp_spell_special_targetting"
#define BB_MAGICARP_SPELL_SPECIAL_TARGETING "BB_magicarp_spell_special_targeting"
#define MAGICARP_SPELL_CORPSES "magicarp_spell_corpses"
#define MAGICARP_SPELL_WALLS "magicarp_spell_walls"
#define MAGICARP_SPELL_OBJECTS "magicarp_spell_objects"

View File

@@ -4,6 +4,6 @@
/// Blackboard field for what we actually want the pet to target
#define BB_CURRENT_PET_TARGET "BB_current_pet_target"
/// Blackboard field for how we target things, as usually we want to be more permissive than normal
#define BB_PET_TARGETTING_DATUM "BB_pet_targetting"
#define BB_PET_TARGETING_STRATEGY "BB_pet_targeting"
/// Typecache of weakrefs to mobs this mob is friends with, will follow their instructions and won't attack them
#define BB_FRIENDS_LIST "BB_friends_list"

View File

@@ -3,7 +3,7 @@
/// Key that holds a vent that we want to exit out of (when we're already in a pipenet)
#define BB_EXIT_VENT_TARGET "BB_exit_vent_target"
/// Do we plan on going inside a vent? Boolean.
#define BB_CURRENTLY_TARGETTING_VENT "BB_currently_targetting_vent"
#define BB_CURRENTLY_TARGETING_VENT "BB_currently_targeting_vent"
/// How long should we wait before we try and enter a vent again?
#define BB_VENTCRAWL_COOLDOWN "BB_ventcrawl_cooldown"
/// The least amount of time (in seconds) we take to go through the vents.

View File

@@ -57,7 +57,7 @@
// VV HREF KEYS
#define VV_HK_TARGET "target"
#define VV_HK_VARNAME "targetvar" //name or index of var for 1 variable targetting hrefs.
#define VV_HK_VARNAME "targetvar" //name or index of var for 1 variable targeting hrefs.
// vv_do_list() keys
#define VV_HK_LIST_ADD "listadd"

View File

@@ -1,4 +1,4 @@
///Hud type with targetting dol and a nutrition bar
///Hud type with targeting dol and a nutrition bar
/datum/hud/ooze/New(mob/living/owner)
. = ..()

View File

@@ -8,9 +8,12 @@ PROCESSING_SUBSYSTEM_DEF(ai_behaviors)
wait = 1
///List of all ai_behavior singletons, key is the typepath while assigned value is a newly created instance of the typepath. See SetupAIBehaviors()
var/list/ai_behaviors
///List of all targeting_strategy singletons, key is the typepath while assigned value is a newly created instance of the typepath. See SetupAIBehaviors()
var/list/targeting_strategies
/datum/controller/subsystem/processing/ai_behaviors/Initialize()
SetupAIBehaviors()
SetupTargetingStrats()
return SS_INIT_SUCCESS
/datum/controller/subsystem/processing/ai_behaviors/proc/SetupAIBehaviors()
@@ -18,3 +21,9 @@ PROCESSING_SUBSYSTEM_DEF(ai_behaviors)
for(var/behavior_type in subtypesof(/datum/ai_behavior))
var/datum/ai_behavior/ai_behavior = new behavior_type
ai_behaviors[behavior_type] = ai_behavior
/datum/controller/subsystem/processing/ai_behaviors/proc/SetupTargetingStrats()
targeting_strategies = list()
for(var/target_type in subtypesof(/datum/targeting_strategy))
var/datum/targeting_strategy/target_start = new target_type
targeting_strategies[target_type] = target_start

View File

@@ -2,9 +2,9 @@
action_cooldown = 0.2 SECONDS // We gotta check unfortunately often because we're in a race condition with nextmove
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_REQUIRE_REACH | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/basic_melee_attack/setup(datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_melee_attack/setup(datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
. = ..()
if(!controller.blackboard_key_exists(targetting_datum_key))
if(!controller.blackboard[targeting_strategy_key])
CRASH("No target datum was supplied in the blackboard for [controller.pawn]")
//Hiding location is priority
@@ -14,7 +14,7 @@
set_movement_target(controller, target)
/datum/ai_behavior/basic_melee_attack/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_melee_attack/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
if (isliving(controller.pawn))
var/mob/living/pawn = controller.pawn
if (world.time < pawn.next_move)
@@ -22,15 +22,15 @@
. = ..()
var/mob/living/basic/basic_mob = controller.pawn
//targetting datum will kill the action if not real anymore
//targeting strategy will kill the action if not real anymore
var/atom/target = controller.blackboard[target_key]
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
if(!targetting_datum.can_attack(basic_mob, target))
if(!targeting_strategy.can_attack(basic_mob, target))
finish_action(controller, FALSE, target_key)
return
var/hiding_target = targetting_datum.find_hidden_mobs(basic_mob, target) //If this is valid, theyre hidden in something!
var/hiding_target = targeting_strategy.find_hidden_mobs(basic_mob, target) //If this is valid, theyre hidden in something!
controller.set_blackboard_key(hiding_location_key, hiding_target)
@@ -40,7 +40,7 @@
basic_mob.melee_attack(target)
/datum/ai_behavior/basic_melee_attack/finish_action(datum/ai_controller/controller, succeeded, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_melee_attack/finish_action(datum/ai_controller/controller, succeeded, target_key, targeting_strategy_key, hiding_location_key)
. = ..()
if(!succeeded)
controller.clear_blackboard_key(target_key)
@@ -54,30 +54,30 @@
///do we care about avoiding friendly fire?
var/avoid_friendly_fire = FALSE
/datum/ai_behavior/basic_ranged_attack/setup(datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_ranged_attack/setup(datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
. = ..()
var/atom/target = controller.blackboard[hiding_location_key] || controller.blackboard[target_key]
if(QDELETED(target))
return FALSE
set_movement_target(controller, target)
/datum/ai_behavior/basic_ranged_attack/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_ranged_attack/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
var/mob/living/basic/basic_mob = controller.pawn
//targetting datum will kill the action if not real anymore
//targeting strategy will kill the action if not real anymore
var/atom/target = controller.blackboard[target_key]
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
if(!targetting_datum.can_attack(basic_mob, target, chase_range))
if(!targeting_strategy.can_attack(basic_mob, target, chase_range))
finish_action(controller, FALSE, target_key)
return
var/atom/hiding_target = targetting_datum.find_hidden_mobs(basic_mob, target) //If this is valid, theyre hidden in something!
var/atom/hiding_target = targeting_strategy.find_hidden_mobs(basic_mob, target) //If this is valid, theyre hidden in something!
var/atom/final_target = hiding_target ? hiding_target : target
if(!can_see(basic_mob, final_target, required_distance))
return
if(avoid_friendly_fire && check_friendly_in_path(basic_mob, target, targetting_datum))
if(avoid_friendly_fire && check_friendly_in_path(basic_mob, target, targeting_strategy))
adjust_position(basic_mob, target)
return ..()
@@ -85,17 +85,17 @@
basic_mob.RangedAttack(final_target)
return ..() //only start the cooldown when the shot is shot
/datum/ai_behavior/basic_ranged_attack/finish_action(datum/ai_controller/controller, succeeded, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_ranged_attack/finish_action(datum/ai_controller/controller, succeeded, target_key, targeting_strategy_key, hiding_location_key)
. = ..()
if(!succeeded)
controller.clear_blackboard_key(target_key)
/datum/ai_behavior/basic_ranged_attack/proc/check_friendly_in_path(mob/living/source, atom/target, datum/targetting_datum/targetting_datum)
/datum/ai_behavior/basic_ranged_attack/proc/check_friendly_in_path(mob/living/source, atom/target, datum/targeting_strategy/targeting_strategy)
var/list/turfs_list = calculate_trajectory(source, target)
for(var/turf/possible_turf as anything in turfs_list)
for(var/mob/living/potential_friend in possible_turf)
if(!targetting_datum.can_attack(source, potential_friend))
if(!targeting_strategy.can_attack(source, potential_friend))
return TRUE
return FALSE

View File

@@ -7,16 +7,16 @@
/// Static typecache list of potentially dangerous objs
var/static/list/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/vehicle/sealed/mecha))
/datum/ai_behavior/find_potential_targets/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/find_potential_targets/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
. = ..()
var/mob/living/living_mob = controller.pawn
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
if(!targetting_datum)
if(!targeting_strategy)
CRASH("No target datum was supplied in the blackboard for [controller.pawn]")
var/atom/current_target = controller.blackboard[target_key]
if (targetting_datum.can_attack(living_mob, current_target, vision_range))
if (targeting_strategy.can_attack(living_mob, current_target, vision_range))
finish_action(controller, succeeded = FALSE)
return
@@ -37,7 +37,7 @@
var/list/filtered_targets = list()
for(var/atom/pot_target in potential_targets)
if(targetting_datum.can_attack(living_mob, pot_target))//Can we attack it?
if(targeting_strategy.can_attack(living_mob, pot_target))//Can we attack it?
filtered_targets += pot_target
continue
@@ -48,7 +48,7 @@
var/atom/target = pick_final_target(controller, filtered_targets)
controller.set_blackboard_key(target_key, target)
var/atom/potential_hiding_location = targetting_datum.find_hidden_mobs(living_mob, target)
var/atom/potential_hiding_location = targeting_strategy.find_hidden_mobs(living_mob, target)
if(potential_hiding_location) //If they're hiding inside of something, we need to know so we can go for that instead initially.
controller.set_blackboard_key(hiding_location_key, potential_hiding_location)

View File

@@ -18,7 +18,7 @@
. = ..()
var/obj/machinery/atmospherics/components/unary/vent_pump/entry_vent = controller.blackboard[target_key] || controller.blackboard[BB_ENTRY_VENT_TARGET]
var/mob/living/cached_pawn = controller.pawn
if(HAS_TRAIT(cached_pawn, TRAIT_MOVE_VENTCRAWLING) || !controller.blackboard[BB_CURRENTLY_TARGETTING_VENT] || !is_vent_valid(entry_vent))
if(HAS_TRAIT(cached_pawn, TRAIT_MOVE_VENTCRAWLING) || !controller.blackboard[BB_CURRENTLY_TARGETING_VENT] || !is_vent_valid(entry_vent))
return
if(!cached_pawn.can_enter_vent(entry_vent, provide_feedback = FALSE)) // we're an AI we scoff at feedback
@@ -30,7 +30,7 @@
finish_action(controller, FALSE, target_key)
return
controller.set_blackboard_key(BB_CURRENTLY_TARGETTING_VENT, FALSE) // must be done here because we have a do_after sleep in handle_ventcrawl unfortunately and double dipping could lead to erroneous suicide pill calls.
controller.set_blackboard_key(BB_CURRENTLY_TARGETING_VENT, FALSE) // must be done here because we have a do_after sleep in handle_ventcrawl unfortunately and double dipping could lead to erroneous suicide pill calls.
cached_pawn.handle_ventcrawl(entry_vent)
if(!HAS_TRAIT(cached_pawn, TRAIT_MOVE_VENTCRAWLING)) //something failed and we ARE NOT IN THE VENT even though the earlier check said we were good to go! odd.
finish_action(controller, FALSE, target_key)
@@ -134,5 +134,5 @@
controller.clear_blackboard_key(target_key)
controller.clear_blackboard_key(BB_ENTRY_VENT_TARGET)
controller.clear_blackboard_key(BB_EXIT_VENT_TARGET)
controller.set_blackboard_key(BB_CURRENTLY_TARGETTING_VENT, FALSE) // just in case
controller.set_blackboard_key(BB_CURRENTLY_TARGETING_VENT, FALSE) // just in case

View File

@@ -12,19 +12,19 @@
var/mob/living/pawn = controller.pawn
if (LAZYLEN(pawn.do_afters))
return
controller.queue_behavior(melee_attack_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
controller.queue_behavior(melee_attack_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
/// Attack something which is already adjacent to us without moving
/datum/ai_behavior/basic_melee_attack/opportunistic
action_cooldown = 0.2 SECONDS // We gotta check unfortunately often because we're in a race condition with nextmove
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/basic_melee_attack/opportunistic/setup(datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
if (!controller.blackboard_key_exists(targetting_datum_key))
/datum/ai_behavior/basic_melee_attack/opportunistic/setup(datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
if (!controller.blackboard_key_exists(targeting_strategy_key))
CRASH("No target datum was supplied in the blackboard for [controller.pawn]")
return controller.blackboard_key_exists(target_key)
/datum/ai_behavior/basic_melee_attack/opportunistic/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_melee_attack/opportunistic/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
var/atom/movable/atom_pawn = controller.pawn
if(!atom_pawn.CanReach(controller.blackboard[target_key]))
finish_action(controller, TRUE, target_key) // Don't clear target

View File

@@ -74,7 +74,7 @@
return FALSE
if (basic_mob.see_invisible < object.invisibility)
return FALSE
var/list/whitelist = basic_mob.ai_controller.blackboard[BB_OBSTACLE_TARGETTING_WHITELIST]
var/list/whitelist = basic_mob.ai_controller.blackboard[BB_OBSTACLE_TARGETING_WHITELIST]
if(whitelist && !is_type_in_typecache(object, whitelist))
return FALSE

View File

@@ -1,19 +1,19 @@
/// Add or remove people to our retaliation shitlist just on an arbitrary whim
/datum/ai_planning_subtree/capricious_retaliate
/// Blackboard key which tells us how to select valid targets
var/targetting_datum_key = BB_TARGETTING_DATUM
var/targeting_strategy_key = BB_TARGETING_STRATEGY
/// Whether we should skip checking faction for our decision
var/ignore_faction = TRUE
/datum/ai_planning_subtree/capricious_retaliate/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
. = ..()
controller.queue_behavior(/datum/ai_behavior/capricious_retaliate, targetting_datum_key, ignore_faction)
controller.queue_behavior(/datum/ai_behavior/capricious_retaliate, targeting_strategy_key, ignore_faction)
/// Add or remove people to our retaliation shitlist just on an arbitrary whim
/datum/ai_behavior/capricious_retaliate
action_cooldown = 1 SECONDS
/datum/ai_behavior/capricious_retaliate/perform(seconds_per_tick, datum/ai_controller/controller, targetting_datum_key, ignore_faction)
/datum/ai_behavior/capricious_retaliate/perform(seconds_per_tick, datum/ai_controller/controller, targeting_strategy_key, ignore_faction)
. = ..()
var/atom/pawn = controller.pawn
if (controller.blackboard_key_exists(BB_BASIC_MOB_RETALIATE_LIST))
@@ -35,10 +35,10 @@
var/aggro_range = controller.blackboard[BB_AGGRO_RANGE] || 9
var/list/potential_targets = hearers(aggro_range, get_turf(pawn)) - pawn
if (!length(potential_targets))
failed_targetting(controller, pawn, ignore_faction)
failed_targeting(controller, pawn, ignore_faction)
return
var/datum/targetting_datum/target_helper = controller.blackboard[targetting_datum_key]
var/datum/targeting_strategy/target_helper = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
var/mob/living/final_target = null
if (ignore_faction)
@@ -49,7 +49,7 @@
final_target = test_target
if (isnull(final_target))
failed_targetting(controller, pawn, ignore_faction)
failed_targeting(controller, pawn, ignore_faction)
return
controller.insert_blackboard_key_lazylist(BB_BASIC_MOB_RETALIATE_LIST, final_target)
@@ -57,7 +57,7 @@
finish_action(controller, TRUE, ignore_faction)
/// Called if we try but fail to target something
/datum/ai_behavior/capricious_retaliate/proc/failed_targetting(datum/ai_controller/controller, atom/pawn, ignore_faction)
/datum/ai_behavior/capricious_retaliate/proc/failed_targeting(datum/ai_controller/controller, atom/pawn, ignore_faction)
finish_action(controller, FALSE, ignore_faction)
pawn.visible_message(span_notice("[pawn] grumbles.")) // We're pissed off but with no outlet to vent our frustration upon

View File

@@ -20,7 +20,7 @@
return SUBTREE_RETURN_FINISH_PLANNING //we gotta get out of here.
/// Try to escape from your current target, without performing any other actions.
/// Reads from some fleeing-specific targetting keys rather than the current mob target.
/// Reads from some fleeing-specific targeting keys rather than the current mob target.
/datum/ai_planning_subtree/flee_target/from_flee_key
target_key = BB_BASIC_MOB_FLEE_TARGET
hiding_place_key = BB_BASIC_MOB_FLEE_TARGET_HIDING_LOCATION

View File

@@ -15,6 +15,6 @@
controller.queue_behavior(/datum/ai_behavior/travel_towards, BB_ENTRY_VENT_TARGET)
return
controller.set_blackboard_key(BB_CURRENTLY_TARGETTING_VENT, TRUE)
controller.set_blackboard_key(BB_CURRENTLY_TARGETING_VENT, TRUE)
controller.queue_behavior(/datum/ai_behavior/crawl_through_vents, BB_ENTRY_VENT_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING // we are going into this vent... no distractions

View File

@@ -14,30 +14,30 @@
. = ..()
if(!controller.blackboard_key_exists(target_key))
return
controller.queue_behavior(attack_behavior, target_key, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION, max_range, min_range)
controller.queue_behavior(attack_behavior, target_key, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION, max_range, min_range)
/// How often will we try to perform our ranged attack?
/datum/ai_behavior/ranged_skirmish
action_cooldown = 1 SECONDS
/datum/ai_behavior/ranged_skirmish/setup(datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key, max_range, min_range)
/datum/ai_behavior/ranged_skirmish/setup(datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key, max_range, min_range)
. = ..()
var/atom/target = controller.blackboard[hiding_location_key] || controller.blackboard[target_key]
return !QDELETED(target)
/datum/ai_behavior/ranged_skirmish/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key, max_range, min_range)
/datum/ai_behavior/ranged_skirmish/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key, max_range, min_range)
. = ..()
var/atom/target = controller.blackboard[target_key]
if (QDELETED(target))
finish_action(controller, succeeded = FALSE)
return
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
if(!targetting_datum.can_attack(controller.pawn, target))
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
if(!targeting_strategy.can_attack(controller.pawn, target))
finish_action(controller, succeeded = FALSE)
return
var/hiding_target = targetting_datum.find_hidden_mobs(controller.pawn, target)
var/hiding_target = targeting_strategy.find_hidden_mobs(controller.pawn, target)
controller.set_blackboard_key(hiding_location_key, hiding_target)
target = hiding_target || target

View File

@@ -8,7 +8,7 @@
. = ..()
if(!controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
return
controller.queue_behavior(melee_attack_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
controller.queue_behavior(melee_attack_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
if (end_planning)
return SUBTREE_RETURN_FINISH_PLANNING //we are going into battle...no distractions.
@@ -20,5 +20,5 @@
. = ..()
if(!controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
return
controller.queue_behavior(ranged_attack_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
controller.queue_behavior(ranged_attack_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
return SUBTREE_RETURN_FINISH_PLANNING //we are going into battle...no distractions.

View File

@@ -5,11 +5,11 @@
. = ..()
if (controller.blackboard[BB_BASIC_MOB_STOP_FLEEING])
return
controller.queue_behavior(/datum/ai_behavior/find_potential_targets/nearest, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
controller.queue_behavior(/datum/ai_behavior/find_potential_targets/nearest, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
/// Find the nearest thing on our list of 'things which have done damage to me' and set it as the flee target
/datum/ai_planning_subtree/find_nearest_thing_which_attacked_me_to_flee
var/targeting_key = BB_TARGETTING_DATUM
var/targeting_key = BB_TARGETING_STRATEGY
/datum/ai_planning_subtree/find_nearest_thing_which_attacked_me_to_flee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
. = ..()
@@ -18,4 +18,4 @@
controller.queue_behavior(/datum/ai_behavior/target_from_retaliate_list/nearest, BB_BASIC_MOB_RETALIATE_LIST, BB_BASIC_MOB_CURRENT_TARGET, targeting_key, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
/datum/ai_planning_subtree/find_nearest_thing_which_attacked_me_to_flee/from_flee_key
targeting_key = BB_FLEE_TARGETTING_DATUM
targeting_key = BB_FLEE_TARGETING_STRATEGY

View File

@@ -2,7 +2,7 @@
/datum/ai_planning_subtree/simple_find_target/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
. = ..()
controller.queue_behavior(/datum/ai_behavior/find_potential_targets, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
controller.queue_behavior(/datum/ai_behavior/find_potential_targets, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
// Prevents finding a target if a human is nearby
/datum/ai_planning_subtree/simple_find_target/not_while_observed

View File

@@ -3,4 +3,4 @@
/datum/ai_planning_subtree/simple_find_wounded_target/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
. = ..()
controller.queue_behavior(/datum/ai_behavior/find_potential_targets/most_wounded, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
controller.queue_behavior(/datum/ai_behavior/find_potential_targets/most_wounded, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)

View File

@@ -2,7 +2,7 @@
/datum/ai_planning_subtree/target_retaliate
operational_datums = list(/datum/element/ai_retaliate, /datum/component/ai_retaliate_advanced)
/// Blackboard key which tells us how to select valid targets
var/targetting_datum_key = BB_TARGETTING_DATUM
var/targeting_strategy_key = BB_TARGETING_STRATEGY
/// Blackboard key in which to store selected target
var/target_key = BB_BASIC_MOB_CURRENT_TARGET
/// Blackboard key in which to store selected target's hiding place
@@ -12,16 +12,16 @@
/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, targetting_datum_key, hiding_place_key, check_faction)
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
check_faction = TRUE
/// Places a mob which you can see and who has recently attacked you into some 'run away from this' AI keys
/// Can use a different targetting datum than you use to select attack targets
/// Can use a different targeting strategy than you use to select attack targets
/// Not required if fleeing is the only target behaviour or uses the same target datum
/datum/ai_planning_subtree/target_retaliate/to_flee
targetting_datum_key = BB_FLEE_TARGETTING_DATUM
targeting_strategy_key = BB_FLEE_TARGETING_STRATEGY
target_key = BB_BASIC_MOB_FLEE_TARGET
hiding_place_key = BB_BASIC_MOB_FLEE_TARGET_HIDING_LOCATION
@@ -34,11 +34,11 @@
/// How far can we see stuff?
var/vision_range = 9
/datum/ai_behavior/target_from_retaliate_list/perform(seconds_per_tick, datum/ai_controller/controller, shitlist_key, target_key, targetting_datum_key, hiding_location_key, check_faction)
/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/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
if(!targetting_datum)
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
if(!targeting_strategy)
CRASH("No target datum was supplied in the blackboard for [controller.pawn]")
var/list/shitlist = controller.blackboard[shitlist_key]
@@ -47,13 +47,13 @@
if (!check_faction)
controller.set_blackboard_key(BB_TEMPORARILY_IGNORE_FACTION, TRUE)
if (!QDELETED(existing_target) && (locate(existing_target) in shitlist) && targetting_datum.can_attack(living_mob, existing_target, vision_range))
if (!QDELETED(existing_target) && (locate(existing_target) in shitlist) && targeting_strategy.can_attack(living_mob, existing_target, vision_range))
finish_action(controller, succeeded = TRUE, check_faction = check_faction)
return
var/list/enemies_list = list()
for(var/mob/living/potential_target as anything in shitlist)
if(!targetting_datum.can_attack(living_mob, potential_target, vision_range))
if(!targeting_strategy.can_attack(living_mob, potential_target, vision_range))
continue
enemies_list += potential_target
@@ -65,7 +65,7 @@
var/atom/new_target = pick_final_target(controller, enemies_list)
controller.set_blackboard_key(target_key, new_target)
var/atom/potential_hiding_location = targetting_datum.find_hidden_mobs(living_mob, new_target)
var/atom/potential_hiding_location = targeting_strategy.find_hidden_mobs(living_mob, new_target)
if(potential_hiding_location) //If they're hiding inside of something, we need to know so we can go for that instead initially.
controller.set_blackboard_key(hiding_location_key, potential_hiding_location)

View File

@@ -1,7 +1,7 @@
/// The most basic AI tree which just finds a guy and then runs at them to click them
/datum/ai_controller/basic_controller/simple_hostile
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance
@@ -14,7 +14,7 @@
/// Find a target, walk at target, attack intervening obstacles
/datum/ai_controller/basic_controller/simple_hostile_obstacles
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -1,18 +1,19 @@
///Datum for basic mobs to define what they can attack.
/datum/targetting_datum
///Datum for basic mobs to define what they can attack.GET_TARGETING_STRATEGY\((/[^,]*)\),
///Global, just like ai_behaviors
/datum/targeting_strategy
///Returns true or false depending on if the target can be attacked by the mob
/datum/targetting_datum/proc/can_attack(mob/living/living_mob, atom/target, vision_range)
/datum/targeting_strategy/proc/can_attack(mob/living/living_mob, atom/target, vision_range)
return
///Returns something the target might be hiding inside of
/datum/targetting_datum/proc/find_hidden_mobs(mob/living/living_mob, atom/target)
/datum/targeting_strategy/proc/find_hidden_mobs(mob/living/living_mob, atom/target)
var/atom/target_hiding_location
if(istype(target.loc, /obj/structure/closet) || istype(target.loc, /obj/machinery/disposal) || istype(target.loc, /obj/machinery/sleeper))
target_hiding_location = target.loc
return target_hiding_location
/datum/targetting_datum/basic
/datum/targeting_strategy/basic
/// When we do our basic faction check, do we look for exact faction matches?
var/check_factions_exactly = FALSE
/// Whether we care for seeing the target or not
@@ -22,7 +23,7 @@
/// If this blackboard key is TRUE, makes us only target wounded mobs
var/target_wounded_key
/datum/targetting_datum/basic/can_attack(mob/living/living_mob, atom/the_target, vision_range)
/datum/targeting_strategy/basic/can_attack(mob/living/living_mob, atom/the_target, vision_range)
var/datum/ai_controller/basic_controller/our_controller = living_mob.ai_controller
if(isnull(our_controller))
@@ -82,29 +83,29 @@
return FALSE
/// Returns true if the mob and target share factions
/datum/targetting_datum/basic/proc/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
/datum/targeting_strategy/basic/proc/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
if (controller.blackboard[BB_ALWAYS_IGNORE_FACTION] || controller.blackboard[BB_TEMPORARILY_IGNORE_FACTION])
return FALSE
return living_mob.faction_check_atom(the_target, exact_match = check_factions_exactly)
/// Subtype more forgiving for items.
/// Careful, this can go wrong and keep a mob hyper-focused on an item it can't lose aggro on
/datum/targetting_datum/basic/allow_items
/datum/targeting_strategy/basic/allow_items
/datum/targetting_datum/basic/allow_items/can_attack(mob/living/living_mob, atom/the_target, vision_range)
/datum/targeting_strategy/basic/allow_items/can_attack(mob/living/living_mob, atom/the_target, vision_range)
. = ..()
if(isitem(the_target))
// trust fall exercise
return TRUE
/// Subtype which searches for mobs of a size relative to ours
/datum/targetting_datum/basic/of_size
/datum/targeting_strategy/basic/of_size
/// If true, we will return mobs which are smaller than us. If false, larger.
var/find_smaller = TRUE
/// If true, we will return mobs which are the same size as us.
var/inclusive = TRUE
/datum/targetting_datum/basic/of_size/can_attack(mob/living/owner, atom/target, vision_range)
/datum/targeting_strategy/basic/of_size/can_attack(mob/living/owner, atom/target, vision_range)
if(!isliving(target))
return FALSE
. = ..()
@@ -119,14 +120,14 @@
return !find_smaller
// This is just using the default values but the subtype makes it clearer
/datum/targetting_datum/basic/of_size/ours_or_smaller
/datum/targeting_strategy/basic/of_size/ours_or_smaller
/datum/targetting_datum/basic/of_size/larger
/datum/targeting_strategy/basic/of_size/larger
find_smaller = FALSE
inclusive = FALSE
/// Makes the mob only attack their own faction. Useful mostly if their attacks do something helpful (e.g. healing touch).
/datum/targetting_datum/basic/same_faction
/datum/targeting_strategy/basic/same_faction
/datum/targetting_datum/basic/same_faction/faction_check(mob/living/living_mob, mob/living/the_target)
/datum/targeting_strategy/basic/same_faction/faction_check(mob/living/living_mob, mob/living/the_target)
return !..() // inverts logic to ONLY target mobs that share a faction

View File

@@ -1,12 +1,12 @@
/// Don't target an atom in our friends list (or turfs), anything else is fair game
/datum/targetting_datum/basic/not_friends
/datum/targeting_strategy/basic/not_friends
/// Stop regarding someone as a valid target once they pass this stat level, setting it to DEAD means you will happily attack corpses
var/attack_until_past_stat = HARD_CRIT
/// If we can try to closed turfs or not
var/attack_closed_turf = FALSE
///Returns true or false depending on if the target can be attacked by the mob
/datum/targetting_datum/basic/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
/datum/targeting_strategy/basic/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
if(attack_closed_turf && isclosedturf(target))
return TRUE
@@ -16,16 +16,16 @@
return ..()
///friends dont care about factions
/datum/targetting_datum/basic/not_friends/faction_check(mob/living/living_mob, mob/living/the_target)
/datum/targeting_strategy/basic/not_friends/faction_check(mob/living/living_mob, mob/living/the_target)
return FALSE
/datum/targetting_datum/basic/not_friends/attack_closed_turfs
/datum/targeting_strategy/basic/not_friends/attack_closed_turfs
attack_closed_turf = TRUE
/// Subtype that allows us to target items while deftly avoiding attacking our allies. Be careful when it comes to targetting items as an AI could get trapped targetting something it can't destroy.
/datum/targetting_datum/basic/not_friends/allow_items
/// Subtype that allows us to target items while deftly avoiding attacking our allies. Be careful when it comes to targeting items as an AI could get trapped targeting something it can't destroy.
/datum/targeting_strategy/basic/not_friends/allow_items
/datum/targetting_datum/basic/not_friends/allow_items/can_attack(mob/living/living_mob, atom/the_target, vision_range)
/datum/targeting_strategy/basic/not_friends/allow_items/can_attack(mob/living/living_mob, atom/the_target, vision_range)
. = ..()
if(isitem(the_target))
// trust fall exercise

View File

@@ -0,0 +1,29 @@
/**
* Find mobs who are holding the bb configurable object type
*
* This is an extension of basic targeting behaviour, that allows you to
* only target the mob if they have a specific item in their hand.
*
*/
/datum/targeting_strategy/basic/holding_object
/// BB key that holds the target typepath to use
var/target_item_key = BB_TARGET_HELD_ITEM
///Returns true or false depending on if the target can be attacked by the mob
/datum/targeting_strategy/basic/holding_object/can_attack(mob/living/living_mob, atom/target, vision_range)
var/datum/ai_controller/controller = living_mob.ai_controller
var/object_type_path = controller.blackboard[target_item_key]
if (object_type_path == null)
return FALSE // no op
if(!ismob(target))
return FALSE // no hands no problems
// Look at me, type casting like a grown up
var/mob/targetmob = target
// Check if our parent behaviour agrees we can attack this target (we ignore faction by default)
var/can_attack = ..()
if(can_attack && targetmob.is_holding_item_of_type(object_type_path))
return TRUE // they have the item
// No valid target
return FALSE

View File

@@ -1,39 +0,0 @@
/**
* Find mobs who are holding the configurable object type
*
* This is an extension of basic targeting behaviour, that allows you to
* only target the mob if they have a specific item in their hand.
*
*/
/datum/targetting_datum/basic/holding_object
// We will find mobs who are holding this object in their hands
var/object_type_path = null
/**
* Create an instance of the holding object targeting datum
*
* * object_type_path Pass an object type path, this will be compared to the items
* in targets hands to filter the target list.
*/
/datum/targetting_datum/basic/holding_object/New(object_type_path)
if (!ispath(object_type_path))
stack_trace("trying to create an item targeting datum with no valid typepath")
// Leaving object type as null will make this basically a noop
return
src.object_type_path = object_type_path
///Returns true or false depending on if the target can be attacked by the mob
/datum/targetting_datum/basic/holding_object/can_attack(mob/living/living_mob, atom/target, vision_range)
if (object_type_path == null)
return FALSE // no op
if(!ismob(target))
return FALSE // no hands no problems
// Look at me, type casting like a grown up
var/mob/targetmob = target
// Check if our parent behaviour agrees we can attack this target (we ignore faction by default)
var/can_attack = ..()
if(can_attack && targetmob.is_holding_item_of_type(object_type_path))
return TRUE // they have the item
// No valid target
return FALSE

View File

@@ -7,18 +7,18 @@
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM
required_distance = 3
/datum/ai_behavior/basic_melee_attack/dog/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_melee_attack/dog/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
controller.behavior_cooldowns[src] = world.time + action_cooldown
var/mob/living/living_pawn = controller.pawn
if(!(isturf(living_pawn.loc) || HAS_TRAIT(living_pawn, TRAIT_AI_BAGATTACK))) // Void puppies can attack from inside bags
finish_action(controller, FALSE, target_key, targetting_datum_key, hiding_location_key)
finish_action(controller, FALSE, target_key, targeting_strategy_key, hiding_location_key)
return
// Unfortunately going to repeat this check in parent call but what can you do
var/atom/target = controller.blackboard[target_key]
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
if (!targetting_datum.can_attack(living_pawn, target))
finish_action(controller, FALSE, target_key, targetting_datum_key, hiding_location_key)
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
if (!targeting_strategy.can_attack(living_pawn, target))
finish_action(controller, FALSE, target_key, targeting_strategy_key, hiding_location_key)
return
if (!living_pawn.Adjacent(target))

View File

@@ -2,7 +2,7 @@
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_dog
@@ -19,9 +19,11 @@
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
// Find nearby mobs with tongs in hand.
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/holding_object(/obj/item/kitchen/tongs),
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
// Find nearby mobs ...
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/holding_object,
// With tongs in hand!
BB_TARGET_HELD_ITEM = /obj/item/kitchen/tongs,
BB_BABIES_PARTNER_TYPES = list(/mob/living/basic/pet/dog),
BB_BABIES_CHILD_TYPES = list(/mob/living/basic/pet/dog/corgi/puppy = 95, /mob/living/basic/pet/dog/corgi/puppy/void = 5),
)
@@ -31,7 +33,7 @@
/datum/ai_planning_subtree/make_babies, // Ian WILL prioritise sex over following your instructions
/datum/ai_planning_subtree/pet_planning,
/datum/ai_planning_subtree/dog_harassment,
// Find targets to run away from (uses the targetting datum from above)
// Find targets to run away from (uses the targeting strategy from above)
/datum/ai_planning_subtree/simple_find_target,
// Flee from that target
/datum/ai_planning_subtree/flee_target,

View File

@@ -4,27 +4,27 @@
/datum/ai_planning_subtree/dog_harassment/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
if(!SPT_PROB(10, seconds_per_tick))
return
controller.queue_behavior(/datum/ai_behavior/find_hated_dog_target, BB_DOG_HARASS_TARGET, BB_PET_TARGETTING_DATUM)
controller.queue_behavior(/datum/ai_behavior/find_hated_dog_target, BB_DOG_HARASS_TARGET, BB_PET_TARGETING_STRATEGY)
var/atom/harass_target = controller.blackboard[BB_DOG_HARASS_TARGET]
if (isnull(harass_target))
return
controller.queue_behavior(/datum/ai_behavior/basic_melee_attack/dog, BB_DOG_HARASS_TARGET, BB_PET_TARGETTING_DATUM)
controller.queue_behavior(/datum/ai_behavior/basic_melee_attack/dog, BB_DOG_HARASS_TARGET, BB_PET_TARGETING_STRATEGY)
return SUBTREE_RETURN_FINISH_PLANNING
/datum/ai_behavior/find_hated_dog_target
/datum/ai_behavior/find_hated_dog_target/setup(datum/ai_controller/controller, target_key, targetting_datum_key)
/datum/ai_behavior/find_hated_dog_target/setup(datum/ai_controller/controller, target_key, targeting_strategy_key)
. = ..()
var/mob/living/dog = controller.pawn
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key]
var/datum/targeting_strategy/targeting_strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
for(var/mob/living/iter_living in oview(2, dog))
if(iter_living.stat != CONSCIOUS || !HAS_TRAIT(iter_living, TRAIT_HATED_BY_DOGS))
continue
if(!isnull(dog.buckled))
dog.audible_message(span_notice("[dog] growls at [iter_living], yet [dog.p_they()] [dog.p_are()] much too comfy to move."), hearing_distance = COMBAT_MESSAGE_RANGE)
continue
if(!targetting_datum.can_attack(dog, iter_living))
if(!targeting_strategy.can_attack(dog, iter_living))
continue
dog.audible_message(span_warning("[dog] growls at [iter_living], seemingly annoyed by [iter_living.p_their()] presence."), hearing_distance = COMBAT_MESSAGE_RANGE)

View File

@@ -26,8 +26,8 @@
var/valid_biotypes
/// Which kinds of carbon limbs can we heal, has no effect on non-carbon mobs. Set to null if you don't care about excluding prosthetics.
var/required_bodytype
/// How targetting yourself works, expects one of HEALING_TOUCH_ANYONE, HEALING_TOUCH_NOT_SELF, or HEALING_TOUCH_SELF_ONLY
var/self_targetting
/// How targeting yourself works, expects one of HEALING_TOUCH_ANYONE, HEALING_TOUCH_NOT_SELF, or HEALING_TOUCH_SELF_ONLY
var/self_targeting
/// Text to print when action starts, replaces %SOURCE% with healer and %TARGET% with healed mob
var/action_text
/// Text to print when action completes, replaces %SOURCE% with healer and %TARGET% with healed mob
@@ -47,7 +47,7 @@
list/valid_targets_typecache = list(),
valid_biotypes = MOB_ORGANIC | MOB_MINERAL,
required_bodytype = BODYTYPE_ORGANIC,
self_targetting = HEALING_TOUCH_NOT_SELF,
self_targeting = HEALING_TOUCH_NOT_SELF,
action_text = "%SOURCE% begins healing %TARGET%",
complete_text = "%SOURCE% finishes healing %TARGET%",
show_health = FALSE,
@@ -65,7 +65,7 @@
src.valid_targets_typecache = valid_targets_typecache.Copy()
src.valid_biotypes = valid_biotypes
src.required_bodytype = required_bodytype
src.self_targetting = self_targetting
src.self_targeting = self_targeting
src.action_text = action_text
src.complete_text = complete_text
src.show_health = show_health
@@ -98,7 +98,7 @@
healer.balloon_alert(healer, "busy!")
return COMPONENT_CANCEL_ATTACK_CHAIN
switch (self_targetting)
switch (self_targeting)
if (HEALING_TOUCH_NOT_SELF)
if (target == healer)
healer.balloon_alert(healer, "can't heal yourself!")

View File

@@ -8,13 +8,13 @@
*/
/datum/component/lock_on_cursor
dupe_mode = COMPONENT_DUPE_ALLOWED
/// Appearance to overlay onto whatever we are targetting
/// Appearance to overlay onto whatever we are targeting
var/mutable_appearance/lock_appearance
/// Current images we are displaying to the client
var/list/image/lock_images
/// Typecache of things we are allowed to target
var/list/target_typecache
/// Cache of weakrefs to ignore targetting formatted as `list(weakref = TRUE)`
/// Cache of weakrefs to ignore targeting formatted as `list(weakref = TRUE)`
var/list/immune_weakrefs
/// Number of things we can target at once
var/lock_amount

View File

@@ -3,7 +3,7 @@
* Watch for someone throwing or pointing at something and then go get it and bring it back.
* If it's food we might eat it instead.
*/
/datum/pet_command/point_targetting/fetch
/datum/pet_command/point_targeting/fetch
command_name = "Fetch"
command_desc = "Command your pet to retrieve something you throw or point at."
radial_icon = 'icons/mob/actions/actions_spells.dmi'
@@ -16,22 +16,22 @@
/// If true, this is a poorly trained pet who will eat food you throw instead of bringing it back
var/will_eat_targets = TRUE
/datum/pet_command/point_targetting/fetch/New(mob/living/parent)
/datum/pet_command/point_targeting/fetch/New(mob/living/parent)
. = ..()
if(isnull(parent))
return
parent.AddElement(/datum/element/ai_held_item) // We don't remove this on destroy because they might still be holding something
/datum/pet_command/point_targetting/fetch/add_new_friend(mob/living/tamer)
/datum/pet_command/point_targeting/fetch/add_new_friend(mob/living/tamer)
. = ..()
RegisterSignal(tamer, COMSIG_MOB_THROW, PROC_REF(listened_throw))
/datum/pet_command/point_targetting/fetch/remove_friend(mob/living/unfriended)
/datum/pet_command/point_targeting/fetch/remove_friend(mob/living/unfriended)
. = ..()
UnregisterSignal(unfriended, COMSIG_MOB_THROW)
/// A friend has thrown something, if we're listening or at least not busy then go get it
/datum/pet_command/point_targetting/fetch/proc/listened_throw(mob/living/carbon/thrower)
/datum/pet_command/point_targeting/fetch/proc/listened_throw(mob/living/carbon/thrower)
SIGNAL_HANDLER
var/mob/living/parent = weak_parent.resolve()
@@ -57,7 +57,7 @@
RegisterSignal(thrown_thing, COMSIG_MOVABLE_THROW_LANDED, PROC_REF(listen_throw_land))
/// A throw we were listening to has finished, see if it's in range for us to try grabbing it
/datum/pet_command/point_targetting/fetch/proc/listen_throw_land(obj/item/thrown_thing, datum/thrownthing/throwing_datum)
/datum/pet_command/point_targeting/fetch/proc/listen_throw_land(obj/item/thrown_thing, datum/thrownthing/throwing_datum)
SIGNAL_HANDLER
UnregisterSignal(thrown_thing, COMSIG_MOVABLE_THROW_LANDED)
@@ -74,7 +74,7 @@
parent.ai_controller.set_blackboard_key(BB_FETCH_DELIVER_TO, throwing_datum.thrower)
// Don't try and fetch turfs or anchored objects if someone points at them
/datum/pet_command/point_targetting/fetch/look_for_target(mob/living/pointing_friend, obj/item/pointed_atom)
/datum/pet_command/point_targeting/fetch/look_for_target(mob/living/pointing_friend, obj/item/pointed_atom)
if (!istype(pointed_atom))
return FALSE
if (pointed_atom.anchored)
@@ -87,7 +87,7 @@
parent.ai_controller.set_blackboard_key(BB_FETCH_DELIVER_TO, pointing_friend)
// Finally, plan our actions
/datum/pet_command/point_targetting/fetch/execute_action(datum/ai_controller/controller)
/datum/pet_command/point_targeting/fetch/execute_action(datum/ai_controller/controller)
controller.queue_behavior(/datum/ai_behavior/forget_failed_fetches)
var/atom/target = controller.blackboard[BB_CURRENT_PET_TARGET]

View File

@@ -109,25 +109,25 @@
CRASH("Pet command execute action not implemented.")
/**
* # Point Targetting Pet Command
* # Point Targeting Pet Command
* As above but also listens for you pointing at something and marks it as a target
*/
/datum/pet_command/point_targetting
/datum/pet_command/point_targeting
/// Text describing an action we perform upon receiving a new target
var/pointed_reaction
/// Blackboard key for targetting datum, this is likely going to need it
var/targetting_datum_key = BB_PET_TARGETTING_DATUM
/// Blackboard key for targeting strategy, this is likely going to need it
var/targeting_strategy_key = BB_PET_TARGETING_STRATEGY
/datum/pet_command/point_targetting/add_new_friend(mob/living/tamer)
/datum/pet_command/point_targeting/add_new_friend(mob/living/tamer)
. = ..()
RegisterSignal(tamer, COMSIG_MOB_POINTED, PROC_REF(look_for_target))
/datum/pet_command/point_targetting/remove_friend(mob/living/unfriended)
/datum/pet_command/point_targeting/remove_friend(mob/living/unfriended)
. = ..()
UnregisterSignal(unfriended, COMSIG_MOB_POINTED)
/// Target the pointed atom for actions
/datum/pet_command/point_targetting/proc/look_for_target(mob/living/friend, atom/pointed_atom)
/datum/pet_command/point_targeting/proc/look_for_target(mob/living/friend, atom/pointed_atom)
SIGNAL_HANDLER
var/mob/living/parent = weak_parent.resolve()

View File

@@ -118,7 +118,7 @@
* # Pet Command: Attack
* Tells a pet to chase and bite the next thing you point at
*/
/datum/pet_command/point_targetting/attack
/datum/pet_command/point_targeting/attack
command_name = "Attack"
command_desc = "Command your pet to attack things that you point out to it."
radial_icon = 'icons/effects/effects.dmi'
@@ -133,13 +133,13 @@
var/attack_behaviour = /datum/ai_behavior/basic_melee_attack
// Refuse to target things we can't target, chiefly other friends
/datum/pet_command/point_targetting/attack/set_command_target(mob/living/parent, atom/target)
/datum/pet_command/point_targeting/attack/set_command_target(mob/living/parent, atom/target)
if (!target)
return
var/mob/living/living_parent = parent
if (!living_parent.ai_controller)
return
var/datum/targetting_datum/targeter = living_parent.ai_controller.blackboard[targetting_datum_key]
var/datum/targeting_strategy/targeter = GET_TARGETING_STRATEGY(living_parent.ai_controller.blackboard[targeting_strategy_key])
if (!targeter)
return
if (!targeter.can_attack(living_parent, target))
@@ -147,21 +147,21 @@
return
return ..()
/// Display feedback about not targetting something
/datum/pet_command/point_targetting/attack/proc/refuse_target(mob/living/parent, atom/target)
/// Display feedback about not targeting something
/datum/pet_command/point_targeting/attack/proc/refuse_target(mob/living/parent, atom/target)
var/mob/living/living_parent = parent
living_parent.balloon_alert_to_viewers("[refuse_reaction]")
living_parent.visible_message(span_notice("[living_parent] refuses to attack [target]."))
/datum/pet_command/point_targetting/attack/execute_action(datum/ai_controller/controller)
controller.queue_behavior(attack_behaviour, BB_CURRENT_PET_TARGET, targetting_datum_key)
/datum/pet_command/point_targeting/attack/execute_action(datum/ai_controller/controller)
controller.queue_behavior(attack_behaviour, BB_CURRENT_PET_TARGET, targeting_strategy_key)
return SUBTREE_RETURN_FINISH_PLANNING
/**
* # Pet Command: Targetted Ability
* Tells a pet to use some kind of ability on the next thing you point at
*/
/datum/pet_command/point_targetting/use_ability
/datum/pet_command/point_targeting/use_ability
command_name = "Use ability"
command_desc = "Command your pet to use one of its special skills on something that you point out to it."
radial_icon = 'icons/mob/actions/actions_spells.dmi'
@@ -172,7 +172,7 @@
/// Blackboard key where a reference to some kind of mob ability is stored
var/pet_ability_key
/datum/pet_command/point_targetting/use_ability/execute_action(datum/ai_controller/controller)
/datum/pet_command/point_targeting/use_ability/execute_action(datum/ai_controller/controller)
if (!pet_ability_key)
return
var/datum/action/cooldown/using_action = controller.blackboard[pet_ability_key]
@@ -207,7 +207,7 @@
if(victim.stat > controller.blackboard[BB_TARGET_MINIMUM_STAT])
controller.clear_blackboard_key(BB_ACTIVE_PET_COMMAND)
return
controller.queue_behavior(protect_behavior, BB_CURRENT_PET_TARGET, BB_PET_TARGETTING_DATUM)
controller.queue_behavior(protect_behavior, BB_CURRENT_PET_TARGET, BB_PET_TARGETING_STRATEGY)
return SUBTREE_RETURN_FINISH_PLANNING
/datum/pet_command/protect_owner/set_command_active(mob/living/parent, mob/living/victim)

View File

@@ -8,7 +8,7 @@
/// The ability to use when we are attacked
var/datum/action/cooldown/ability
/// Optional datum for validating targets
var/datum/targetting_datum/targetting
var/datum/targeting_strategy/targeting
/// Trigger only if target is at least this far away
var/min_range
/// Trigger only if target is at least this close
@@ -16,12 +16,12 @@
/// Target the ability at ourself instead of at the offender
var/target_self
/datum/component/revenge_ability/Initialize(datum/action/cooldown/ability, datum/targetting_datum/targetting, min_range = 0, max_range = INFINITY, target_self = FALSE)
/datum/component/revenge_ability/Initialize(datum/action/cooldown/ability, datum/targeting_strategy/targeting, min_range = 0, max_range = INFINITY, target_self = FALSE)
. = ..()
if (!isliving(parent))
return COMPONENT_INCOMPATIBLE
src.ability = ability
src.targetting = targetting
src.targeting = targeting
src.min_range = min_range
src.max_range = max_range
src.target_self = target_self
@@ -45,7 +45,7 @@
var/distance = get_dist(ability_user, attacker)
if (distance < min_range || distance > max_range)
return
if (targetting && !targetting.can_attack(victim, attacker))
if (targeting && !targeting.can_attack(victim, attacker))
return
INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action/cooldown, InterceptClickOn), ability_user, null, (target_self) ? ability_user : attacker)

View File

@@ -22,7 +22,7 @@
. = ..()
UnregisterSignal(source, COMSIG_LIVING_UNARMED_ATTACK)
/// If we're targetting an airlock, open it
/// If we're targeting an airlock, open it
/datum/element/door_pryer/proc/on_attack(mob/living/basic/attacker, atom/target, proximity_flag)
SIGNAL_HANDLER
if(!proximity_flag || !istype(target, /obj/machinery/door/airlock))

View File

@@ -1221,7 +1221,7 @@
return src
/**
* tryEmbed() is for when you want to try embedding something without dealing with the damage + hit messages of calling hitby() on the item while targetting the target.
* tryEmbed() is for when you want to try embedding something without dealing with the damage + hit messages of calling hitby() on the item while targeting the target.
*
* Really, this is used mostly with projectiles with shrapnel payloads, from [/datum/element/embed/proc/checkEmbedProjectile], and called on said shrapnel. Mostly acts as an intermediate between different embed elements.
*

View File

@@ -42,22 +42,22 @@
/// Boolean on whether people with chunky fingers can use this baton.
var/chunky_finger_usable = FALSE
/// The context to show when the baton is active and targetting a living thing
/// The context to show when the baton is active and targeting a living thing
var/context_living_target_active = "Stun"
/// The context to show when the baton is active and targetting a living thing in combat mode
/// The context to show when the baton is active and targeting a living thing in combat mode
var/context_living_target_active_combat_mode = "Stun"
/// The context to show when the baton is inactive and targetting a living thing
/// The context to show when the baton is inactive and targeting a living thing
var/context_living_target_inactive = "Prod"
/// The context to show when the baton is inactive and targetting a living thing in combat mode
/// The context to show when the baton is inactive and targeting a living thing in combat mode
var/context_living_target_inactive_combat_mode = "Attack"
/// The RMB context to show when the baton is active and targetting a living thing
/// The RMB context to show when the baton is active and targeting a living thing
var/context_living_rmb_active = "Attack"
/// The RMB context to show when the baton is inactive and targetting a living thing
/// The RMB context to show when the baton is inactive and targeting a living thing
var/context_living_rmb_inactive = "Attack"
/obj/item/melee/baton/Initialize(mapload)

View File

@@ -248,7 +248,7 @@
/datum/pet_command/idle,
/datum/pet_command/free,
/datum/pet_command/follow,
/datum/pet_command/point_targetting/attack/star_gazer
/datum/pet_command/point_targeting/attack/star_gazer
)
/datum/heretic_knowledge/ultimate/cosmic_final/is_valid_sacrifice(mob/living/carbon/human/sacrifice)

View File

@@ -17,7 +17,7 @@
abstract_type = /datum/traitor_objective/destroy_heirloom
/// The jobs that this objective is targetting.
/// The jobs that this objective is targeting.
var/list/target_jobs
/// the item we need to destroy
var/obj/item/target_item

View File

@@ -5,7 +5,7 @@
abstract_type = /datum/traitor_objective/target_player/kidnapping
/// The jobs that this objective is targetting.
/// The jobs that this objective is targeting.
var/list/target_jobs
/// Area that the target needs to be delivered to
var/area/dropoff_area

View File

@@ -31,7 +31,7 @@
/mob/living/basic/sloth/paperwork,
)
)
/// The head that we are targetting
/// The head that we are targeting
var/datum/job/target
/// Whether or not we only take from the traitor's own department head or not.
var/limited_to_department_head = TRUE

View File

@@ -4,7 +4,7 @@
*/
/datum/ai_controller/basic_controller/blobbernaut
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
@@ -21,7 +21,7 @@
*/
/datum/ai_controller/basic_controller/blob_zombie
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
@@ -39,7 +39,7 @@
*/
/datum/ai_controller/basic_controller/blob_spore
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/clown
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_BASIC_MOB_SPEAK_LINES = null,
)
@@ -14,7 +14,7 @@
/datum/ai_controller/basic_controller/clown/murder
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_BASIC_MOB_SPEAK_LINES = null,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)

View File

@@ -68,7 +68,7 @@
heal_time = 0,\
valid_targets_typecache = typecacheof(list(/mob/living/basic/construct, /mob/living/basic/shade)),\
valid_biotypes = MOB_MINERAL | MOB_SPIRIT,\
self_targetting = can_repair_self ? HEALING_TOUCH_ANYONE : HEALING_TOUCH_NOT_SELF,\
self_targeting = can_repair_self ? HEALING_TOUCH_ANYONE : HEALING_TOUCH_NOT_SELF,\
action_text = "%SOURCE% begins repairing %TARGET%'s dents.",\
complete_text = "%TARGET%'s dents are repaired.",\
show_health = TRUE,\

View File

@@ -6,8 +6,8 @@
*/
/datum/ai_controller/basic_controller/artificer
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/same_faction/construct,
BB_FLEE_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/same_faction/construct,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_WOUNDED_ONLY = TRUE,
)
@@ -27,7 +27,7 @@
*/
/datum/ai_controller/basic_controller/juggernaut
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
@@ -46,9 +46,9 @@
*/
/datum/ai_controller/basic_controller/proteon
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_FLEE_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance
@@ -68,7 +68,7 @@
*/
/datum/ai_controller/basic_controller/wraith
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
@@ -80,11 +80,11 @@
/datum/ai_planning_subtree/basic_melee_attack_subtree,
)
/// Targetting datum that will only allow mobs that constructs can heal.
/datum/targetting_datum/basic/same_faction/construct
/// 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/targetting_datum/basic/same_faction/construct/can_attack(mob/living/living_mob, atom/the_target, vision_range, check_faction = TRUE)
/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

View File

@@ -61,7 +61,7 @@
/datum/pet_command/beehive/enter,
/datum/pet_command/beehive/exit,
/datum/pet_command/follow/bee,
/datum/pet_command/point_targetting/attack/swirl,
/datum/pet_command/point_targeting/attack/swirl,
/datum/pet_command/scatter,
)

View File

@@ -83,9 +83,9 @@
if(valid_hives.len)
return pick(valid_hives)
/datum/targetting_datum/basic/bee
/datum/targeting_strategy/basic/bee
/datum/targetting_datum/basic/bee/can_attack(mob/living/owner, atom/target, vision_range)
/datum/targeting_strategy/basic/bee/can_attack(mob/living/owner, atom/target, vision_range)
if(!isliving(target))
return FALSE
. = ..()
@@ -117,7 +117,7 @@
required_distance = 0
///swirl around the owner in menacing fashion
/datum/pet_command/point_targetting/attack/swirl
/datum/pet_command/point_targeting/attack/swirl
command_name = "Swirl"
command_desc = "Your pets will swirl around you and attack whoever you point at!"
speech_commands = list("swirl", "spiral", "swarm")
@@ -127,7 +127,7 @@
///the owner we will swarm around
var/key_to_swarm = BB_SWARM_TARGET
/datum/pet_command/point_targetting/attack/swirl/try_activate_command(mob/living/commander)
/datum/pet_command/point_targeting/attack/swirl/try_activate_command(mob/living/commander)
var/mob/living/living_pawn = weak_parent.resolve()
if(isnull(living_pawn))
return
@@ -138,7 +138,7 @@
controller.set_blackboard_key(key_to_swarm, commander)
return ..()
/datum/pet_command/point_targetting/attack/swirl/execute_action(datum/ai_controller/controller)
/datum/pet_command/point_targeting/attack/swirl/execute_action(datum/ai_controller/controller)
if(controller.blackboard_key_exists(BB_CURRENT_PET_TARGET))
return ..()
controller.queue_behavior(/datum/ai_behavior/swirl_around_target, BB_SWARM_TARGET)

View File

@@ -1,7 +1,7 @@
/datum/ai_controller/basic_controller/bee
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/bee,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/bee,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
)
ai_traits = STOP_MOVING_WHEN_PULLED
@@ -25,7 +25,7 @@
/datum/ai_controller/basic_controller/queen_bee
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/bee,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/bee,
)
ai_traits = STOP_MOVING_WHEN_PULLED

View File

@@ -66,7 +66,7 @@
/datum/ai_controller/basic_controller/chick
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_FIND_MOM_TYPES = list(/mob/living/basic/chicken),
)

View File

@@ -78,7 +78,7 @@ GLOBAL_VAR_INIT(chicken_count, 0)
/datum/ai_controller/basic_controller/chicken
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/cow
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/allow_items(),
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items,
BB_BASIC_MOB_TIP_REACTING = FALSE,
BB_BASIC_MOB_TIPPER = null,
)

View File

@@ -44,7 +44,7 @@
/datum/ai_controller/basic_controller/cow/moonicorn
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/allow_items/moonicorn(),
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items/moonicorn,
BB_BASIC_MOB_TIP_REACTING = FALSE,
BB_BASIC_MOB_TIPPER = null,
)
@@ -60,14 +60,14 @@
)
///moonicorns will not attack people holding something that could tame them.
/datum/targetting_datum/basic/allow_items/moonicorn
/datum/targeting_strategy/basic/allow_items/moonicorn
/datum/targetting_datum/basic/allow_items/moonicorn/can_attack(mob/living/living_mob, atom/the_target, vision_range)
/datum/targeting_strategy/basic/allow_items/moonicorn/can_attack(mob/living/living_mob, atom/the_target, vision_range)
. = ..()
if(!.)
return FALSE
if(isliving(the_target)) //Targetting vs living mobs
if(isliving(the_target)) //Targeting vs living mobs
var/mob/living/living_target = the_target
for(var/obj/item/food/grown/galaxythistle/tame_food in living_target.held_items)
return FALSE //heyyy this can tame me! let's NOT fight

View File

@@ -22,7 +22,7 @@
return //cannot tame me! and I don't care about eatin' nothing, neither!
/datum/ai_controller/basic_controller/cow/wisdom
//don't give a targetting datum
//don't give a targeting strategy
blackboard = list(
BB_BASIC_MOB_TIP_REACTING = FALSE,
BB_BASIC_MOB_TIPPER = null,

View File

@@ -35,7 +35,7 @@
/datum/ai_controller/basic_controller/deer
blackboard = list(
BB_STATIONARY_MOVE_TO_TARGET = TRUE,
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -1,7 +1,7 @@
/// Goats are normally content to sorta hang around and crunch any plant in sight, but they will go ape on someone who attacks them.
/datum/ai_controller/basic_controller/goat
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED

View File

@@ -1,7 +1,7 @@
/// Pretty basic, just click people to death. Also hunt and eat bananas.
/datum/ai_controller/basic_controller/gorilla
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/allow_items,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items,
BB_TARGET_MINIMUM_STAT = UNCONSCIOUS,
BB_EMOTE_KEY = "ooga",
BB_EMOTE_CHANCE = 40,
@@ -27,7 +27,7 @@
/datum/ai_controller/basic_controller/gorilla/lesser
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/allow_items,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items,
BB_EMOTE_KEY = "ooga",
BB_EMOTE_CHANCE = 60,
)

View File

@@ -47,7 +47,7 @@
/datum/ai_controller/basic_controller/pig
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED

View File

@@ -106,7 +106,7 @@
/datum/ai_controller/basic_controller/pony
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED

View File

@@ -49,7 +49,7 @@
/datum/ai_controller/basic_controller/rabbit
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -81,7 +81,7 @@
/datum/ai_controller/basic_controller/sheep
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -51,7 +51,7 @@
/datum/ai_controller/basic_controller/festivus_pole
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic(),
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_LOW_PRIORITY_HUNTING_TARGET = null, // APCs
)

View File

@@ -27,7 +27,7 @@
/datum/ai_controller/basic_controller/stalker
ai_traits = CAN_ACT_IN_STASIS
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -85,7 +85,7 @@
/// Walk and attack people, blind them when we can
/datum/ai_controller/basic_controller/raw_prophet
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -50,7 +50,7 @@
/// Converts unconverted terrain, sprays pocket sand around
/datum/ai_controller/basic_controller/rust_walker
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -66,7 +66,7 @@
target.apply_status_effect(/datum/status_effect/star_mark)
target.apply_damage(damage = 5, damagetype = CLONE)
var/datum/targetting_datum/target_confirmer = ai_controller.blackboard[BB_TARGETTING_DATUM]
var/datum/targeting_strategy/target_confirmer = GET_TARGETING_STRATEGY(ai_controller.blackboard[BB_TARGETING_STRATEGY])
for(var/mob/living/nearby_mob in range(1, src))
if(target == nearby_mob || !target_confirmer?.can_attack(src, nearby_mob))
continue
@@ -78,9 +78,9 @@
/datum/ai_controller/basic_controller/star_gazer
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends/attack_closed_turfs,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends/attack_closed_turfs,
)
ai_movement = /datum/ai_movement/basic_avoidance
@@ -104,7 +104,7 @@
can_attack_turfs = TRUE
can_attack_dense_objects = TRUE
/datum/pet_command/point_targetting/attack/star_gazer
/datum/pet_command/point_targeting/attack/star_gazer
speech_commands = list("attack", "sic", "kill", "slash them")
command_feedback = "stares!"
pointed_reaction = "stares intensely!"

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/ice_demon
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_LIST_SCARY_ITEMS = list(
/obj/item/weldingtool,
/obj/item/flashlight/flare,

View File

@@ -1,7 +1,7 @@
#define ENRAGE_ADDITION 25
/datum/ai_controller/basic_controller/ice_whelp
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/allow_items,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_WHELP_ENRAGED = 0,
)

View File

@@ -44,9 +44,9 @@
/datum/pet_command/follow,
/datum/pet_command/untargetted_ability/blood_rain,
/datum/pet_command/untargetted_ability/summon_toad,
/datum/pet_command/point_targetting/attack,
/datum/pet_command/point_targetting/use_ability/flop,
/datum/pet_command/point_targetting/use_ability/bubble,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/point_targeting/use_ability/flop,
/datum/pet_command/point_targeting/use_ability/bubble,
)
/mob/living/basic/leaper/Initialize(mapload)

View File

@@ -1,7 +1,7 @@
/datum/ai_controller/basic_controller/leaper
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
)
ai_movement = /datum/ai_movement/basic_avoidance
@@ -39,7 +39,7 @@
ability_key = BB_LEAPER_SUMMON
finish_planning = FALSE
/datum/pet_command/point_targetting/use_ability/flop
/datum/pet_command/point_targeting/use_ability/flop
command_name = "Flop"
command_desc = "Command your pet to belly flop your target!"
radial_icon = 'icons/mob/actions/actions_items.dmi'
@@ -47,7 +47,7 @@
speech_commands = list("flop", "crush")
pet_ability_key = BB_LEAPER_FLOP
/datum/pet_command/point_targetting/use_ability/bubble
/datum/pet_command/point_targeting/use_ability/bubble
command_name = "Poison Bubble"
command_desc = "Launch poisonous bubbles at your target!"
radial_icon = 'icons/obj/weapons/guns/projectiles.dmi'

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/mega_arachnid
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_BASIC_MOB_FLEE_DISTANCE = 5,
)

View File

@@ -212,9 +212,9 @@
/datum/pet_command/idle,
/datum/pet_command/free,
/datum/pet_command/follow,
/datum/pet_command/point_targetting/attack,
/datum/pet_command/point_targetting/use_ability/solarbeam,
/datum/pet_command/point_targetting/use_ability/rapidseeds,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/point_targeting/use_ability/solarbeam,
/datum/pet_command/point_targeting/use_ability/rapidseeds,
)
//abilities

View File

@@ -1,7 +1,7 @@
/datum/ai_controller/basic_controller/seedling
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
BB_WEEDLEVEL_THRESHOLD = 3,
BB_WATERLEVEL_THRESHOLD = 90,
)
@@ -141,8 +141,8 @@
/datum/ai_controller/basic_controller/seedling/meanie
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
)
planning_subtrees = list(
/datum/ai_planning_subtree/pet_planning,
@@ -161,7 +161,7 @@
finish_planning = FALSE
///pet commands
/datum/pet_command/point_targetting/use_ability/solarbeam
/datum/pet_command/point_targeting/use_ability/solarbeam
command_name = "Launch solarbeam"
command_desc = "Command your pet to launch a solarbeam at your target!"
radial_icon = 'icons/effects/beam.dmi'
@@ -169,7 +169,7 @@
speech_commands = list("beam", "solar")
pet_ability_key = BB_SOLARBEAM_ABILITY
/datum/pet_command/point_targetting/use_ability/rapidseeds
/datum/pet_command/point_targeting/use_ability/rapidseeds
command_name = "Rapid seeds"
command_desc = "Command your pet to launch a volley of seeds at your target!"
radial_icon = 'icons/obj/weapons/guns/projectiles.dmi'

View File

@@ -255,7 +255,7 @@
/datum/ai_controller/basic_controller/human_trap
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -77,7 +77,7 @@
/datum/ai_controller/basic_controller/basilisk
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_AGGRO_RANGE = 5,
)

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/bileworm
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/bileworm(),
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/bileworm,
)
planning_subtrees = list(
@@ -9,7 +9,7 @@
/datum/ai_planning_subtree/bileworm_execute,
)
/datum/targetting_datum/basic/bileworm
/datum/targeting_strategy/basic/bileworm
ignore_sight = TRUE
/datum/ai_planning_subtree/bileworm_attack

View File

@@ -3,7 +3,7 @@
*/
/datum/ai_controller/basic_controller/brimdemon
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)

View File

@@ -36,7 +36,7 @@
/datum/pet_command/free,
/datum/pet_command/grub_spit,
/datum/pet_command/follow,
/datum/pet_command/point_targetting/fetch,
/datum/pet_command/point_targeting/fetch,
)
/mob/living/basic/mining/goldgrub/Initialize(mapload)

View File

@@ -1,7 +1,7 @@
/datum/ai_controller/basic_controller/goldgrub
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
BB_ORE_IGNORE_TYPES = list(/obj/item/stack/ore/iron, /obj/item/stack/ore/glass),
BB_STORM_APPROACHING = FALSE,
)
@@ -20,7 +20,7 @@
/datum/ai_controller/basic_controller/babygrub
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_ORE_IGNORE_TYPES = list(/obj/item/stack/ore/glass),
BB_FIND_MOM_TYPES = list(/mob/living/basic/mining/goldgrub),
BB_IGNORE_MOM_TYPES = list(/mob/living/basic/mining/goldgrub/baby),

View File

@@ -80,10 +80,10 @@
tentacles.Grant(src)
melee_tentacles = new(src)
melee_tentacles.Grant(src)
AddComponent(/datum/component/revenge_ability, melee_tentacles, targetting = ai_controller.blackboard[BB_TARGETTING_DATUM], max_range = 1, target_self = TRUE)
AddComponent(/datum/component/revenge_ability, melee_tentacles, targeting = GET_TARGETING_STRATEGY(ai_controller.blackboard[BB_TARGETING_STRATEGY]), max_range = 1, target_self = TRUE)
tentacle_line = new (src)
tentacle_line.Grant(src)
AddComponent(/datum/component/revenge_ability, tentacle_line, targetting = ai_controller.blackboard[BB_TARGETTING_DATUM], min_range = 2, max_range = 9)
AddComponent(/datum/component/revenge_ability, tentacle_line, targeting = GET_TARGETING_STRATEGY(ai_controller.blackboard[BB_TARGETING_STRATEGY]), min_range = 2, max_range = 9)
tentacles_ready()
RegisterSignal(src, COMSIG_MOB_ABILITY_FINISHED, PROC_REF(used_ability))

View File

@@ -3,7 +3,7 @@
/datum/ai_controller/basic_controller/goliath
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/allow_items,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
@@ -27,7 +27,7 @@
/// Go for the tentacles if they're available
/datum/ai_behavior/basic_melee_attack/goliath
/datum/ai_behavior/basic_melee_attack/goliath/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key, health_ratio_key)
/datum/ai_behavior/basic_melee_attack/goliath/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key, health_ratio_key)
var/time_on_target = controller.blackboard[BB_BASIC_MOB_HAS_TARGET_TIME] || 0
if (time_on_target < MIN_TIME_TO_TENTACLE)
return ..()

View File

@@ -1,7 +1,7 @@
/// Basically just keep away and shit out worms
/datum/ai_controller/basic_controller/hivelord
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_AGGRO_RANGE = 5, // Only get mad at people nearby
)

View File

@@ -10,7 +10,7 @@
cooldown_time = 2 SECONDS
melee_cooldown_time = 0
shared_cooldown = NONE
/// If a mob is not clicked directly, inherit targetting data from this blackboard key and setting it upon this target key
/// If a mob is not clicked directly, inherit targeting data from this blackboard key and setting it upon this target key
var/ai_target_key = BB_BASIC_MOB_CURRENT_TARGET
/// What are we actually spawning?
var/spawn_type = /mob/living/basic/hivelord_brood

View File

@@ -1,7 +1,7 @@
/// Keep away and launch skulls at every opportunity, prioritising injured allies
/datum/ai_controller/basic_controller/legion
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/legion,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/legion,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_AGGRO_RANGE = 5, // Unobservant
BB_BASIC_MOB_FLEE_DISTANCE = 6,
@@ -16,10 +16,10 @@
/datum/ai_planning_subtree/flee_target/legion,
)
/// Chase and attack whatever we are targetting, if it's friendly we will heal them
/// Chase and attack whatever we are targeting, if it's friendly we will heal them
/datum/ai_controller/basic_controller/legion_brood
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/legion,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/legion,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
)
@@ -31,9 +31,9 @@
)
/// Target nearby friendlies if they are hurt (and are not themselves Legions)
/datum/targetting_datum/basic/legion
/datum/targeting_strategy/basic/legion
/datum/targetting_datum/basic/legion/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
/datum/targeting_strategy/basic/legion/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
if (!living_mob.faction_check_atom(the_target, exact_match = check_factions_exactly))
return FALSE
if (istype(the_target, living_mob.type))

View File

@@ -10,7 +10,7 @@
cooldown_time = 2 SECONDS
melee_cooldown_time = 0
shared_cooldown = NONE
/// If a mob is not clicked directly, inherit targetting data from this blackboard key and setting it upon this target key
/// If a mob is not clicked directly, inherit targeting data from this blackboard key and setting it upon this target key
var/ai_target_key = BB_BASIC_MOB_CURRENT_TARGET
/// What are we actually spawning?
var/spawn_type = /mob/living/basic/legion_brood

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/lobstrosity
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_LOBSTROSITY_EXPLOIT_TRAITS = list(TRAIT_INCAPACITATED, TRAIT_FLOORED, TRAIT_IMMOBILIZED, TRAIT_KNOCKEDOUT),
BB_LOBSTROSITY_FINGER_LUST = 0
@@ -34,7 +34,7 @@
/datum/ai_behavior/basic_melee_attack/lobster
/datum/ai_behavior/basic_melee_attack/lobster/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key)
/datum/ai_behavior/basic_melee_attack/lobster/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
var/mob/living/target = controller.blackboard[target_key]
if (isnull(target))
return ..()

View File

@@ -41,8 +41,8 @@
var/list/pet_commands = list(
/datum/pet_command/idle,
/datum/pet_command/free,
/datum/pet_command/point_targetting/attack,
/datum/pet_command/point_targetting/fetch,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/point_targeting/fetch,
)
/mob/living/basic/mining/mook/Initialize(mapload)

View File

@@ -1,12 +1,12 @@
///commands the chief can pick from
GLOBAL_LIST_INIT(mook_commands, list(
new /datum/pet_command/point_targetting/attack,
new /datum/pet_command/point_targetting/fetch,
new /datum/pet_command/point_targeting/attack,
new /datum/pet_command/point_targeting/fetch,
))
/datum/ai_controller/basic_controller/mook
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/mook,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/mook,
BB_BLACKLIST_MINERAL_TURFS = list(/turf/closed/mineral/gibtonite, /turf/closed/mineral/strong),
BB_MAXIMUM_DISTANCE_TO_VILLAGE = 7,
BB_STORM_APPROACHING = FALSE,
@@ -28,7 +28,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
)
///check for faction if not a ash walker, otherwise just attack
/datum/targetting_datum/basic/mook/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
/datum/targeting_strategy/basic/mook/faction_check(datum/ai_controller/controller, mob/living/living_mob, mob/living/the_target)
if(FACTION_ASHWALKER in living_mob.faction)
return FALSE
@@ -212,7 +212,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
///bard mook plays nice music for the village
/datum/ai_controller/basic_controller/mook/bard
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/mook,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/mook,
BB_MAXIMUM_DISTANCE_TO_VILLAGE = 10,
BB_STORM_APPROACHING = FALSE,
BB_SONG_LINES = MOOK_SONG,
@@ -264,10 +264,10 @@ GLOBAL_LIST_INIT(mook_commands, list(
///healer mooks guard the village from intruders and heal the miner mooks when they come home
/datum/ai_controller/basic_controller/mook/support
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/mook,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/mook,
BB_MAXIMUM_DISTANCE_TO_VILLAGE = 10,
BB_STORM_APPROACHING = FALSE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
)
idle_behavior = /datum/idle_behavior/walk_near_target/mook_village
planning_subtrees = list(
@@ -324,7 +324,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
///the chief would rather command his mooks to attack people than attack them himself
/datum/ai_controller/basic_controller/mook/tribal_chief
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/mook,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/mook,
BB_STORM_APPROACHING = FALSE,
)
idle_behavior = /datum/idle_behavior/walk_near_target/mook_village
@@ -349,7 +349,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
if(!locate(/mob/living/basic/mining/mook) in oview(command_distance, controller.pawn))
return
if(controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_BASIC_MOB_CURRENT_TARGET, /datum/pet_command/point_targetting/attack)
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_BASIC_MOB_CURRENT_TARGET, /datum/pet_command/point_targeting/attack)
return
var/atom/ore_target = controller.blackboard[BB_ORE_TARGET]
@@ -359,7 +359,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
if(get_dist(ore_target, living_pawn) <= 1)
return
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_ORE_TARGET, /datum/pet_command/point_targetting/fetch)
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_ORE_TARGET, /datum/pet_command/point_targeting/fetch)
/datum/ai_behavior/issue_commands
action_cooldown = 5 SECONDS

View File

@@ -62,7 +62,7 @@
var/datum/action/cooldown/mob_cooldown/watcher_gaze/gaze = new gaze_attack(src)
gaze.Grant(src)
ai_controller.set_blackboard_key(BB_GENERIC_ACTION, gaze)
AddComponent(/datum/component/revenge_ability, gaze, targetting = ai_controller.blackboard[BB_TARGETTING_DATUM])
AddComponent(/datum/component/revenge_ability, gaze, targeting = GET_TARGETING_STRATEGY(ai_controller.blackboard[BB_TARGETING_STRATEGY]))
/mob/living/basic/mining/watcher/update_overlays()
. = ..()

View File

@@ -1,6 +1,6 @@
/datum/ai_controller/basic_controller/watcher
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = PAUSE_DURING_DO_AFTER

View File

@@ -40,7 +40,7 @@
/datum/pet_command/automate_mining,
/datum/pet_command/free/minebot,
/datum/pet_command/follow,
/datum/pet_command/point_targetting/attack/minebot,
/datum/pet_command/point_targeting/attack/minebot,
)
/mob/living/basic/mining_drone/Initialize(mapload)

View File

@@ -1,7 +1,7 @@
/datum/ai_controller/basic_controller/minebot
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
BB_BLACKLIST_MINERAL_TURFS = list(/turf/closed/mineral/gibtonite),
BB_AUTOMATED_MINING = FALSE,
)
@@ -201,10 +201,10 @@
radial_icon_state = "mech_eject"
ability_key = BB_MINEBOT_DUMP_ABILITY
/datum/pet_command/point_targetting/attack/minebot
/datum/pet_command/point_targeting/attack/minebot
attack_behaviour = /datum/ai_behavior/basic_ranged_attack/minebot
/datum/pet_command/point_targetting/attack/minebot/execute_action(datum/ai_controller/controller)
/datum/pet_command/point_targeting/attack/minebot/execute_action(datum/ai_controller/controller)
controller.set_blackboard_key(BB_AUTOMATED_MINING, FALSE)
var/mob/living/living_pawn = controller.pawn
if(!living_pawn.combat_mode)

View File

@@ -7,10 +7,10 @@
speech_commands = list("good dog")
// Set correct attack behaviour
/datum/pet_command/point_targetting/attack/dog
/datum/pet_command/point_targeting/attack/dog
attack_behaviour = /datum/ai_behavior/basic_melee_attack/dog
/datum/pet_command/point_targetting/attack/dog/set_command_active(mob/living/parent, mob/living/commander)
/datum/pet_command/point_targeting/attack/dog/set_command_active(mob/living/parent, mob/living/commander)
. = ..()
parent.ai_controller.set_blackboard_key(BB_DOG_HARASS_HARM, TRUE)
@@ -40,8 +40,8 @@
/datum/pet_command/free,
/datum/pet_command/good_boy/dog,
/datum/pet_command/follow/dog,
/datum/pet_command/point_targetting/attack/dog,
/datum/pet_command/point_targetting/fetch,
/datum/pet_command/point_targeting/attack/dog,
/datum/pet_command/point_targeting/fetch,
/datum/pet_command/play_dead,
)

View File

@@ -39,8 +39,8 @@
/datum/ai_controller/basic_controller/fox
blackboard = list(
BB_ALWAYS_IGNORE_FACTION = TRUE,
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/of_size/ours_or_smaller,
BB_FLEE_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/of_size/ours_or_smaller,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_movement = /datum/ai_movement/basic_avoidance

View File

@@ -84,7 +84,7 @@
/datum/ai_controller/basic_controller/penguin
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED
@@ -178,7 +178,7 @@
/datum/ai_controller/basic_controller/penguin/baby
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_FIND_MOM_TYPES = list(/mob/living/basic/pet/penguin),
BB_IGNORE_MOM_TYPES = list(/mob/living/basic/pet/penguin/baby),
)

View File

@@ -75,8 +75,8 @@ GLOBAL_DATUM(cargo_sloth, /mob/living/basic/sloth)
/// They're really passive in game, so they just wanna get away if you start smacking them. No trees in space from them to use for clawing your eyes out, but they will try if desperate.
/datum/ai_controller/basic_controller/sloth
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_FLEE_TARGETTING_DATUM = new /datum/targetting_datum/basic,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
ai_traits = STOP_MOVING_WHEN_PULLED

Some files were not shown because too many files have changed in this diff Show More