[MIRROR] More Basic AI behavior flags for manipulating movement [MDB IGNORE] (#10593)

* More Basic AI behavior flags for manipulating movement (#63974)

* More Basic AI behavior flags for manipulating movement

Co-authored-by: ma44 <guyonleagueoflegends@gmail.com>
This commit is contained in:
SkyratBot
2022-01-11 13:54:31 +01:00
committed by GitHub
parent b83b715b5f
commit 89b4899f5b
2 changed files with 9 additions and 3 deletions

View File

@@ -18,6 +18,10 @@
#define AI_BEHAVIOR_REQUIRE_MOVEMENT (1<<0)
///Does this task let you perform the action while you move closer? (Things like moving and shooting)
#define AI_BEHAVIOR_MOVE_AND_PERFORM (1<<1)
///Does finishing this task not null the current movement target?
#define AI_BEHAVIOR_KEEP_MOVE_TARGET_ON_FINISH (1<<2)
///Does finishing this task make the AI stop moving towards the target?
#define AI_BEHAVIOR_KEEP_MOVING_TOWARDS_TARGET_ON_FINISH (1<<3)
///AI flags
#define STOP_MOVING_WHEN_PULLED (1<<0)

View File

@@ -21,6 +21,8 @@
/datum/ai_behavior/proc/finish_action(datum/ai_controller/controller, succeeded, ...)
LAZYREMOVE(controller.current_behaviors, src)
controller.behavior_args -= type
if(behavior_flags & AI_BEHAVIOR_REQUIRE_MOVEMENT) //If this was a movement task, reset our movement target.
controller.current_movement_target = null
controller.ai_movement.stop_moving_towards(controller)
if(behavior_flags & AI_BEHAVIOR_REQUIRE_MOVEMENT) //If this was a movement task, reset our movement target if necessary
if(!(behavior_flags & AI_BEHAVIOR_KEEP_MOVE_TARGET_ON_FINISH))
controller.current_movement_target = null
if(!(behavior_flags & AI_BEHAVIOR_KEEP_MOVING_TOWARDS_TARGET_ON_FINISH))
controller.ai_movement.stop_moving_towards(controller)