Skip to content

Conversation

TheShuEd
Copy link
Member

@TheShuEd TheShuEd commented Sep 2, 2025

About the PR

The logic behind race color selection restrictions is undergoing a major refactor aimed at improving code extensibility.

Instead of an enum with different color options, which performed different logic in five places in the code using switch case, all the logic is now elegantly placed in a single class inherited from ColoringSchemeRule. This class contains all the logic related to color validation.

Inside SpeciesPrototype, SkinColoration has been removed and replaced with List<ColoringSchemeRule> ColoringRules.

Why / Balance

Adding new types of species color limiters is simply impossible—you have to go through a dozen files, making changes in a bunch of different places. For forks, this is especially awful.

Media

no media

Requirements

Breaking changes

HumanoidSkinColor SkinColoration field inside SpeciesPrototype was replaced with List<ColoringSchemeRule> ColoringRules.

Changelog
no cl

@PJBot PJBot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. S: Approved Status: Reviewed and approved by at least one maintainer; a PR may require another approval. S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. Changes: UI Changes: Might require knowledge of UI design or code. size/M Denotes a PR that changes 100-999 lines. labels Sep 2, 2025
@TheShuEd
Copy link
Member Author

TheShuEd commented Sep 2, 2025

TODO:

  • UI problems with HumanToned (dwarfs and humans)
  • Deharcode old types of rules such as VoxFeather into a set of independent rules for each color that can be combined.

@TheShuEd TheShuEd added the S: DO NOT MERGE Status: Open item that should NOT be merged. DNM. Allows test to run unlike draft. label Sep 2, 2025
@ScarKy0
Copy link
Contributor

ScarKy0 commented Sep 2, 2025

Alternative PR to #39175 I think?

@TheShuEd
Copy link
Member Author

TheShuEd commented Sep 2, 2025

oh, real

@dvir001
Copy link
Contributor

dvir001 commented Sep 2, 2025

Massive life saver for a race like this one:
new-frontiers-14/frontier-station-14#3275

Out of scope, but if you can also add a single-color hair support (or same limits per hair) you are a life saver.

@FairlySadPanda
Copy link
Contributor

Directly impacts Vulps development here, as we're wanting to avoid zany fur colours.

@FairlySadPanda
Copy link
Contributor

If this isn't done yet can you kick it to Draft? Makes it easier to see what's WIP.

@TheShuEd TheShuEd marked this pull request as draft September 2, 2025 23:01
@TheShuEd
Copy link
Member Author

TheShuEd commented Sep 2, 2025

I just wanna also check integration tests in github, so

@FairlySadPanda FairlySadPanda added P2: Raised Priority: Item has a raised priority, indicating it might get increased maintainer attention. T: New Feature Type: New feature or content, or extending existing content D2: Medium Difficulty: A good amount of codebase knowledge required. A: Character/Species Area: Player characters and species features and content. and removed S: DO NOT MERGE Status: Open item that should NOT be merged. DNM. Allows test to run unlike draft. S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Sep 3, 2025
@FairlySadPanda
Copy link
Contributor

FairlySadPanda commented Sep 3, 2025

I've triaged this PR. I've removed DO NOT MERGE as it's redundant for Draft PRs :)

I just wanna also check integration tests in github, so

Understandable fam

Comment on lines +10 to +11
coloringRules:
- !type:Hues
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rules langugage is not expressive enough. I can guess that this means "this species has restrictions on the hues it uses" but it should be phrased as "UseRestrictedHues" or similar, so someone reading the YAML knows intent without having to be familiar with the rules engine.

Copy link
Contributor

@FairlySadPanda FairlySadPanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously a WIP so just commenting on the YAML-facing stuff really

Will want to see how a YAML warrior can tune colourization, but actually for a first PR that's not a priority, we don't need a full YAML rules engine for this yet.


namespace Content.Shared.Humanoid.ColoringScheme;

public sealed partial class HumanToned : ColoringSchemeRule
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public sealed partial class HumanToned : ColoringSchemeRule
public sealed partial class UsesHumanSkinTonesRule : ColoringSchemeRule


namespace Content.Shared.Humanoid.ColoringScheme;

public sealed partial class Hues : ColoringSchemeRule
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment this is probably

Suggested change
public sealed partial class Hues : ColoringSchemeRule
public sealed partial class ClampHuesToMinimumLightnessRule : ColoringSchemeRule

Note that for colors, perceived brightness is not equal across the range. A TODO here noting this for future improvement would be a good idea.


namespace Content.Shared.Humanoid.ColoringScheme;

public sealed partial class TintedHues : ColoringSchemeRule
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public sealed partial class TintedHues : ColoringSchemeRule
public sealed partial class ClampHuesToMinimumSaturationRule : ColoringSchemeRule

This is also covering minimum lightness, so do you need it? Can a speceies just use both the Hues and TintedHues rules?


namespace Content.Shared.Humanoid.ColoringScheme;

public sealed partial class VoxFeathers : ColoringSchemeRule
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight code smell for this to be phrased as a particular species, but Human already exists so I guess it's fine.

Suggested change
public sealed partial class VoxFeathers : ColoringSchemeRule
public sealed partial class UseVoxFeatherHuesRule : ColoringSchemeRule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Character/Species Area: Player characters and species features and content. Changes: UI Changes: Might require knowledge of UI design or code. D2: Medium Difficulty: A good amount of codebase knowledge required. P2: Raised Priority: Item has a raised priority, indicating it might get increased maintainer attention. S: Approved Status: Reviewed and approved by at least one maintainer; a PR may require another approval. S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. size/M Denotes a PR that changes 100-999 lines. T: New Feature Type: New feature or content, or extending existing content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants