Carps, frogs and young lobstrosities now fear the fishing hat! (#85380)

## About The Pull Request
Carps, frogs and young lobstrosities now fear legendary anglers wearing
the legendary fishing hat and will flee. The item is skill-locked, so
only those that have maxxed out the skill can wear it.

Differently, adult lobstrosities and megacarps (and suicide frogs, which
are used nowhere) do not flee but will still prioritize them over the
rest.

## Why It's Good For The Game
I'm putting some emphasis on the "fish fear me" _(lobstrosities and
frogs aren't exactly fish but it'd been quite boring to only include
carps)_ and also making the hat a bit more than just some cosmetic
novelty.

## Changelog

🆑
add: Carps, frogs and young lobstrosities now fear people wearing
fishing hats! Adults and megacarp favour the 'fight' part of the fear
reflex however.
fix: The hat stabilizer module now inherits the clothing traits of the
attached hat.
/🆑
This commit is contained in:
Ghom
2024-07-31 15:38:37 +02:00
committed by GitHub
parent dfbf94ca09
commit 2535df375d
20 changed files with 161 additions and 34 deletions
@@ -0,0 +1,6 @@
/// Find something with a specific trait to run from
/datum/ai_planning_subtree/find_target_prioritize_traits
/datum/ai_planning_subtree/find_target_prioritize_traits/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
. = ..()
controller.queue_behavior(/datum/ai_behavior/find_potential_targets/prioritize_trait, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION, BB_TARGET_PRIORITY_TRAIT)
@@ -12,6 +12,8 @@
var/atom/flee_from = controller.blackboard[target_key]
if (controller.blackboard[BB_BASIC_MOB_STOP_FLEEING] || QDELETED(flee_from))
return
if(!should_flee(controller, 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
@@ -19,8 +21,21 @@
controller.queue_behavior(flee_behaviour, target_key, hiding_place_key)
return SUBTREE_RETURN_FINISH_PLANNING //we gotta get out of here.
/datum/ai_planning_subtree/flee_target/proc/should_flee(datum/ai_controller/controller, atom/flee_from)
if (controller.blackboard[BB_BASIC_MOB_STOP_FLEEING] || QDELETED(flee_from))
return FALSE
return TRUE
/// 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
/// A subtype that forces the mob to flee from targets with the scary fisherman trait anyway.
/datum/ai_planning_subtree/flee_target/from_fisherman
/datum/ai_planning_subtree/flee_target/from_fisherman/should_flee(datum/ai_controller/controller, atom/flee_from)
if (!QDELETED(flee_from) && HAS_TRAIT(flee_from, TRAIT_SCARY_FISHERMAN))
return TRUE
return ..()
@@ -22,3 +22,12 @@
return
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.
/datum/ai_planning_subtree/basic_melee_attack_subtree/no_fisherman
/datum/ai_planning_subtree/basic_melee_attack_subtree/no_fisherman/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
var/atom/movable/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
if(QDELETED(target))
return ..()
if(!HAS_TRAIT(target, TRAIT_SCARY_FISHERMAN))
return ..()
@@ -12,4 +12,3 @@
if(watcher.stat != DEAD)
return
return ..()