Files
Bubberstation/code/datums/ai/idle_behaviors
SkyratBot fdfaf83b22 [MIRROR] Mobs will not path into dangerous turfs. [MDB IGNORE] (#24739)
* Mobs will not path into dangerous turfs. (#79428)

## About The Pull Request

Fixes #79255
Fixes #79272
Fixes #79313
Fixes #79328

As it turns out, "basic avoidance" and "dumb" AI pathfinding were both
broken with regards to dangerous turfs, as was "random walk" idle
behavior. Now, these three things will properly avoid turfs that could
kill the mob.

The global typecache of dangerous turfs has been removed, in favor of a
turf-level proc, `can_cross_safely`, which returns TRUE or FALSE based
on whether a movable atom can cross the turf without being harmed. This
obviously defaults to TRUE, and is overridden for the four dangerous
turf types:
- **Space** can be safely crossed only with TRAIT_SPACEWALK. While space
does not directly cause harm, being sent drifting away is not desirable
behavior.
- **Chasms** and **open space** can be safely crossed with
TRAIT_MOVE_FLYING.
- **Lava** can be safely crossed with TRAIT_MOVE_FLYING or
TRAIT_LAVA_IMMUNE.

If an AI's pathfinding would take it through a dangerous turf, or if it
tries to randomly step onto one, the movement will be cancelled.
## Why It's Good For The Game

Basic mobs have all been ignoring dangerous terrain this whole time.
This means that mobs on Lavaland could walk right into chasms, mobs on
multi-Z stations could be tricked into falling into pits, and so on. In
the case of idle movement, no checks were happening whatsoever, causing
similar problems without players ever being involved.

Notably, skeleton mobs on certain away missions were randomly wandering
into lava, causing one of our many random CI failures of the last week.
They won't do that anymore.

All told, this should make AI behavior a little more believable, by
giving basic mobs literally any sense whatsoever of self-preservation.
## Changelog
🆑
fix: Basic mobs will no longer randomly walk into terrain that harms or
kills them.
/🆑

---------

Co-authored-by: Jacquerel <hnevard@ gmail.com>

* Mobs will not path into dangerous turfs.

---------

Co-authored-by: lizardqueenlexi <105025397+lizardqueenlexi@users.noreply.github.com>
Co-authored-by: Jacquerel <hnevard@ gmail.com>
2023-11-02 16:36:44 -04:00
..