Skip to content
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

[MIRROR] Slime type datum, and cleans up slime related code #832

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Skyrat: Skyrat-SS13/Skyrat-tg#25250
Original PR: tgstation/tgstation#79852

About The Pull Request

I have decided to help out with basic mobbing slimes, and found out, that this code is ancient and crusty. So I have decided to refactor and tweak things bit but but, until the moment I will hit AI related stuff.

I might have gone a bit overboard, and performed a melange of fixes. I have done the following in order:

  • Slime colour, core type and mutation list are now held by a single slime_type datum. This means the slime's core is no longer spawned using text operations on the slime's colour, and the slime's mutation is no longer a single large switch statement that returns an exactly four element length array. Icons are still based on the slime's colour define, but that is now more changeable.
  • Autodocced all the slime procs and vars I could find, while also renamed them to be more descriptive. Also made Booleans actual booleans. Also added code to confused code segments. For example, did you know that slimes would forgive all its stacks of Feeling Very Attack Right Now, if it has exactly one level of Discipline? I didn't, and I almost turned the 1 in the check into a TRUE before I had a second look.
  • Added defines to the slime hunger checks
  • Cleaned up a lot of single letter vars in all code that referenced the now changed variables.
  • Large amount of if-chain pyramids have been turned into early returns. More readable.
  • Made the xenobiology camera shortcuts and actions always do the same thing, though the action buttons still loop through all of the conents. In addition, after seeing a comment lamenting about varied load orders, I have made autolinking the monkey recycler is now done in LateInitialize, which didn't exist when it was made.
  • I have included an UpdatePath that changes the colours of premapped slimes, but I did not do anything for the other values.
  • I noticed slimes were unable to attack pacifist humans, due to trait checking the human instead of the attacking slime. This has been fixed.
  • The slime scanner has an examine block, and it now describes your slimes' "mutation attempt chance", instead of like, performing math in case the slime's current colour is one of the mutations, or hiding it if it has none. This value is needed to breed rainbow slimes.

This has been an extremely large scrubbing. I am willing to try rip it up into smaller chunks, even if most of it is just single letter vars and if pyramids.

Why It's Good For The Game

If code is more readable and expandable, it will aid in further refactors.

Changelog

🆑 Profakos
refactor: Slimes's colour, core type and mutation list is now held in a slime type datum
code: Slime's variables have been documented, and renamed a bit to add clarity. Please report bugs that might stem from renaming.
fix: Slimes are not longer prevented from attacking pacifist humans.
qol: Slime scans now display the actual amount of genetic instability, instead of hiding it if a slime doesn't mutate further, or tweaking it if it might mutate back into itself. This will make it easier to parse which slime to breed further to get a rainbow slime.
/:cl:

…RE] (#25250)

* Slime type datum, and cleans up slime related code

* Resolves Conflict, Preserves SR Edit

* Update code/game/objects/items/devices/scanners/slime_scanner.dm

Co-authored-by: Bloop <[email protected]>

---------

Co-authored-by: Profakos <[email protected]>
Co-authored-by: Bloop <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
@Iajret Iajret merged commit 2fefce5 into master Nov 26, 2023
24 checks passed
@Iajret Iajret deleted the upstream-mirror-25250 branch November 26, 2023 09:10
AnywayFarus added a commit that referenced this pull request Nov 26, 2023
Iajret pushed a commit that referenced this pull request Feb 8, 2024
* Fix some copy paste UI errors (#81325)

## About The Pull Request

One day we will have opendream lint to catch this. (WYCI I guess)

* Fix some copy paste UI errors

---------

Co-authored-by: MrMelbert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants