mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-16 12:07:48 +00:00
 `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.
16 lines
390 B
Plaintext
16 lines
390 B
Plaintext
/// AIs will attack this as a potential target if they see it
|
|
/datum/element/hostile_machine
|
|
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
|
|
|
|
/datum/element/hostile_machine/Attach(datum/target)
|
|
. = ..()
|
|
|
|
if (!isatom(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
GLOB.hostile_machines += target
|
|
|
|
/datum/element/hostile_machine/Detach(datum/source)
|
|
GLOB.hostile_machines -= source
|
|
return ..()
|