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

Traits V2 #1182

Merged
merged 22 commits into from
Nov 8, 2024
Merged

Traits V2 #1182

merged 22 commits into from
Nov 8, 2024

Conversation

VMSolidus
Copy link
Member

@VMSolidus VMSolidus commented Nov 6, 2024

Description

Traits Version 2 implements a much needed overhaul of the Trait System, changing it so that it no longer uses hardcoded nullable lists of various entries required for the trait functions, and instead accepts a single Modular List of Functions, and then iterates through the list like a set of instructions on how to modify the character. This PR also features a few new Functions, such as AddImplant.

Anyway, rather than hardcoding a new codepath for every new function, new functions can simply be made separate from the codepath entirely, and will only be called if they are included in the trait itself.

TODO

  • Remove ALL pre-existing trait functions and move them over to the new system.
  • Evaluate which System Dependencies are essential for a majority of functions, and make sure that TraitSystem is caching them on behalf of the functions that need them for performance reasons. This system has a fairly high startup cost for frametime to begin with.
  • Update all pre-existing traits such that they use the new System.

BREAKING CHANGES

ALL DOWNSTREAM TRAITS WILL NEED TO BE MODIFIED TO USE THE NEW SYSTEM.

Changelog

🆑

  • add: Traits can now add Implants directly.

@VMSolidus VMSolidus marked this pull request as draft November 6, 2024 02:17
@github-actions github-actions bot added Changes: C# Changes any cs files Changes: YML Changes any yml files labels Nov 6, 2024
@VMSolidus VMSolidus marked this pull request as ready for review November 7, 2024 02:54
@github-actions github-actions bot added the Status: Needs Review Someone please review this label Nov 7, 2024
@VMSolidus
Copy link
Member Author

It's finally ready.

@FoxxoTrystan FoxxoTrystan added Priority: 2-High Needs to be resolved as soon as possible Size: 3-Medium For medium issues/PRs Type: Rework Large changes to a system, like a mix between the Balancing, Codebase, and Respace labels labels Nov 7, 2024
[DataField]
public List<string>? RemoveFactions { get; private set; } = default!;
[DataField(serverOnly: true)]
public TraitFunction[] Functions { get; private set; } = Array.Empty<TraitFunction>();
Copy link
Member

Choose a reason for hiding this comment

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

Why an array?

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea to be honest, I had no idea what was entirely essential for this style of setup, so it's exactly how it was with the JobSpecial.

Copy link
Contributor

Choose a reason for hiding this comment

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

Both can be used. Since it's fixed length (you will not change it via VVEdit or in code) array is fine to be used here.

Content.Shared/Traits/Prototypes/TraitPrototype.cs Outdated Show resolved Hide resolved
Resources/Prototypes/Traits/disabilities.yml Outdated Show resolved Hide resolved
Resources/Prototypes/Traits/inconveniences.yml Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Co-authored-by: DEATHB4DEFEAT <[email protected]>
Signed-off-by: VMSolidus <[email protected]>
Remuchi
Remuchi previously requested changes Nov 8, 2024
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
Content.Server/Traits/TraitSystem.Functions.cs Outdated Show resolved Hide resolved
[DataField]
public List<string>? RemoveFactions { get; private set; } = default!;
[DataField(serverOnly: true)]
public TraitFunction[] Functions { get; private set; } = Array.Empty<TraitFunction>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Both can be used. Since it's fixed length (you will not change it via VVEdit or in code) array is fine to be used here.

Resources/Prototypes/Traits/mental.yml Show resolved Hide resolved
Resources/Prototypes/Traits/skills.yml Outdated Show resolved Hide resolved
Resources/Prototypes/Traits/species.yml Outdated Show resolved Hide resolved
Resources/Prototypes/Traits/physical.yml Outdated Show resolved Hide resolved
@VMSolidus VMSolidus merged commit e7d40d1 into Simple-Station:master Nov 8, 2024
11 checks passed
sleepyyapril pushed a commit to sleepyyapril/Einstein-Engines that referenced this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: C# Changes any cs files Changes: YML Changes any yml files Priority: 2-High Needs to be resolved as soon as possible Size: 3-Medium For medium issues/PRs Status: Needs Review Someone please review this Type: Rework Large changes to a system, like a mix between the Balancing, Codebase, and Respace labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants