Files
Bubberstation/code/datums/ai/basic_mobs/base_basic_controller.dm
Jacquerel 7c30d9d746 Basic Wumborian Fugu & Fugu Gland (#73415)
## About The Pull Request

Fixes #72677 and also converted the "Wumborian Fugu" mob to a basic mob
rather than a simple one.
I will be totally honest: I didn't need to do that in order to fix the
bug. I just didn't like looking at the rest of the code in that file.
Also I have some kind of sickness which makes me do this.

This ended up being one of those "see something related and fix it as
well" ones so there's a couple of only tangentially related changes in
here. If you want me to split it up I will but I think this one is
_probably_ fine because the wide-ranging changes are pretty simple ones?

So what this PR does is:
- Refactors simple mob into basic mob.
- Cleans up its really ugly ability to work in a hopefully nicer way.
- A one line fix to the linked issue above.
- Modifies the default cooldown on `basic_melee_attack` and
`attack_obstructions` to be a widely used cooldown rather than a random
value used by no mob that we have.
- Renamed behaviour "try_mob_ability" to "targeted_mob_ability" and
added a new AI behaviour called "use_mob_ability", the difference
between the two being that the former requires a target and the latter
does not. I... don't actually use this because I realised after adding
it that I still want a target for this mob, but someone will need it
eventually.
- Change everywhere that is passing references to abilities to actions
to pass weak references instead.
- Adds an element to handle "spawn this stuff when a related mob dies".
- Found a few places where people were setting `environment_smash ` as
if it did anything (including me) and replaced them with the proper
ai_controller implementation instead, updated the comment to make it
clearer although that won't prevent copy/paste errors.
- Registered to the "movement speed updated" signal to ensure that basic
mobs actually notice that you have applied a movement speed modifier.

## Why It's Good For The Game

Fixes a linked issue.
Refactors some code which made me sad whenever I saw it.
Restores some mob behaviour which nobody noticed was missing, but was.
Fixes some apparently unreliable code I added in a recent PR reliant on
basic mobs using movespeed modifiers.
Adds element we will definitely need again in the future.

## Changelog

🆑

fix: The Fugu Gland can once more be used on Ian, Carp, Giant Spiders,
or other basic mobs.
fix: Syndicate mobs will once again attack windows to try to reach you,
and space ruin spiders won't.
fix: Netherworld-themed mobs will correctly adjust their speed as they
take damage.
refactor: Made the Wumborian Fugu into a basic mob, which should act
largely the same way but may have slightly different speed and reaction
times.
/🆑
2023-02-15 18:34:41 -07:00

26 lines
756 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))
var/mob/living/living_pawn = pawn
if(IS_DEAD_OR_INCAP(living_pawn))
return FALSE
/datum/ai_controller/basic_controller/proc/update_speed(mob/living/basic/basic_mob)
SIGNAL_HANDLER
movement_delay = basic_mob.cached_multiplicative_slowdown