-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Law corruption format variations #40455
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
base: master
Are you sure you want to change the base?
Law corruption format variations #40455
Conversation
…, OG all-caps and no formatting as options.
I don't know how to make linter happy. I have not found any examples of a top-level abstract prototypes anyhere else in the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the idea, but I think the prototype implementation needs work.
- !type:NoFormatCorruptionPrototype | ||
type: lawFormatCorruption | ||
id: NoFormatCorruption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't the way to implement these prototypes. EntityTablePrototype
is a good example. It's serves as a simple container for EntityTableSelector
which is an abstract class and implements the actual code.
- !type:NoFormatCorruptionPrototype | |
type: lawFormatCorruption | |
id: NoFormatCorruption | |
- type: lawFormatCorruption | |
id: NoFormatCorruption | |
format: !type:NoFormatCorruption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disappointing because this is the cleanest use of prototype type polymorphism and it works in game flawlessly.
The only problem that seems to block native support for abstract prototype types is that they get: (a) registered as regular prototypes for testing due to [Prototype]
and (b) omitted for prototype type registration due to [Virtual]
.
Unfortunate because as I said it works perfectly well in-game, and it's just a matter of connecting some dots. Sadly adding to ignore in EntryPoint.cs
solves only problem (a), so (b) is still an engine-level blocker.
Time to make that workaround sigh
_prototypeManager.RegisterIgnore("ghostRoleRaffleDecider"); | ||
_prototypeManager.RegisterIgnore("codewordGenerator"); | ||
_prototypeManager.RegisterIgnore("codewordFaction"); | ||
_prototypeManager.RegisterIgnore("lawFormatCorruption"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary if law corruptions get moves to shared. Moving them to shared would have additional benefits such as allow for SiliconLaw
s to contain the corruption prototype directly instead of an altered string.
LawContent.OnTextChanged += _ => | ||
{ | ||
_law!.LawString = Rope.Collapse(LawContent.TextRope).Trim(); | ||
_law!.FlavorFormattedLawString = null; // Edit laws UI does not support format corruption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be marked as a TODO add format corruption support
instead of an outright denial of it.
/// - NO: identical to original text - set this to null instead. | ||
/// </remarks> | ||
[DataField] | ||
public string? FlavorFormattedLawString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like this implementation. It forces you to recreate the string every time you want to change it, which leaves you vulnerable to arbitrary changes and makes multiple corruptions messy. If this was a List<ProtoId<LawFormatCorruptionPrototype>>
you could stack corruptions easily, and it would be much easier to "pre-corrupt" laws through yml.
About the PR
In the past (read: now), corrupted laws were always ALL CAPS.
Community spoke out that this is a feature, so I embraced this view, and took it to a new extreme.
Now it's a fully grown-up feature.
Say hello to:
Corrupted law format variations!
Why / Balance
A deep dive into why the community likes and insists on keeping the all-caps corrupted laws revealed a very interesting point:
How the law string is presented to the user - its formatting - has meaningful impact on its interpretation.
I found this interaction particularly interesting, because laws are RP rules, but at the same time they are subject to interpretation, and as long as they adhere to the wording they are fine.
Keyword: wording. So if we were to change something that's not wording, for example format....
Add personal subjectivity to the mix and you have a flavorful niche that exists entirely in the realm of subjective interpretation.
THIS IS GREAT (see what I did there with the all caps?) so I decided to expand on this to make it more robust and flavorful.
The text of the law remains the same. But other aspects of text's presentation can now be different. Does this change the meaning? You decide!
Would you interpret an orange-colored law differently?

Maybe! But you must still strictly adhere to its meaning (per rules).
What does it mean for your law to be cyan?

Is this a code yellow alert?

And don't forget that-

This creates flavor where none existed, and meaninfully expands the "laws are subject to interpretation" without rule-breaking. I absolutely love that.
Technical details
Corrupted silicon laws (ion storm & salvaged cyborgs) now on top of their randomized wording (unchanged) additionally have randomized format corruption. This can be:
Nitty-gritty technical details
SiliconLaw
to support format corruption;LawFormatCorruptionPrototype
with three variations: OG all-caps, no corruption, and proof-of-concept random-color;Related systems testing
IonStorm
andStartIonStormed
siliconsAccessibility
For our colorblind friends I am pleased to note that the main focus of this feature is 100% subjective and thus fully opt-in. If you cannot tell that a law is a different color - nothing is lost! Your interpretation of said law is still 100% your subjective take on it, and that remains unchanged regardless of how differently you perceive its color.
I do have a small worry regarding accessibility and that is the possibility for the colored text to blend-in with the background in some types of color blindness. The colors in this PR were selected from a high-contract pool, but I cannot verify if this is sufficient. If there is an issue please let me know
On a small note - this feature initally included a "readout mode" toggle that allowed the player to view the raw text of laws, stripped of flavor formatting. It was removed due to popular demand. It can be re-add it if needed. That would completely solve all accessibility problems this feature might have.
Future additional content to this feature?
(sneak peak only - NOT part of this PR - was planned but got cut down due to rigidity of how accents are currently implemented)
Requirements
PS
This space reserved to remind cyborgs that


and to never forget that
Changelog
🆑 Carve