Give basic mob ranged attacks a cooldown (#77575)

## About The Pull Request

Atomised change from a different PR I am working on.
This changes the basic mob ranged attacks element into a component so
that it can also track an attack cooldown on the mob, preventing it from
firing until the cooldown is complete.
This was possible with simple mobs but wasn't kept going forwards when
converting things to basic ones.

## Why It's Good For The Game

Ideally player and mob behaviour should be unified as much as is
realistically possible. Currently mobs which are designed to fire a
powerful weapon slowly can blast as rapidly as the click cooldown if
placed under control of a player, which is not ideal.
This isn't currently aligned for melee attacks either but I will look at
that later.

## Changelog

🆑
fix: Player-controlled basic mobs with ranged attacks can now only fire
about as fast as AI-controlled ones.
/🆑
This commit is contained in:
Jacquerel
2023-08-13 14:39:47 -06:00
committed by GitHub
parent 19a22ee8a4
commit 29c3d38c7e
9 changed files with 94 additions and 66 deletions
@@ -13,7 +13,7 @@
melee_attack_behavior = /datum/ai_behavior/basic_melee_attack/average_speed
/datum/ai_planning_subtree/basic_ranged_attack_subtree
operational_datums = list(/datum/element/ranged_attacks)
operational_datums = list(/datum/component/ranged_attacks)
var/datum/ai_behavior/basic_ranged_attack/ranged_attack_behavior = /datum/ai_behavior/basic_ranged_attack
/datum/ai_planning_subtree/basic_ranged_attack_subtree/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)