mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
[MIRROR] Basic Mob Carp Part VIII: Basic Mob Carp [MDB IGNORE] (#18344)
* Basic Mob Carp Part VIII: Basic Mob Carp * maps * missed killing main carp file * shorki and ocean biomes * shorki 2: pet-a-boogaloo Co-authored-by: Jacquerel <hnevard@gmail.com> Co-authored-by: tastyfish <crazychris32@gmail.com>
This commit is contained in:
co-authored by
Jacquerel
tastyfish
parent
381bbef2f8
commit
7ee524f748
@@ -0,0 +1,26 @@
|
||||
/// Attempts to use a mob ability on a target
|
||||
/datum/ai_planning_subtree/targetted_mob_ability
|
||||
/// Blackboard key for the ability
|
||||
var/ability_key
|
||||
/// Blackboard key for where the target ref is stored
|
||||
var/target_key = BB_BASIC_MOB_CURRENT_TARGET
|
||||
/// Behaviour to perform using ability
|
||||
var/use_ability_behaviour = /datum/ai_behavior/try_mob_ability
|
||||
|
||||
/datum/ai_planning_subtree/targetted_mob_ability/SelectBehaviors(datum/ai_controller/controller, delta_time)
|
||||
if (!ability_key)
|
||||
CRASH("You forgot to tell this mob where to find its ability")
|
||||
|
||||
var/datum/weakref/weak_target = controller.blackboard[target_key]
|
||||
var/mob/living/target = weak_target?.resolve()
|
||||
if (QDELETED(target))
|
||||
return
|
||||
|
||||
var/datum/action/cooldown/using_action = controller.blackboard[ability_key]
|
||||
if (QDELETED(using_action))
|
||||
return
|
||||
if (!using_action.IsAvailable())
|
||||
return
|
||||
|
||||
controller.queue_behavior(use_ability_behaviour, ability_key, target_key)
|
||||
return SUBTREE_RETURN_FINISH_PLANNING
|
||||
Reference in New Issue
Block a user