mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
Refactors Parrots into Basic Mobs (ft. Ben10Omintrix/Kobsamobsa) (#79762)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
/datum/ai_behavior/basic_melee_attack
|
||||
action_cooldown = 0.2 SECONDS // We gotta check unfortunately often because we're in a race condition with nextmove
|
||||
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_REQUIRE_REACH | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
|
||||
///do we finish this action after hitting once?
|
||||
var/terminate_after_action = FALSE
|
||||
|
||||
/datum/ai_behavior/basic_melee_attack/setup(datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
|
||||
. = ..()
|
||||
@@ -39,12 +41,21 @@
|
||||
else
|
||||
basic_mob.melee_attack(target)
|
||||
|
||||
if(terminate_after_action)
|
||||
finish_action(controller, TRUE, target_key)
|
||||
|
||||
/datum/ai_behavior/basic_melee_attack/finish_action(datum/ai_controller/controller, succeeded, target_key, targeting_strategy_key, hiding_location_key)
|
||||
. = ..()
|
||||
if(!succeeded)
|
||||
controller.clear_blackboard_key(target_key)
|
||||
|
||||
/datum/ai_behavior/basic_melee_attack/interact_once
|
||||
terminate_after_action = TRUE
|
||||
|
||||
/datum/ai_behavior/basic_melee_attack/interact_once/finish_action(datum/ai_controller/controller, succeeded, target_key, targeting_strategy_key, hiding_location_key)
|
||||
. = ..()
|
||||
controller.clear_blackboard_key(target_key)
|
||||
|
||||
/datum/ai_behavior/basic_ranged_attack
|
||||
action_cooldown = 0.6 SECONDS
|
||||
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/datum/ai_behavior/unbuckle_mob
|
||||
|
||||
/datum/ai_behavior/unbuckle_mob/perform(seconds_per_tick, datum/ai_controller/controller)
|
||||
. = ..()
|
||||
|
||||
var/mob/living/living_pawn = controller.pawn
|
||||
var/atom/movable/buckled_too = living_pawn.buckled
|
||||
|
||||
if(isnull(buckled_too))
|
||||
finish_action(controller, FALSE)
|
||||
return
|
||||
|
||||
buckled_too.unbuckle_mob(living_pawn)
|
||||
finish_action(controller, TRUE)
|
||||
Reference in New Issue
Block a user