Files
Bubberstation/code/datums/ai/bane/bane_controller.dm
T
Ben10Omintrix 91baa94ac5 event based incapicated and able_to_run (#86031)
## About The Pull Request
this is a revival of #82635 . i got permission from potato to reopen
this, he did almost all the work. i only just solved the conflicts and
fixed all the bugs that were preventing the original from being merged
(but it should be TMed first)

## Why It's Good For The Game
slightly improves the performance of basic mob AI

## Changelog
🆑
LemonInTheDark
refactor: able_to_run and incapacitated have been refactored to be event
based
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: ZephyrTFA <matthew@tfaluc.com>
2024-09-04 10:02:49 -04:00

32 lines
1.1 KiB
Plaintext

/*
You yourself fought the decadence of Gotham for years with all your strength, all your resources, all your moral authority.
And the only victory you achieved was a lie. Now you understand Gotham is beyond saving, and must be allowed to die.
*/
/datum/ai_controller/bane
movement_delay = 0.4 SECONDS
blackboard = list(BB_BANE_BATMAN = null)
planning_subtrees = list(/datum/ai_planning_subtree/bane_hunting)
/datum/ai_controller/bane/TryPossessPawn(atom/new_pawn)
if(!isliving(new_pawn))
return AI_CONTROLLER_INCOMPATIBLE
return ..() //Run parent at end
/datum/ai_controller/bane/on_stat_changed(mob/living/source, new_stat)
. = ..()
update_able_to_run()
/datum/ai_controller/bane/setup_able_to_run()
. = ..()
RegisterSignal(pawn, COMSIG_MOB_INCAPACITATE_CHANGED, PROC_REF(update_able_to_run))
/datum/ai_controller/bane/clear_able_to_run()
UnregisterSignal(pawn, list(COMSIG_MOB_INCAPACITATE_CHANGED, COMSIG_MOB_STATCHANGE))
return ..()
/datum/ai_controller/bane/get_able_to_run()
var/mob/living/living_pawn = pawn
if(IS_DEAD_OR_INCAP(living_pawn))
return FALSE
return ..()