Makes tendrils less out for blood, cleans up The Thing's code (#96332)

## About The Pull Request

I didn't realize that default aggro range for mobs is 9, so tendrils
would try to attack you with their whips and spikes despite you being
completely out of their range, which looks pretty funny.
I've fixed this by separating out aggro ***grab*** range and aggro
sustain ranges, lowering latter to 5 for tendrils, and adding checks for
target distance for both abilities it has. The Thing also had a similar
behavior but used rather jank code for that (which I don't think even
worked), so I've modified it to use the new system as well.

## Why It's Good For The Game

Stationary mobs probably shouldn't try to attack mobs completely out of
their reach

## Changelog
🆑
fix: Tendrils no longer try to attack you when you're out of their reach
code: Cleaned up The Thing's aggro code
/🆑
This commit is contained in:
SmArtKar
2026-06-04 17:17:12 +02:00
committed by nevimer
parent b976715b42
commit 4f8b9f2418
6 changed files with 29 additions and 14 deletions
@@ -5,14 +5,15 @@
BB_THETHING_ATTACKMODE = TRUE, //Whether we are using our melee abilities right now
BB_THETHING_NOAOE = TRUE, // Restricts us to only melee abilities
BB_THETHING_LASTAOE = null, // Last AOE ability key executed
BB_AGGRO_RANGE = 6, //lets not execute hearers for a 16 tile radius
BB_AGGRO_RANGE = 16,
BB_AGGRO_GRAB_RANGE = 6,
)
ai_movement = /datum/ai_movement/basic_avoidance // dont need anything better because the arena is a square lol
idle_behavior = null
planning_subtrees = list(
/datum/ai_planning_subtree/escape_captivity,
/datum/ai_planning_subtree/simple_find_target/increased_range, //aggros at 6, sees 16 tiles
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/thing_boss_aoe,
/datum/ai_planning_subtree/thing_boss_melee,
)
@@ -266,6 +266,8 @@
cooldown_time = 10 SECONDS
melee_cooldown_time = 0
shared_cooldown = NONE
/// Range in which we create spikes
var/spike_range = 7
/// Health threshold at which we reduce the amount of empty spots on the ground
var/health_threshold = 0.3
@@ -288,7 +290,7 @@
if (as_living.health / as_living.maxHealth <= health_threshold)
reduced_spawns = TRUE
for (var/turf/open/target_turf in oview(7, owner_turf))
for (var/turf/open/target_turf in oview(spike_range, owner_turf))
if (sqrt((target_turf.x - owner_turf.x) ** 2 + (target_turf.y - owner_turf.y) ** 2) > 9.5) // big circle is a lie
continue
@@ -2,6 +2,8 @@
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_TARGET_MINIMUM_STAT = HARD_CRIT,
BB_AGGRO_RANGE = 9, // Keeps an eye on you even if you flee
BB_AGGRO_GRAB_RANGE = 5, // Only aggros if you get real close and personal
)
planning_subtrees = list(
@@ -22,7 +24,8 @@
ability_key = BB_TENDRIL_LASH
/datum/ai_planning_subtree/use_mob_ability/tendril_lash/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
if (!controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET])
var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
if (isnull(target) || get_dist(controller.pawn, target) > /obj/projectile/tentacle_lash::range)
return FALSE
return ..()
@@ -30,6 +33,8 @@
ability_key = BB_TENDRIL_SPIKES
/datum/ai_planning_subtree/use_mob_ability/tendril_spikes/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
if (!controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET])
var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
var/datum/action/cooldown/mob_cooldown/tendril_cross_spikes/ability = controller.blackboard[ability_key]
if (isnull(target) || !istype(ability) || get_dist(controller.pawn, target) > ability.spike_range)
return FALSE
return ..()