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.
/🆑
This commit is contained in:
Jacquerel
2023-02-15 18:34:41 -07:00
committed by GitHub
parent 7ebc843200
commit 7c30d9d746
37 changed files with 364 additions and 301 deletions
@@ -56,6 +56,6 @@
devour.Grant(src)
var/datum/action/adjust_vision/adjust_vision = new(src)
adjust_vision.Grant(src)
ai_controller.blackboard[BB_BILEWORM_SPEW_BILE] = spew_bile
ai_controller.blackboard[BB_BILEWORM_RESURFACE] = resurface
ai_controller.blackboard[BB_BILEWORM_DEVOUR] = devour
ai_controller.blackboard[BB_BILEWORM_SPEW_BILE] = WEAKREF(spew_bile)
ai_controller.blackboard[BB_BILEWORM_RESURFACE] = WEAKREF(resurface)
ai_controller.blackboard[BB_BILEWORM_DEVOUR] = WEAKREF(devour)
@@ -18,14 +18,15 @@
if(QDELETED(target))
return
var/datum/action/cooldown/mob_cooldown/resurface = controller.blackboard[BB_BILEWORM_RESURFACE]
var/datum/weakref/weak_action = controller.blackboard[BB_BILEWORM_RESURFACE]
var/datum/action/cooldown/mob_cooldown/resurface = weak_action?.resolve()
//because one ability is always INFINITY cooldown, this actually works to check which ability should be used
//sometimes it will try to spew bile on infinity cooldown, but that's okay because as soon as resurface is ready it will attempt that
if(resurface.next_use_time <= world.time)
controller.queue_behavior(/datum/ai_behavior/try_mob_ability/and_plan_execute, BB_BILEWORM_RESURFACE, BB_BASIC_MOB_CURRENT_TARGET)
if(resurface && resurface.next_use_time <= world.time)
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability/and_plan_execute, BB_BILEWORM_RESURFACE, BB_BASIC_MOB_CURRENT_TARGET)
else
controller.queue_behavior(/datum/ai_behavior/try_mob_ability/and_plan_execute, BB_BILEWORM_SPEW_BILE, BB_BASIC_MOB_CURRENT_TARGET)
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability/and_plan_execute, BB_BILEWORM_SPEW_BILE, BB_BASIC_MOB_CURRENT_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING //focus on the fight
/datum/ai_planning_subtree/bileworm_execute
@@ -37,5 +38,5 @@
if(QDELETED(target) || target.stat < UNCONSCIOUS)
return
controller.queue_behavior(/datum/ai_behavior/try_mob_ability, BB_BILEWORM_DEVOUR, BB_BASIC_MOB_EXECUTION_TARGET)
controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability, BB_BILEWORM_DEVOUR, BB_BASIC_MOB_EXECUTION_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING //focus on devouring this fool