Skip to content

Refactors some cleaning slimes behaviors to be subtypes of cleanbot behaviors #5657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

LikeLakers2
Copy link
Collaborator

@LikeLakers2 LikeLakers2 commented Feb 25, 2025

About The Pull Request

Requested by @Absolucy.

Cleaning slimes act similarly to cleanbots, just with different targets. Unfortunately, the cleaning slime code does not reuse the cleanbot code where it can - leading to duplicated code, and in turn, bugs.

This PR attempts to fix this by refactoring such ai behavior code into subtypes of cleanbot behaviors, where I can figure out how to make it work.

To do so, this PR ports the following supporting PRs from tgstation:

And in fixing all this, I incidentally also fixed player-controlled cleaner slimes not being able to clean cleanables.

Why It's Good For The Game

Reduces maintenance costs for cleaning slimes.

Changelog

🆑MichiRecRoom, vinylspiders, Ben10Omintrix
fix: (Ben10Omintrix) stationary medbots will no longer ignore u for a while if u move out of their way while healing
fix: (Ben10Omintrix) fixes a runtime that sometimes happens in ai controllers
refactor: (MichiRecRoom) Some cleaning slime behaviors have been refactored to use similar behaviors as cleanbots.
fix: (MichiRecRoom) Cleaner slimes should now temporarily ignore things that they can't reach.
fix: (MichiRecRoom) Player-controlled cleaner slimes should now be able to clean cleanables.
/:cl:

@LikeLakers2 LikeLakers2 added Code: Fix fix da bug Feature: Refactor/Rework Completely redoing a larger thing / recoding a thing labels Feb 25, 2025
vinylspiders and others added 5 commits February 25, 2025 15:07
Consider this a continuation of
tgstation/tgstation#80202

![firefox_P62DdMv946](https://github.com/tgstation/tgstation/assets/13398309/1a784a27-e5c9-42d1-b160-7eb9251b3997)

~~It seems I missed a few.~~

Edit: Modified per request to handle this more broadly. If a pawn gets
`qdel`'d, the ai controller should be set to off and get removed from
the list of active controllers, and all their actions should be
canceled.

Also adds some qdeleted checks to `finish_action()`, which can still run
after the pawn gets qdeleted as part of the `CancelActions()` chain.

Less spurious CI failures.

Nothing player facing really.
…their blacklist (#80708)

## About The Pull Request
bots will automatically add things it cant reach to a temporary
blacklist and ignore them until the blacklist is cleared. this however
can cause issues if u move out of the way of a stationary medbot while
its healing u, so it deems u unreachable and not try to heal u until the
blacklist is cleared

## Why It's Good For The Game
bots will automatically add things it cant reach to a temporary
blacklist and ignore them until the blacklist is cleared. this however
can cause issues if u move out of the way of a stationary medbot while
its healing u, so it deems u unreachable and not try to heal u until the
blacklist is cleared

## Changelog
:cl:
fix: stationary medbots will no longer ignore u for a while if u move
out of their way while healing
/:cl:
fixes the flaky error that would happen in cleanbot controllers. i
discovered thru the profiler that a proc i was using to stop tracking
unreachable targets and caching them to a blacklist in selectbehavior
had a bit of a high real time cost, so if the mob got deleted midway
through for any reason would cause a runtime error. ive moved this proc
off selectbehavior and im instead letting the move loop cache this
target into the blacklist if it reaches the max pathing attempts
fixes a runtime that sometimes happens in ai controllers

:cl:
fix: fixes a runtime that sometimes happens in ai controllers
/:cl:
@LikeLakers2 LikeLakers2 marked this pull request as draft February 25, 2025 20:09
@LikeLakers2 LikeLakers2 force-pushed the project/refactor/cleaning-slime-behaviors branch from 51465a0 to bd95fae Compare February 25, 2025 20:10
…ior/execute_clean/slime`

Currently it does nothing extra atop `/datum/ai_behavior/execute_clean`, but I've left the datum there just in case we want to make it behave differently in the future.
@LikeLakers2 LikeLakers2 marked this pull request as ready for review February 25, 2025 20:56
@LikeLakers2 LikeLakers2 marked this pull request as draft February 25, 2025 20:57
@LikeLakers2 LikeLakers2 marked this pull request as ready for review February 25, 2025 22:06
@Absolucy Absolucy merged commit ccd92ce into Monkestation:master Mar 11, 2025
26 checks passed
github-actions bot added a commit that referenced this pull request Mar 11, 2025
@LikeLakers2 LikeLakers2 deleted the project/refactor/cleaning-slime-behaviors branch March 11, 2025 03:50
tired-wired pushed a commit that referenced this pull request Mar 29, 2025
## About The Pull Request

#5657
unintentionally removed the `TRAIT_TRASH_ITEM` check, which broke the
ability for cleaner slimes to target things like used ammo, used
mutation syringes, emptied drink bottles, burnt matches, and such.

## Why It's Good For The Game

bugfix

## Changelog
:cl:
fix: Cleaner slimes now properly target other types of trash (used ammo,
used mutation syringes, emptied drink bottles, burnt matches, etc)
again.
/:cl:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Fix fix da bug Feature: Refactor/Rework Completely redoing a larger thing / recoding a thing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants