Files
Bubberstation/code/datums/ai/basic_mobs/base_basic_controller.dm
Jacquerel 5e2c8459dd Basic Heretic Mobs: The Rest of Them (#78757)
## About The Pull Request

Raw Prophet and Armsy had fun stuff going on and merited their own PRs,
but the rest of these guys are basically just statblocks with abilities
so I converted them all at once.

Rust Walkers are present in a ruin and so have new AI which will
actually use their abilities. They rust the area around where they spawn
and throw their rust blast at people.

I also gave Flesh Stalkers AI even though nobody has put them in a map
because I thought it would be cool. This adds an AI behaviour where if
they're not doing anything else they will turn into an animal and chill
until someone's been around them for a bit, before attacking. They will
also use EMP almost immediately upon performing their ambush, which
kills the lights in that room. Spooky!
To support this I needed to make some changes to let AI continue
processing and targetting correctly while shapeshifted.

I didn't give Maids or Ash Spirits AI because they'd be really boring.

Other changes:
I made the maid in the mirror flicker when it takes examine damage
because the `visible_message` says it does but despite having the power,
nobody made it actually flicker...

## Why It's Good For The Game

No more simple mob heretic summons.

## Changelog

🆑
refactor: Rust Walkers, Ash Spirits, Flesh Stalkers, and The Maid in the
Mirror now use the basic mob framework. Please report any unusual
behaviour.
/🆑

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2023-10-06 16:06:22 -06:00

32 lines
1010 B
Plaintext

/datum/ai_controller/basic_controller
movement_delay = 0.4 SECONDS
/datum/ai_controller/basic_controller/TryPossessPawn(atom/new_pawn)
if(!isbasicmob(new_pawn))
return AI_CONTROLLER_INCOMPATIBLE
var/mob/living/basic/basic_mob = new_pawn
update_speed(basic_mob)
RegisterSignals(basic_mob, list(POST_BASIC_MOB_UPDATE_VARSPEED, COMSIG_MOB_MOVESPEED_UPDATED), PROC_REF(update_speed))
return ..() //Run parent at end
/datum/ai_controller/basic_controller/able_to_run()
. = ..()
if(!isliving(pawn))
return
var/mob/living/living_pawn = pawn
var/incap_flags = NONE
if (ai_traits & CAN_ACT_IN_STASIS)
incap_flags |= IGNORE_STASIS
if(!(ai_traits & CAN_ACT_WHILE_DEAD) && (living_pawn.incapacitated(incap_flags) || living_pawn.stat))
return FALSE
if(ai_traits & PAUSE_DURING_DO_AFTER && LAZYLEN(living_pawn.do_afters))
return FALSE
/datum/ai_controller/basic_controller/proc/update_speed(mob/living/basic/basic_mob)
SIGNAL_HANDLER
movement_delay = basic_mob.cached_multiplicative_slowdown