mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-21 23:24:20 +00:00
* 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>
27 lines
1.3 KiB
Plaintext
27 lines
1.3 KiB
Plaintext
/// Try to escape from your current target, without performing any other actions.
|
|
/datum/ai_planning_subtree/flee_target
|
|
/// Behaviour to execute in order to flee
|
|
var/flee_behaviour = /datum/ai_behavior/run_away_from_target
|
|
/// 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
|
|
var/hiding_place_key = BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION
|
|
|
|
/datum/ai_planning_subtree/flee_target/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
|
. = ..()
|
|
var/atom/flee_from = controller.blackboard[target_key]
|
|
if (controller.blackboard[BB_BASIC_MOB_STOP_FLEEING] || QDELETED(flee_from))
|
|
return
|
|
var/flee_distance = controller.blackboard[BB_BASIC_MOB_FLEE_DISTANCE] || DEFAULT_BASIC_FLEE_DISTANCE
|
|
if (get_dist(controller.pawn, flee_from) >= flee_distance)
|
|
return
|
|
|
|
controller.queue_behavior(flee_behaviour, target_key, hiding_place_key)
|
|
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 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
|