## About The Pull Request
this refactors `GLOB.hostile_machines` into
`GLOB.hostile_machines_by_z`, which is a per-z list, and mobs targeting
hostile machines (mechas, turrets) will only check those on the same
Z-level.
## Why It's Good For The Game
better performance
## Changelog
🆑
refactor: Refactored how mobs target turrets and mechs, which should
hopefully be more performant.
/🆑
## About The Pull Request
Nother bit ripped out of #79498
[Implements a get_cooldown() proc to get around dumb manual overrides
and empower me to optimize the findtarget
logic](https://github.com/tgstation/tgstation/commit/7047d294dd2675b7e38db2424d6d79c52f21783a)
[Adds modify_cooldown, uses it to optimize find_potential_targets
further](https://github.com/tgstation/tgstation/commit/4ebc8cedcefaa57a1c3d1afbbb485baa6fae0a4f)
No sense running the behavior if we're just waiting on its output, so
let's run it once a minute just in case, then push an update instantly
if we find something
[Optimizes connect_range and
promxity_monitors](https://github.com/tgstation/tgstation/commit/bcf7d7c5b371e46c02aa9039d4ccd4715b999400)
We know what turfs exist before and after a move
We can use this information to prevent trying to update turfs we don't
care about.
This is important because post these changes mobs with fields will be
moving a lot more, so it's gotta be cheap
[Implements a special kind of field to handle ai
targeting](https://github.com/tgstation/tgstation/commit/80b63b3445778eb2c75fc2f8f61aca07ed482b1f)
If we run targeting and don't like, find anything, we should setup a
field that listens for things coming near us and then handle those
things as we find them.
This incurs a slight startup cost but saves so much time on the churn of
constant costs
Note:
We should also work to figure out a way to avoid waking ais if none is
near them/they aren't doing anything interesting
We don't need to do that immediately this acts as somewhat of a stopgap
(and would be good regardless) but it is worth keeping in mind)
## IMPORTANT
I am unsure whether this is worth it anymore since #82539 was merged. As
I say it was done as a stopgap because ais didn't know how to idle.
If not I'll rip er out and we'll keep the other
refactoring/optimizations.
## Why It's Good For The Game
Cleaner basic ai code, maybe? faster basic ai code, for sure faster
proximity monitors (significantly)

`find_potential_targets/perform` currently has a pretty bad self cost in
part due to it running a second "loop over everything in range" check to
find turrets and mechs. This doesn't drop it down by as much as I'd like
because it still needs `hearers`, it still shows up pretty high, but
this at least cuts out some unnecessary work.
Best case is likely to minimize work AIs need to do when there are no
players on their z-level, as there are a lot of calls from Lavaland.