mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-15 18:14:22 +01:00
[MIRROR] Fixes fleeing behaviour [MDB IGNORE] (#24223)
* Fixes fleeing behaviour (#78821) ## About The Pull Request This PR does three things: - Fixes fleeing, I broke it in a recent PR so mobs would walk to a location then sort of stand there doing nothing. This is due to using `>=` instead of `>`. - Makes lobstrosities stop running and charge at you more responsively (when they detect they can charge). - Inverts the `BB_BASIC_MOB_FLEEING` blackboard key to `BB_BASIC_MOB_STOP_FLEEING` so that the default behaviour is "to perform the behaviour that you put on the mob" instead of to not do that. ## Why It's Good For The Game Makes commonly used behaviour work properly. Removes footgun we hand to ai developers. ## Changelog 🆑 fix: Cowardly mobs will consistently run away from you instead of getting tired and just sort of standing there after an initial burst of movement. /🆑 * Fixes fleeing behaviour --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
/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_FLEEING] || QDELETED(flee_from))
|
||||
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)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/datum/ai_planning_subtree/simple_find_nearest_target_to_flee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
||||
. = ..()
|
||||
if (!controller.blackboard[BB_BASIC_MOB_FLEEING])
|
||||
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)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
/datum/ai_planning_subtree/find_nearest_thing_which_attacked_me_to_flee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
||||
. = ..()
|
||||
if (!controller.blackboard[BB_BASIC_MOB_FLEEING])
|
||||
if (controller.blackboard[BB_BASIC_MOB_STOP_FLEEING])
|
||||
return
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user