From 87a51f17a5624a55a6280a06fa6be2ef9d27817e Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 21:28:15 -0700 Subject: [PATCH 01/30] new trait prototype, fix trait locales --- .../Prototypes/TraitCategoryPrototype.cs | 14 +++++ .../Traits/Prototypes/TraitPrototype.cs | 39 +++++++++++++ Content.Shared/Traits/TraitPrototype.cs | 55 ------------------- .../Locale/en-US/deltav/traits/traits.ftl | 16 +++--- .../simplestation14/Traits/disabilities.ftl | 5 +- Resources/Locale/en-US/traits/traits.ftl | 47 ++++++++-------- .../Prototypes/DeltaV/Traits/altvision.yml | 4 -- .../Prototypes/DeltaV/Traits/neutral.yml | 5 +- .../SimpleStation14/Traits/disabilities.yml | 10 +--- Resources/Prototypes/Traits/disabilities.yml | 29 ++-------- .../Prototypes/Traits/inconveniences.yml | 4 -- Resources/Prototypes/Traits/neutral.yml | 4 -- 12 files changed, 96 insertions(+), 136 deletions(-) create mode 100644 Content.Shared/Traits/Prototypes/TraitCategoryPrototype.cs create mode 100644 Content.Shared/Traits/Prototypes/TraitPrototype.cs delete mode 100644 Content.Shared/Traits/TraitPrototype.cs diff --git a/Content.Shared/Traits/Prototypes/TraitCategoryPrototype.cs b/Content.Shared/Traits/Prototypes/TraitCategoryPrototype.cs new file mode 100644 index 00000000000..efbac1ca7d0 --- /dev/null +++ b/Content.Shared/Traits/Prototypes/TraitCategoryPrototype.cs @@ -0,0 +1,14 @@ +using Robust.Shared.Prototypes; + +namespace Content.Shared.Traits; + + +/// +/// A prototype defining a valid category for s to go into. +/// +[Prototype("traitCategory")] +public sealed partial class TraitCategoryPrototype : IPrototype +{ + [IdDataField] + public string ID { get; } = default!; +} diff --git a/Content.Shared/Traits/Prototypes/TraitPrototype.cs b/Content.Shared/Traits/Prototypes/TraitPrototype.cs new file mode 100644 index 00000000000..41f71a80de5 --- /dev/null +++ b/Content.Shared/Traits/Prototypes/TraitPrototype.cs @@ -0,0 +1,39 @@ +using Content.Shared.Customization.Systems; +using Content.Shared.Whitelist; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Traits; + + +/// +/// Describes a trait. +/// +[Prototype("trait")] +public sealed partial class TraitPrototype : IPrototype +{ + [ViewVariables] + [IdDataField] + public string ID { get; private set; } = default!; + + /// + /// Which customization tab to place this entry in + /// + [DataField(required: true), ValidatePrototypeId] + public string Category = "Unknown"; + + /// + /// How many points this will give the character + /// + [DataField] + public int Points = 0; + + + [DataField] + public List Requirements = new(); + + /// + /// The components that get added to the player when they pick this trait. + /// + [DataField(required: true)] + public ComponentRegistry Components { get; private set; } = default!; +} diff --git a/Content.Shared/Traits/TraitPrototype.cs b/Content.Shared/Traits/TraitPrototype.cs deleted file mode 100644 index 34feb8da22c..00000000000 --- a/Content.Shared/Traits/TraitPrototype.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Content.Shared.Whitelist; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; - -// don't worry about it - -namespace Content.Shared.Traits -{ - /// - /// Describes a trait. - /// - [Prototype("trait")] - public sealed partial class TraitPrototype : IPrototype - { - [ViewVariables] - [IdDataField] - public string ID { get; private set; } = default!; - - /// - /// The name of this trait. - /// - [DataField("name")] - public string Name { get; private set; } = ""; - - /// - /// The description of this trait. - /// - [DataField("description")] - public string? Description { get; private set; } - - /// - /// Don't apply this trait to entities this whitelist IS NOT valid for. - /// - [DataField("whitelist")] - public EntityWhitelist? Whitelist; - - /// - /// Don't apply this trait to entities this whitelist IS valid for. (hence, a blacklist) - /// - [DataField("blacklist")] - public EntityWhitelist? Blacklist; - - /// - /// The components that get added to the player, when they pick this trait. - /// - [DataField("components")] - public ComponentRegistry Components { get; private set; } = default!; - - /// - /// Gear that is given to the player, when they pick this trait. - /// - [DataField("traitGear", required: false, customTypeSerializer:typeof(PrototypeIdSerializer))] - public string? TraitGear; - } -} diff --git a/Resources/Locale/en-US/deltav/traits/traits.ftl b/Resources/Locale/en-US/deltav/traits/traits.ftl index e00cec47077..1f15a9401a0 100644 --- a/Resources/Locale/en-US/deltav/traits/traits.ftl +++ b/Resources/Locale/en-US/deltav/traits/traits.ftl @@ -1,13 +1,13 @@ -trait-scottish-accent-name = Scottish Accent -trait-scottish-accent-desc = Fer tha folk who come frae Hielan clan. +trait-ScottishAccent-name = Scottish Accent +trait-ScottishAccent-desc = Fer tha folk who come frae Hielan clan. -trait-ultravision-name = Ultraviolet Vision -trait-ultravision-desc = Whether through custom bionic eyes, random mutation, +trait-UltraVision-name = Ultraviolet Vision +trait-UltraVision-desc = Whether through custom bionic eyes, random mutation, or being a Harpy, you perceive the world with ultraviolet light. -trait-deuteranopia-name = Deuteranopia -trait-deuteranopia-desc = Whether through custom bionic eyes, random mutation, +trait-DogVision-name = Deuteranopia +trait-DogVision-desc = Whether through custom bionic eyes, random mutation, or being a Vulpkanin, you have red–green colour blindness. -trait-uncloneable-name = Uncloneable -trait-uncloneable-desc = Cannot be cloned +trait-Uncloneable-name = Uncloneable +trait-Uncloneable-desc = Cannot be cloned diff --git a/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl b/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl index 3d8af061392..30d0f2f5d68 100644 --- a/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl +++ b/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl @@ -1,3 +1,2 @@ -trait-nearsighted-name = Nearsighted -trait-nearsighted-desc = You require glasses to see properly. -trait-nearsighted-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are pretty unfocused. It doesn't seem like {SUBJECT($target)} can see things that well.[/color] +trait-Nearsighted-name = Nearsighted +trait-Nearsighted-desc = You require glasses to see properly. diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 7a3564edf66..1509c425220 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -1,34 +1,33 @@ -trait-blindness-name = Blindness -trait-blindness-desc = You are legally blind, and can't see clearly past a few meters in front of you. +trait-Blindness-name = Blindness +trait-Blindness-desc = You are legally blind, and can't see clearly past a few meters in front of you. +trait-Blindness-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are glassy and unfocused. It doesn't seem like {SUBJECT($target)} can see you well, if at all.[/color] -trait-narcolepsy-name = Narcolepsy -trait-narcolepsy-desc = You fall asleep randomly +trait-Narcolepsy-name = Narcolepsy +trait-Narcolepsy-desc = You fall asleep randomly -trait-pacifist-name = Pacifist -trait-pacifist-desc = You cannot attack or hurt any living beings. +trait-Pacifist-name = Pacifist +trait-Pacifist-desc = You cannot attack or hurt any living beings. -permanent-blindness-trait-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are glassy and unfocused. It doesn't seem like {SUBJECT($target)} can see you well, if at all.[/color] +trait-LightweightDrunk-name = Lightweight Drunk +trait-LightweightDrunk-desc = Alcohol has a stronger effect on you -trait-lightweight-name = Lightweight Drunk -trait-lightweight-desc = Alcohol has a stronger effect on you +trait-Muted-name = Muted +trait-Muted-desc = You can't speak -trait-muted-name = Muted -trait-muted-desc = You can't speak +trait-Paracusia-name = Paracusia +trait-Paracusia-desc = You hear sounds that aren't really there -trait-paracusia-name = Paracusia -trait-paracusia-desc = You hear sounds that aren't really there +trait-PirateAccent-name = Pirate Accent +trait-PirateAccent-desc = You can't stop speaking like a pirate! -trait-pirate-accent-name = Pirate Accent -trait-pirate-accent-desc = You can't stop speaking like a pirate! +trait-Accentless-name = Accentless +trait-Accentless-desc = You don't have the accent that your species would usually have -trait-accentless-name = Accentless -trait-accentless-desc = You don't have the accent that your species would usually have +trait-FrontalLisp-name = Frontal Lisp +trait-FrontalLisp-desc = You thpeak with a lithp -trait-frontal-lisp-name = Frontal Lisp -trait-frontal-lisp-desc = You thpeak with a lithp +trait-SocialAnxiety-name = Social Anxiety +trait-SocialAnxiety-desc = You are anxious when you speak and stutter. -trait-socialanxiety-name = Social Anxiety -trait-socialanxiety-desc = You are anxious when you speak and stutter. - -trait-snoring-name = Snoring -trait-snoring-desc = You will snore while sleeping. +trait-Snoring-name = Snoring +trait-Snoring-desc = You will snore while sleeping. diff --git a/Resources/Prototypes/DeltaV/Traits/altvision.yml b/Resources/Prototypes/DeltaV/Traits/altvision.yml index c361d1b51d8..31c377cda00 100644 --- a/Resources/Prototypes/DeltaV/Traits/altvision.yml +++ b/Resources/Prototypes/DeltaV/Traits/altvision.yml @@ -1,13 +1,9 @@ - type: trait id: UltraVision - name: trait-ultravision-name - description: trait-ultravision-desc components: - type: UltraVision - type: trait id: DogVision - name: trait-deuteranopia-name - description: trait-deuteranopia-desc components: - type: DogVision diff --git a/Resources/Prototypes/DeltaV/Traits/neutral.yml b/Resources/Prototypes/DeltaV/Traits/neutral.yml index 79a6771a362..2609199aed1 100644 --- a/Resources/Prototypes/DeltaV/Traits/neutral.yml +++ b/Resources/Prototypes/DeltaV/Traits/neutral.yml @@ -1,7 +1,4 @@ - type: trait id: ScottishAccent - name: trait-scottish-accent-name - description: trait-scottish-accent-desc - traitGear: BagpipeInstrument components: - - type: ScottishAccent \ No newline at end of file + - type: ScottishAccent diff --git a/Resources/Prototypes/SimpleStation14/Traits/disabilities.yml b/Resources/Prototypes/SimpleStation14/Traits/disabilities.yml index 25aa23a5afc..fd0cb8f4fa2 100644 --- a/Resources/Prototypes/SimpleStation14/Traits/disabilities.yml +++ b/Resources/Prototypes/SimpleStation14/Traits/disabilities.yml @@ -1,11 +1,7 @@ - type: trait id: Nearsighted - name: trait-nearsighted-name - description: You require glasses to see properly. - traitGear: ClothingEyesGlasses components: - type: Nearsighted - whitelist: # Delta V fix to borgs spawning with it. - components: - - Blindable - + # whitelist: + # components: + # - Blindable diff --git a/Resources/Prototypes/Traits/disabilities.yml b/Resources/Prototypes/Traits/disabilities.yml index 2f1a7f92d26..763286a8c4f 100644 --- a/Resources/Prototypes/Traits/disabilities.yml +++ b/Resources/Prototypes/Traits/disabilities.yml @@ -1,18 +1,13 @@ - type: trait id: Blindness - name: trait-blindness-name - description: trait-blindness-desc - traitGear: WhiteCane - whitelist: - components: - - Blindable + # whitelist: + # components: + # - Blindable components: - type: PermanentBlindness - type: trait id: Narcolepsy - name: trait-narcolepsy-name - description: trait-narcolepsy-desc components: - type: Narcolepsy timeBetweenIncidents: 300, 600 @@ -20,15 +15,11 @@ - type: trait id: Pacifist - name: trait-pacifist-name - description: trait-pacifist-desc components: - type: Pacified - type: trait id: Paracusia - name: trait-paracusia-name - description: trait-paracusia-desc components: - type: Paracusia minTimeBetweenIncidents: 0.1 @@ -39,31 +30,23 @@ - type: trait id: Muted - name: trait-muted-name - description: trait-muted-desc - blacklist: - components: - - BorgChassis + # blacklist: + # components: + # - BorgChassis components: - type: Muted - type: trait id: Uncloneable - name: trait-uncloneable-name - description: trait-uncloneable-desc components: - type: Uncloneable - type: trait id: FrontalLisp - name: trait-frontal-lisp-name - description: trait-frontal-lisp-desc components: - type: FrontalLisp - type: trait id: Snoring - name: trait-snoring-name - description: trait-snoring-desc components: - type: Snoring diff --git a/Resources/Prototypes/Traits/inconveniences.yml b/Resources/Prototypes/Traits/inconveniences.yml index 657781d1b59..3d373457c85 100644 --- a/Resources/Prototypes/Traits/inconveniences.yml +++ b/Resources/Prototypes/Traits/inconveniences.yml @@ -1,15 +1,11 @@ - type: trait id: LightweightDrunk - name: trait-lightweight-name - description: trait-lightweight-desc components: - type: LightweightDrunk boozeStrengthMultiplier: 2 - type: trait id: SocialAnxiety - name: trait-socialanxiety-name - description: trait-socialanxiety-desc components: - type: StutteringAccent matchRandomProb: 0.1 diff --git a/Resources/Prototypes/Traits/neutral.yml b/Resources/Prototypes/Traits/neutral.yml index 9e7f7655076..3bcf6f60c28 100644 --- a/Resources/Prototypes/Traits/neutral.yml +++ b/Resources/Prototypes/Traits/neutral.yml @@ -1,14 +1,10 @@ - type: trait id: PirateAccent - name: trait-pirate-accent-name - description: trait-pirate-accent-desc components: - type: PirateAccent - type: trait id: Accentless - name: trait-accentless-name - description: trait-accentless-desc components: - type: Accentless removes: From 0dc3c8d1e233837fb0456c332e2af51005656fb0 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 21:29:49 -0700 Subject: [PATCH 02/30] reorganize trait systems --- Content.Client/Traits/ParacusiaSystem.cs | 3 +- Content.Server/Flash/FlashSystem.cs | 2 +- .../Events/MassHallucinationsRule.cs | 2 +- .../Traits/Assorted/ParacusiaSystem.cs | 2 + .../Zombies/ZombieSystem.Transform.cs | 2 +- Content.Shared/Drunk/DrunkSystem.cs | 2 +- .../{ => Components}/AccentlessComponent.cs | 2 +- .../LegsParalyzedComponent.cs | 5 +- .../LightweightDrunkComponent.cs | 4 +- .../{ => Components}/ParacusiaComponent.cs | 3 +- .../PermanentBlindnessComponent.cs | 2 +- .../Traits/Assorted/LegsParalyzedSystem.cs | 58 ------------------- .../{ => Systems}/AccentlessSystem.cs | 8 +-- .../Assorted/Systems/LegsParalyzedSystem.cs | 58 +++++++++++++++++++ .../{ => Systems}/PermanentBlindnessSystem.cs | 20 +++---- .../{ => Systems}/SharedParacusiaSystem.cs | 2 +- 16 files changed, 89 insertions(+), 86 deletions(-) rename Content.Shared/Traits/Assorted/{ => Components}/AccentlessComponent.cs (89%) rename Content.Shared/Traits/Assorted/{ => Components}/LegsParalyzedComponent.cs (65%) rename Content.Shared/Traits/Assorted/{ => Components}/LightweightDrunkComponent.cs (90%) rename Content.Shared/Traits/Assorted/{ => Components}/ParacusiaComponent.cs (93%) rename Content.Shared/Traits/Assorted/{ => Components}/PermanentBlindnessComponent.cs (81%) delete mode 100644 Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs rename Content.Shared/Traits/Assorted/{ => Systems}/AccentlessSystem.cs (62%) create mode 100644 Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs rename Content.Shared/Traits/Assorted/{ => Systems}/PermanentBlindnessSystem.cs (59%) rename Content.Shared/Traits/Assorted/{ => Systems}/SharedParacusiaSystem.cs (56%) diff --git a/Content.Client/Traits/ParacusiaSystem.cs b/Content.Client/Traits/ParacusiaSystem.cs index 3789f24cb0d..d01c7c0005c 100644 --- a/Content.Client/Traits/ParacusiaSystem.cs +++ b/Content.Client/Traits/ParacusiaSystem.cs @@ -1,11 +1,12 @@ using System.Numerics; -using Content.Shared.Traits.Assorted; +using Content.Shared.Traits.Assorted.Systems; using Robust.Shared.Random; using Robust.Client.Player; using Robust.Shared.Player; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; +using Content.Shared.Traits.Assorted.Components; namespace Content.Client.Traits; diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index fe7eb81d1e1..013ee37a416 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -14,13 +14,13 @@ using Content.Shared.Inventory; using Content.Shared.Physics; using Content.Shared.Tag; -using Content.Shared.Traits.Assorted; using Content.Shared.Weapons.Melee.Events; using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Timing; using InventoryComponent = Content.Shared.Inventory.InventoryComponent; +using Content.Shared.Traits.Assorted.Components; namespace Content.Server.Flash { diff --git a/Content.Server/StationEvents/Events/MassHallucinationsRule.cs b/Content.Server/StationEvents/Events/MassHallucinationsRule.cs index 722a489541f..4fc158f8646 100644 --- a/Content.Server/StationEvents/Events/MassHallucinationsRule.cs +++ b/Content.Server/StationEvents/Events/MassHallucinationsRule.cs @@ -2,7 +2,7 @@ using Content.Server.StationEvents.Components; using Content.Server.Traits.Assorted; using Content.Shared.Mind.Components; -using Content.Shared.Traits.Assorted; +using Content.Shared.Traits.Assorted.Components; namespace Content.Server.StationEvents.Events; diff --git a/Content.Server/Traits/Assorted/ParacusiaSystem.cs b/Content.Server/Traits/Assorted/ParacusiaSystem.cs index 4b0205ff536..cf08e09e90e 100644 --- a/Content.Server/Traits/Assorted/ParacusiaSystem.cs +++ b/Content.Server/Traits/Assorted/ParacusiaSystem.cs @@ -1,5 +1,7 @@ using Content.Shared.Traits.Assorted; +using Content.Shared.Traits.Assorted.Systems; using Robust.Shared.Audio; +using Content.Shared.Traits.Assorted.Components; namespace Content.Server.Traits.Assorted; diff --git a/Content.Server/Zombies/ZombieSystem.Transform.cs b/Content.Server/Zombies/ZombieSystem.Transform.cs index daadd4b518b..996d7772239 100644 --- a/Content.Server/Zombies/ZombieSystem.Transform.cs +++ b/Content.Server/Zombies/ZombieSystem.Transform.cs @@ -35,8 +35,8 @@ using Content.Shared.Weapons.Melee; using Content.Shared.Zombies; using Content.Shared.Prying.Components; -using Content.Shared.Traits.Assorted; using Robust.Shared.Audio.Systems; +using Content.Shared.Traits.Assorted.Components; namespace Content.Server.Zombies { diff --git a/Content.Shared/Drunk/DrunkSystem.cs b/Content.Shared/Drunk/DrunkSystem.cs index 4f9429b6a6b..161d4729ede 100644 --- a/Content.Shared/Drunk/DrunkSystem.cs +++ b/Content.Shared/Drunk/DrunkSystem.cs @@ -1,6 +1,6 @@ using Content.Shared.Speech.EntitySystems; using Content.Shared.StatusEffect; -using Content.Shared.Traits.Assorted; +using Content.Shared.Traits.Assorted.Components; namespace Content.Shared.Drunk; diff --git a/Content.Shared/Traits/Assorted/AccentlessComponent.cs b/Content.Shared/Traits/Assorted/Components/AccentlessComponent.cs similarity index 89% rename from Content.Shared/Traits/Assorted/AccentlessComponent.cs rename to Content.Shared/Traits/Assorted/Components/AccentlessComponent.cs index 96ebf4d83f6..084a1e1d925 100644 --- a/Content.Shared/Traits/Assorted/AccentlessComponent.cs +++ b/Content.Shared/Traits/Assorted/Components/AccentlessComponent.cs @@ -1,7 +1,7 @@ using Robust.Shared.GameStates; using Robust.Shared.Prototypes; -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Components; /// /// This is used for the accentless trait diff --git a/Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs b/Content.Shared/Traits/Assorted/Components/LegsParalyzedComponent.cs similarity index 65% rename from Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs rename to Content.Shared/Traits/Assorted/Components/LegsParalyzedComponent.cs index 59f9ca758bc..d0639e59339 100644 --- a/Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs +++ b/Content.Shared/Traits/Assorted/Components/LegsParalyzedComponent.cs @@ -1,6 +1,7 @@ -using Robust.Shared.GameStates; +using Content.Shared.Traits.Assorted.Systems; +using Robust.Shared.GameStates; -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Components; /// /// Set player speed to zero and standing state to down, simulating leg paralysis. diff --git a/Content.Shared/Traits/Assorted/LightweightDrunkComponent.cs b/Content.Shared/Traits/Assorted/Components/LightweightDrunkComponent.cs similarity index 90% rename from Content.Shared/Traits/Assorted/LightweightDrunkComponent.cs rename to Content.Shared/Traits/Assorted/Components/LightweightDrunkComponent.cs index 5d353ac9637..62d2f5899a4 100644 --- a/Content.Shared/Traits/Assorted/LightweightDrunkComponent.cs +++ b/Content.Shared/Traits/Assorted/Components/LightweightDrunkComponent.cs @@ -1,7 +1,7 @@ -using Robust.Shared.GameStates; using Content.Shared.Drunk; +using Robust.Shared.GameStates; -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Components; /// /// Used for the lightweight trait. DrunkSystem will check for this component and modify the boozePower accordingly if it finds it. diff --git a/Content.Shared/Traits/Assorted/ParacusiaComponent.cs b/Content.Shared/Traits/Assorted/Components/ParacusiaComponent.cs similarity index 93% rename from Content.Shared/Traits/Assorted/ParacusiaComponent.cs rename to Content.Shared/Traits/Assorted/Components/ParacusiaComponent.cs index 1db698359bd..ff62e55c2aa 100644 --- a/Content.Shared/Traits/Assorted/ParacusiaComponent.cs +++ b/Content.Shared/Traits/Assorted/Components/ParacusiaComponent.cs @@ -1,8 +1,9 @@ +using Content.Shared.Traits.Assorted.Systems; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Components; /// /// This component is used for paracusia, which causes auditory hallucinations. diff --git a/Content.Shared/Traits/Assorted/PermanentBlindnessComponent.cs b/Content.Shared/Traits/Assorted/Components/PermanentBlindnessComponent.cs similarity index 81% rename from Content.Shared/Traits/Assorted/PermanentBlindnessComponent.cs rename to Content.Shared/Traits/Assorted/Components/PermanentBlindnessComponent.cs index 76ff3e1005e..c1bf7e1639e 100644 --- a/Content.Shared/Traits/Assorted/PermanentBlindnessComponent.cs +++ b/Content.Shared/Traits/Assorted/Components/PermanentBlindnessComponent.cs @@ -1,6 +1,6 @@ using Robust.Shared.GameStates; -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Components; /// /// This is used for making something blind forever. diff --git a/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs b/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs deleted file mode 100644 index 7c91366937c..00000000000 --- a/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Content.Shared.Body.Systems; -using Content.Shared.Buckle.Components; -using Content.Shared.Movement.Events; -using Content.Shared.Movement.Systems; -using Content.Shared.Standing; -using Content.Shared.Throwing; - -namespace Content.Shared.Traits.Assorted; - -public sealed class LegsParalyzedSystem : EntitySystem -{ - [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!; - [Dependency] private readonly StandingStateSystem _standingSystem = default!; - [Dependency] private readonly SharedBodySystem _bodySystem = default!; - - public override void Initialize() - { - SubscribeLocalEvent(OnStartup); - SubscribeLocalEvent(OnShutdown); - SubscribeLocalEvent(OnBuckleChange); - SubscribeLocalEvent(OnThrowPushbackAttempt); - SubscribeLocalEvent(OnUpdateCanMoveEvent); - } - - private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args) - { - // TODO: In future probably must be surgery related wound - _movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20); - } - - private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args) - { - _standingSystem.Stand(uid); - _bodySystem.UpdateMovementSpeed(uid); - } - - private void OnBuckleChange(EntityUid uid, LegsParalyzedComponent component, ref BuckleChangeEvent args) - { - if (args.Buckling) - { - _standingSystem.Stand(args.BuckledEntity); - } - else - { - _standingSystem.Down(args.BuckledEntity); - } - } - - private void OnUpdateCanMoveEvent(EntityUid uid, LegsParalyzedComponent component, UpdateCanMoveEvent args) - { - args.Cancel(); - } - - private void OnThrowPushbackAttempt(EntityUid uid, LegsParalyzedComponent component, ThrowPushbackAttemptEvent args) - { - args.Cancel(); - } -} diff --git a/Content.Shared/Traits/Assorted/AccentlessSystem.cs b/Content.Shared/Traits/Assorted/Systems/AccentlessSystem.cs similarity index 62% rename from Content.Shared/Traits/Assorted/AccentlessSystem.cs rename to Content.Shared/Traits/Assorted/Systems/AccentlessSystem.cs index 2242bc6e52b..f4e077bc1af 100644 --- a/Content.Shared/Traits/Assorted/AccentlessSystem.cs +++ b/Content.Shared/Traits/Assorted/Systems/AccentlessSystem.cs @@ -1,6 +1,4 @@ -using Robust.Shared.Serialization.Manager; - -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Systems; /// /// This handles removing accents when using the accentless trait. @@ -12,10 +10,10 @@ public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(RemoveAccents); + SubscribeLocalEvent(RemoveAccents); } - private void RemoveAccents(EntityUid uid, AccentlessComponent component, ComponentStartup args) + private void RemoveAccents(EntityUid uid, Components.AccentlessComponent component, ComponentStartup args) { foreach (var accent in component.RemovedAccents.Values) { diff --git a/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs b/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs new file mode 100644 index 00000000000..8ae0f251b86 --- /dev/null +++ b/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs @@ -0,0 +1,58 @@ +using Content.Shared.Body.Systems; +using Content.Shared.Buckle.Components; +using Content.Shared.Movement.Events; +using Content.Shared.Movement.Systems; +using Content.Shared.Standing; +using Content.Shared.Throwing; + +namespace Content.Shared.Traits.Assorted.Systems; + +public sealed class LegsParalyzedSystem : EntitySystem +{ + [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!; + [Dependency] private readonly StandingStateSystem _standingSystem = default!; + [Dependency] private readonly SharedBodySystem _bodySystem = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnBuckleChange); + SubscribeLocalEvent(OnThrowPushbackAttempt); + SubscribeLocalEvent(OnUpdateCanMoveEvent); + } + + private void OnStartup(EntityUid uid, Components.LegsParalyzedComponent component, ComponentStartup args) + { + // TODO: In future probably must be surgery related wound + _movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20); + } + + private void OnShutdown(EntityUid uid, Components.LegsParalyzedComponent component, ComponentShutdown args) + { + _standingSystem.Stand(uid); + _bodySystem.UpdateMovementSpeed(uid); + } + + private void OnBuckleChange(EntityUid uid, Components.LegsParalyzedComponent component, ref BuckleChangeEvent args) + { + if (args.Buckling) + { + _standingSystem.Stand(args.BuckledEntity); + } + else + { + _standingSystem.Down(args.BuckledEntity); + } + } + + private void OnUpdateCanMoveEvent(EntityUid uid, Components.LegsParalyzedComponent component, UpdateCanMoveEvent args) + { + args.Cancel(); + } + + private void OnThrowPushbackAttempt(EntityUid uid, Components.LegsParalyzedComponent component, ThrowPushbackAttemptEvent args) + { + args.Cancel(); + } +} diff --git a/Content.Shared/Traits/Assorted/PermanentBlindnessSystem.cs b/Content.Shared/Traits/Assorted/Systems/PermanentBlindnessSystem.cs similarity index 59% rename from Content.Shared/Traits/Assorted/PermanentBlindnessSystem.cs rename to Content.Shared/Traits/Assorted/Systems/PermanentBlindnessSystem.cs index 9fd5db84972..f2620281fcd 100644 --- a/Content.Shared/Traits/Assorted/PermanentBlindnessSystem.cs +++ b/Content.Shared/Traits/Assorted/Systems/PermanentBlindnessSystem.cs @@ -4,7 +4,7 @@ using Content.Shared.IdentityManagement; using Robust.Shared.Network; -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Systems; /// /// This handles permanent blindness, both the examine and the actual effect. @@ -18,26 +18,26 @@ public sealed class PermanentBlindnessSystem : EntitySystem /// public override void Initialize() { - SubscribeLocalEvent(OnStartup); - SubscribeLocalEvent(OnShutdown); - SubscribeLocalEvent(OnDamageChanged); - SubscribeLocalEvent(OnExamined); + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnDamageChanged); + SubscribeLocalEvent(OnExamined); } - private void OnExamined(Entity blindness, ref ExaminedEvent args) + private void OnExamined(Entity blindness, ref ExaminedEvent args) { if (args.IsInDetailsRange && !_net.IsClient) { - args.PushMarkup(Loc.GetString("permanent-blindness-trait-examined", ("target", Identity.Entity(blindness, EntityManager)))); + args.PushMarkup(Loc.GetString("trait-Blindness-examined", ("target", Identity.Entity(blindness, EntityManager)))); } } - private void OnShutdown(Entity blindness, ref ComponentShutdown args) + private void OnShutdown(Entity blindness, ref ComponentShutdown args) { _blinding.UpdateIsBlind(blindness.Owner); } - private void OnStartup(Entity blindness, ref ComponentStartup args) + private void OnStartup(Entity blindness, ref ComponentStartup args) { if (!_entityManager.TryGetComponent(blindness, out var blindable)) return; @@ -50,7 +50,7 @@ private void OnStartup(Entity blindness, ref Compon _blinding.AdjustEyeDamage(blindness.Owner, damageToDeal); } - private void OnDamageChanged(Entity blindness, ref EyeDamageChangedEvent args) + private void OnDamageChanged(Entity blindness, ref EyeDamageChangedEvent args) { if (args.Damage >= BlurryVisionComponent.MaxMagnitude) return; diff --git a/Content.Shared/Traits/Assorted/SharedParacusiaSystem.cs b/Content.Shared/Traits/Assorted/Systems/SharedParacusiaSystem.cs similarity index 56% rename from Content.Shared/Traits/Assorted/SharedParacusiaSystem.cs rename to Content.Shared/Traits/Assorted/Systems/SharedParacusiaSystem.cs index 2bfb0da1f54..151e748445f 100644 --- a/Content.Shared/Traits/Assorted/SharedParacusiaSystem.cs +++ b/Content.Shared/Traits/Assorted/Systems/SharedParacusiaSystem.cs @@ -1,4 +1,4 @@ -namespace Content.Shared.Traits.Assorted; +namespace Content.Shared.Traits.Assorted.Systems; public abstract class SharedParacusiaSystem : EntitySystem { From 2f36caea57da4b2d663cefb6de8de6f04583d34d Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 21:31:13 -0700 Subject: [PATCH 03/30] totally relevant loadout prototype changes --- .../Loadouts/Prototypes/LoadoutCategoryPrototype.cs | 1 + .../Clothing/Loadouts/Prototypes/LoadoutPrototype.cs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutCategoryPrototype.cs b/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutCategoryPrototype.cs index 5dd880d3f1b..445cbc10e6d 100644 --- a/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutCategoryPrototype.cs +++ b/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutCategoryPrototype.cs @@ -2,6 +2,7 @@ namespace Content.Shared.Clothing.Loadouts.Prototypes; + /// /// A prototype defining a valid category for s to go into. /// diff --git a/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutPrototype.cs b/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutPrototype.cs index bc31fc15701..9ca575fa72e 100644 --- a/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutPrototype.cs +++ b/Content.Shared/Clothing/Loadouts/Prototypes/LoadoutPrototype.cs @@ -1,10 +1,12 @@ using Content.Shared.Clothing.Loadouts.Systems; +using Content.Shared.Customization.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; namespace Content.Shared.Clothing.Loadouts.Prototypes; + [Prototype("loadout")] public sealed class LoadoutPrototype : IPrototype { @@ -17,7 +19,7 @@ public sealed class LoadoutPrototype : IPrototype /// /// Which tab category to put this under /// - [DataField(customTypeSerializer:typeof(PrototypeIdSerializer))] + [DataField, ValidatePrototypeId] public string Category = "Uncategorized"; /// @@ -41,5 +43,5 @@ public sealed class LoadoutPrototype : IPrototype [DataField] - public List Requirements = new(); + public List Requirements = new(); } From 9ba13a5fd1a86c59f4837f77a388bbeed798dc17 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 21:32:03 -0700 Subject: [PATCH 04/30] CharacterRequirements system I told you those loadout prototype changes were relevant --- .../Loadouts/Systems/LoadoutSystem.cs | 40 +----- .../Systems/CharacterRequirements.cs} | 119 ++++++++++-------- .../Systems/CharacterRequirementsSystem.cs | 43 +++++++ 3 files changed, 114 insertions(+), 88 deletions(-) rename Content.Shared/{Clothing/Loadouts/Systems/LoadoutRequirements.cs => Customization/Systems/CharacterRequirements.cs} (62%) create mode 100644 Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs diff --git a/Content.Shared/Clothing/Loadouts/Systems/LoadoutSystem.cs b/Content.Shared/Clothing/Loadouts/Systems/LoadoutSystem.cs index eb9a5dcbc8c..09e3db3793f 100644 --- a/Content.Shared/Clothing/Loadouts/Systems/LoadoutSystem.cs +++ b/Content.Shared/Clothing/Loadouts/Systems/LoadoutSystem.cs @@ -1,5 +1,6 @@ using Content.Shared.Clothing.Components; using Content.Shared.Clothing.Loadouts.Prototypes; +using Content.Shared.Customization.Systems; using Content.Shared.Inventory; using Content.Shared.Preferences; using Content.Shared.Roles; @@ -17,7 +18,8 @@ public sealed class LoadoutSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly InventorySystem _inventory = default!; - [Dependency] private readonly IConfigurationManager _configurationManager = default!; + [Dependency] private readonly IConfigurationManager _configuration = default!; + [Dependency] private readonly CharacterRequirementsSystem _characterRequirements = default!; public override void Initialize() { @@ -66,8 +68,9 @@ public List ApplyCharacterLoadout(EntityUid uid, JobPrototype job, Hu continue; - if (!CheckRequirementsValid(loadoutProto.Requirements, job, profile, - playTimes ?? new Dictionary(), EntityManager, _prototype, _configurationManager, + if (!_characterRequirements.CheckRequirementsValid(loadoutProto, loadoutProto.Requirements, job, profile, + playTimes ?? new Dictionary(), + EntityManager, _prototype, _configuration, out _)) continue; @@ -115,35 +118,4 @@ public List ApplyCharacterLoadout(EntityUid uid, JobPrototype job, Hu // The server has more information about the inventory system than the client does and the client doesn't need to put loadouts in backpacks return failedLoadouts; } - - - public bool CheckRequirementsValid(List requirements, JobPrototype job, - HumanoidCharacterProfile profile, Dictionary playTimes, IEntityManager entityManager, - IPrototypeManager prototypeManager, IConfigurationManager configManager, out List reasons) - { - reasons = new List(); - var valid = true; - - foreach (var requirement in requirements) - { - // Set valid to false if the requirement is invalid and not inverted, if it's inverted set it to true when it's valid - if (!requirement.IsValid(job, profile, playTimes, entityManager, prototypeManager, configManager, out var reason)) - { - if (valid) - valid = requirement.Inverted; - } - else - { - if (valid) - valid = !requirement.Inverted; - } - - if (reason != null) - { - reasons.Add(reason); - } - } - - return valid; - } } diff --git a/Content.Shared/Clothing/Loadouts/Systems/LoadoutRequirements.cs b/Content.Shared/Customization/Systems/CharacterRequirements.cs similarity index 62% rename from Content.Shared/Clothing/Loadouts/Systems/LoadoutRequirements.cs rename to Content.Shared/Customization/Systems/CharacterRequirements.cs index b76a31e422b..3758f3d8fd8 100644 --- a/Content.Shared/Clothing/Loadouts/Systems/LoadoutRequirements.cs +++ b/Content.Shared/Customization/Systems/CharacterRequirements.cs @@ -12,23 +12,25 @@ using Robust.Shared.Serialization; using Robust.Shared.Utility; -namespace Content.Shared.Clothing.Loadouts.Systems; +namespace Content.Shared.Customization.Systems; + [ImplicitDataDefinitionForInheritors, MeansImplicitUse] [Serializable, NetSerializable] -public abstract partial class LoadoutRequirement +public abstract partial class CharacterRequirement { /// /// If true valid requirements will be treated as invalid and vice versa /// [DataField] - public bool Inverted = false; + public bool Inverted; /// - /// Checks if this loadout requirement is valid for the given parameters + /// Checks if this character requirement is valid for the given parameters /// /// Description for the requirement, shown when not null public abstract bool IsValid( + IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, Dictionary playTimes, @@ -47,7 +49,7 @@ out FormattedMessage? reason /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutAgeRequirement : LoadoutRequirement +public sealed partial class CharacterAgeRequirement : CharacterRequirement { [DataField(required: true)] public int Min; @@ -55,11 +57,12 @@ public sealed partial class LoadoutAgeRequirement : LoadoutRequirement [DataField(required: true)] public int Max; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { - reason = FormattedMessage.FromMarkup(Loc.GetString("loadout-age-requirement", + reason = FormattedMessage.FromMarkup(Loc.GetString("character-age-requirement", ("min", Min), ("max", Max))); return profile.Age >= Min && profile.Age <= Max; } @@ -70,16 +73,17 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutBackpackTypeRequirement : LoadoutRequirement +public sealed partial class CharacterBackpackTypeRequirement : CharacterRequirement { [DataField(required: true)] public BackpackPreference Preference; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { - reason = FormattedMessage.FromMarkup(Loc.GetString("loadout-backpack-type-requirement", + reason = FormattedMessage.FromMarkup(Loc.GetString("character-backpack-type-requirement", ("type", Loc.GetString($"humanoid-profile-editor-preference-{Preference.ToString().ToLower()}")))); return profile.Backpack == Preference; } @@ -90,16 +94,17 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutClothingPreferenceRequirement : LoadoutRequirement +public sealed partial class CharacterClothingPreferenceRequirement : CharacterRequirement { [DataField(required: true)] public ClothingPreference Preference; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { - reason = FormattedMessage.FromMarkup(Loc.GetString("loadout-clothing-preference-requirement", + reason = FormattedMessage.FromMarkup(Loc.GetString("character-clothing-preference-requirement", ("preference", Loc.GetString($"humanoid-profile-editor-preference-{Preference.ToString().ToLower()}")))); return profile.Clothing == Preference; } @@ -110,16 +115,17 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutSpeciesRequirement : LoadoutRequirement +public sealed partial class CharacterSpeciesRequirement : CharacterRequirement { [DataField(required: true)] public ProtoId Species; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { - reason = FormattedMessage.FromMarkup(Loc.GetString("loadout-species-requirement", + reason = FormattedMessage.FromMarkup(Loc.GetString("character-species-requirement", ("species", Loc.GetString($"species-name-{Species.ToString().ToLower()}")))); return profile.Species == Species; } @@ -130,16 +136,17 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutTraitRequirement : LoadoutRequirement +public sealed partial class CharacterTraitRequirement : CharacterRequirement { [DataField(required: true)] public ProtoId Trait; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { - reason = FormattedMessage.FromMarkup(Loc.GetString("loadout-trait-requirement", + reason = FormattedMessage.FromMarkup(Loc.GetString("character-trait-requirement", ("trait", Loc.GetString($"trait-{Trait.ToString().ToLower()}-name")))); return profile.TraitPreferences.Contains(Trait.ToString()); } @@ -154,19 +161,20 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutJobRequirement : LoadoutRequirement +public sealed partial class CharacterJobRequirement : CharacterRequirement { [DataField(required: true)] public List> Jobs; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { // Join localized job names with a comma var jobsString = string.Join(", ", Jobs.Select(j => Loc.GetString(prototypeManager.Index(j).Name))); // Form the reason message - jobsString = Loc.GetString("loadout-job-requirement", ("job", jobsString)); + jobsString = Loc.GetString("character-job-requirement", ("job", jobsString)); reason = FormattedMessage.FromMarkup(jobsString); return Jobs.Contains(job.ID); @@ -178,7 +186,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutDepartmentTimeRequirement : LoadoutRequirement +public sealed partial class CharacterDepartmentTimeRequirement : CharacterRequirement { [DataField] public TimeSpan Min = TimeSpan.MinValue; @@ -189,9 +197,10 @@ public sealed partial class LoadoutDepartmentTimeRequirement : LoadoutRequiremen [DataField(required: true)] public ProtoId Department; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { // Disable the requirement if the role timers are disabled if (!configManager.GetCVar(CCVars.GameRoleTimers)) @@ -217,7 +226,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Show the reason if invalid reason = Inverted ? null - : FormattedMessage.FromMarkup(Loc.GetString("loadout-timer-department-too-high", + : FormattedMessage.FromMarkup(Loc.GetString("character-timer-department-too-high", ("time", playtime.Minutes - Max.Minutes), ("department", Loc.GetString($"department-{department.ID}")), ("departmentColor", department.Color))); @@ -229,7 +238,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Show the reason if invalid reason = Inverted ? null - : FormattedMessage.FromMarkup(Loc.GetString("loadout-timer-department-insufficient", + : FormattedMessage.FromMarkup(Loc.GetString("character-timer-department-insufficient", ("time", Min.Minutes - playtime.Minutes), ("department", Loc.GetString($"department-{department.ID}")), ("departmentColor", department.Color))); @@ -246,7 +255,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutOverallTimeRequirement : LoadoutRequirement +public sealed partial class CharacterOverallTimeRequirement : CharacterRequirement { [DataField] public TimeSpan Min = TimeSpan.MinValue; @@ -254,9 +263,10 @@ public sealed partial class LoadoutOverallTimeRequirement : LoadoutRequirement [DataField] public TimeSpan Max = TimeSpan.MaxValue; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { // Disable the requirement if the role timers are disabled if (!configManager.GetCVar(CCVars.GameRoleTimers)) @@ -273,7 +283,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Show the reason if invalid reason = Inverted ? null - : FormattedMessage.FromMarkup(Loc.GetString("loadout-timer-overall-too-high", + : FormattedMessage.FromMarkup(Loc.GetString("character-timer-overall-too-high", ("time", overallTime.Minutes - Max.Minutes))); return false; } @@ -283,7 +293,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Show the reason if invalid reason = Inverted ? null - : FormattedMessage.FromMarkup(Loc.GetString("loadout-timer-overall-insufficient", + : FormattedMessage.FromMarkup(Loc.GetString("character-timer-overall-insufficient", ("time", Min.Minutes - overallTime.Minutes))); return false; } @@ -298,7 +308,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, /// [UsedImplicitly] [Serializable, NetSerializable] -public sealed partial class LoadoutPlaytimeRequirement : LoadoutRequirement +public sealed partial class CharacterPlaytimeRequirement : CharacterRequirement { [DataField] public TimeSpan Min = TimeSpan.MinValue; @@ -309,9 +319,10 @@ public sealed partial class LoadoutPlaytimeRequirement : LoadoutRequirement [DataField(required: true)] public ProtoId Tracker; - public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, - Dictionary playTimes, IEntityManager entityManager, IPrototypeManager prototypeManager, - IConfigurationManager configManager, out FormattedMessage? reason) + public override bool IsValid(IPrototype prototype, JobPrototype job, HumanoidCharacterProfile profile, + Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason) { // Disable the requirement if the role timers are disabled if (!configManager.GetCVar(CCVars.GameRoleTimers)) @@ -323,7 +334,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Get SharedJobSystem if (!entityManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem)) { - DebugTools.Assert("LoadoutRequirements: SharedJobSystem not found"); + DebugTools.Assert("CharacterRequirements: SharedJobSystem not found"); reason = null; return false; } @@ -335,7 +346,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, if (!jobSystem.TryGetPrimaryDepartment(trackerJob, out var department) && !jobSystem.TryGetDepartment(trackerJob, out department)) { - DebugTools.Assert($"LoadoutRequirements: Department not found for job {trackerJob}"); + DebugTools.Assert($"CharacterRequirements: Department not found for job {trackerJob}"); reason = null; return false; } @@ -349,7 +360,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Show the reason if invalid reason = Inverted ? null - : FormattedMessage.FromMarkup(Loc.GetString("loadout-timer-role-too-high", + : FormattedMessage.FromMarkup(Loc.GetString("character-timer-role-too-high", ("time", time.Minutes - Max.Minutes), ("job", trackerJob), ("departmentColor", department.Color))); @@ -361,7 +372,7 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, // Show the reason if invalid reason = Inverted ? null - : FormattedMessage.FromMarkup(Loc.GetString("loadout-timer-role-insufficient", + : FormattedMessage.FromMarkup(Loc.GetString("character-timer-role-insufficient", ("time", Min.Minutes - time.Minutes), ("job", trackerJob), ("departmentColor", department.Color))); diff --git a/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs b/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs new file mode 100644 index 00000000000..e93c933a6aa --- /dev/null +++ b/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs @@ -0,0 +1,43 @@ +using Content.Shared.Preferences; +using Content.Shared.Roles; +using Robust.Shared.Configuration; +using Robust.Shared.Prototypes; +using Robust.Shared.Utility; + +namespace Content.Shared.Customization.Systems; + + +public sealed class CharacterRequirementsSystem : EntitySystem +{ + public bool CheckRequirementsValid(IPrototype prototype, List requirements, JobPrototype job, + HumanoidCharacterProfile profile, Dictionary playTimes, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out List reasons) + { + reasons = new List(); + var valid = true; + + foreach (var requirement in requirements) + { + // Set valid to false if the requirement is invalid and not inverted + // If it's inverted set valid to false when it's valid + if (!requirement.IsValid(prototype, job, profile, playTimes, + entityManager, prototypeManager, configManager, + out var reason)) + { + if (valid) + valid = requirement.Inverted; + } + else + { + if (valid) + valid = !requirement.Inverted; + } + + if (reason != null) // To appease the compiler + reasons.Add(reason); + } + + return valid; + } +} From f851cede7d95d09a005dbac09567f38e0b0297eb Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 23:02:04 -0700 Subject: [PATCH 05/30] fix loadout requirements --- .../Loadouts/Jobs/Heads/captain.yml | 26 +++++------ .../Loadouts/Jobs/Heads/chiefEngineer.yml | 8 ++-- .../Jobs/Heads/chiefMedicalOfficer.yml | 12 ++--- .../Loadouts/Jobs/Heads/headOfPersonnel.yml | 18 ++++---- .../Loadouts/Jobs/Heads/headOfSecurity.yml | 30 ++++++------ .../Loadouts/Jobs/Heads/quarterMaster.yml | 12 ++--- .../Loadouts/Jobs/Heads/researchDirector.yml | 10 ++-- Resources/Prototypes/Loadouts/Jobs/cargo.yml | 4 +- .../Prototypes/Loadouts/Jobs/engineering.yml | 36 +++++++-------- .../Prototypes/Loadouts/Jobs/medical.yml | 46 +++++++++---------- .../Prototypes/Loadouts/Jobs/science.yml | 18 ++++---- .../Prototypes/Loadouts/Jobs/security.yml | 26 +++++------ .../Prototypes/Loadouts/Jobs/service.yml | 30 ++++++------ Resources/Prototypes/Loadouts/uniform.yml | 2 +- 14 files changed, 139 insertions(+), 139 deletions(-) diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml index 05f51baf1c5..ef417ee0d61 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -28,7 +28,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -40,7 +40,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -52,7 +52,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -63,7 +63,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -74,7 +74,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -85,7 +85,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -96,7 +96,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -107,7 +107,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -118,7 +118,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -130,7 +130,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: @@ -141,7 +141,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !lype:CharacterJobRequirement jobs: - Captain items: diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/chiefEngineer.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/chiefEngineer.yml index e184e0a60a6..c4905591124 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/chiefEngineer.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/chiefEngineer.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefEngineer items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefEngineer items: @@ -27,7 +27,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefEngineer items: @@ -39,7 +39,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefEngineer items: diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/chiefMedicalOfficer.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/chiefMedicalOfficer.yml index 32e1a6e43eb..c75c871b011 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/chiefMedicalOfficer.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/chiefMedicalOfficer.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefMedicalOfficer items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefMedicalOfficer items: @@ -27,7 +27,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefMedicalOfficer items: @@ -38,7 +38,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefMedicalOfficer items: @@ -49,7 +49,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefMedicalOfficer items: @@ -61,7 +61,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ChiefMedicalOfficer items: diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/headOfPersonnel.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/headOfPersonnel.yml index f4a583e39a4..3d3799c0adf 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/headOfPersonnel.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/headOfPersonnel.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -28,7 +28,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -40,7 +40,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -52,7 +52,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -63,7 +63,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -74,7 +74,7 @@ category: Jobs cost: 4 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -85,7 +85,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: @@ -97,7 +97,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfPersonnel items: diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/headOfSecurity.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/headOfSecurity.yml index 60c6bbdb00c..4f0d785b14d 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/headOfSecurity.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/headOfSecurity.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -28,7 +28,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -40,7 +40,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -52,7 +52,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -64,7 +64,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -76,7 +76,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -88,7 +88,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -100,7 +100,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -112,7 +112,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -123,7 +123,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -134,7 +134,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -145,7 +145,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -156,7 +156,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: @@ -168,7 +168,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - HeadOfSecurity items: diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/quarterMaster.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/quarterMaster.yml index 802bc65de59..3359d8f5d74 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/quarterMaster.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/quarterMaster.yml @@ -5,7 +5,7 @@ # cost: 2 # exclusive: true # requirements: -# - !type:LoadoutJobRequirement +# - !type:CharacterJobRequirement # jobs: # - Quartermaster # items: @@ -17,7 +17,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Quartermaster items: @@ -29,7 +29,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Quartermaster items: @@ -41,7 +41,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Quartermaster items: @@ -52,7 +52,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Quartermaster items: @@ -64,7 +64,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Quartermaster items: diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/researchDirector.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/researchDirector.yml index cf24ffd8525..87cb0db1790 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/researchDirector.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/researchDirector.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ResearchDirector items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ResearchDirector items: @@ -27,7 +27,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ResearchDirector items: @@ -38,7 +38,7 @@ category: Jobs cost: 2 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ResearchDirector items: @@ -50,7 +50,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - ResearchDirector items: diff --git a/Resources/Prototypes/Loadouts/Jobs/cargo.yml b/Resources/Prototypes/Loadouts/Jobs/cargo.yml index fe835d6823c..87463862010 100644 --- a/Resources/Prototypes/Loadouts/Jobs/cargo.yml +++ b/Resources/Prototypes/Loadouts/Jobs/cargo.yml @@ -4,10 +4,10 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - SalvageSpecialist - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobSalvageSpecialist min: 36000 # 10 hours items: diff --git a/Resources/Prototypes/Loadouts/Jobs/engineering.yml b/Resources/Prototypes/Loadouts/Jobs/engineering.yml index 820825e236e..44ef2262bc5 100644 --- a/Resources/Prototypes/Loadouts/Jobs/engineering.yml +++ b/Resources/Prototypes/Loadouts/Jobs/engineering.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer items: @@ -28,16 +28,16 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobAtmosphericTechnician min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobStationEngineer min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Engineering min: 216000 # 60 hours items: @@ -49,16 +49,16 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobAtmosphericTechnician min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobStationEngineer min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Engineering min: 216000 # 60 hours items: @@ -70,7 +70,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - AtmosphericTechnician items: @@ -83,7 +83,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician @@ -96,7 +96,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician @@ -110,7 +110,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician @@ -123,7 +123,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician @@ -136,7 +136,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician @@ -149,7 +149,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician @@ -162,7 +162,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - StationEngineer - AtmosphericTechnician diff --git a/Resources/Prototypes/Loadouts/Jobs/medical.yml b/Resources/Prototypes/Loadouts/Jobs/medical.yml index 37af839f3cc..5e88006fcee 100644 --- a/Resources/Prototypes/Loadouts/Jobs/medical.yml +++ b/Resources/Prototypes/Loadouts/Jobs/medical.yml @@ -4,7 +4,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor - Paramedic @@ -18,7 +18,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor - Chemist @@ -31,7 +31,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor - ChiefMedicalOfficer @@ -44,7 +44,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor items: @@ -56,7 +56,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor items: @@ -68,7 +68,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor items: @@ -80,7 +80,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Chemist items: @@ -91,7 +91,7 @@ category: Jobs exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Chemist items: @@ -103,7 +103,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Paramedic items: @@ -115,7 +115,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Paramedic items: @@ -127,16 +127,16 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobChemist min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobMedicalDoctor min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Medical min: 216000 # 60 hours items: @@ -148,16 +148,16 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobChemist min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobMedicalDoctor min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Medical min: 216000 # 60 hours items: @@ -169,7 +169,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor items: @@ -181,16 +181,16 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - MedicalDoctor - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobChemist min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobMedicalDoctor min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Medical min: 216000 # 60 hours items: diff --git a/Resources/Prototypes/Loadouts/Jobs/science.yml b/Resources/Prototypes/Loadouts/Jobs/science.yml index f65b69c46a0..ad6f02e589e 100644 --- a/Resources/Prototypes/Loadouts/Jobs/science.yml +++ b/Resources/Prototypes/Loadouts/Jobs/science.yml @@ -4,10 +4,10 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Scientist - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Epistemics min: 216000 # 60 hours items: @@ -19,10 +19,10 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Scientist - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Epistemics min: 216000 # 60 hours items: @@ -34,7 +34,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Scientist - ResearchAssistant @@ -48,7 +48,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Scientist - ResearchAssistant @@ -62,10 +62,10 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Scientist - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Epistemics min: 216000 # 60 hours items: @@ -77,7 +77,7 @@ cost: 1 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Scientist - ResearchAssistant diff --git a/Resources/Prototypes/Loadouts/Jobs/security.yml b/Resources/Prototypes/Loadouts/Jobs/security.yml index 47c4b040d3d..ecf7e4893a2 100644 --- a/Resources/Prototypes/Loadouts/Jobs/security.yml +++ b/Resources/Prototypes/Loadouts/Jobs/security.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - SecurityOfficer - SecurityCadet @@ -18,19 +18,19 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - SecurityOfficer - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobWarden min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobDetective min: 7200 # 2 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobSecurityOfficer min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Security min: 216000 # 60 hours items: @@ -42,19 +42,19 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - SecurityOfficer - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobWarden min: 21600 # 6 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobDetective min: 7200 # 2 hours - - !type:LoadoutPlaytimeRequirement + - !type:CharacterPlaytimeRequirement tracker: JobSecurityOfficer min: 21600 # 6 hours - - !type:LoadoutDepartmentTimeRequirement + - !type:CharacterDepartmentTimeRequirement department: Security min: 216000 # 60 hours items: @@ -66,7 +66,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Warden - HeadOfSecurity @@ -78,7 +78,7 @@ category: Jobs cost: 1 requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Detective - SecurityOfficer diff --git a/Resources/Prototypes/Loadouts/Jobs/service.yml b/Resources/Prototypes/Loadouts/Jobs/service.yml index 4372f891ad7..6ef3c3ad485 100644 --- a/Resources/Prototypes/Loadouts/Jobs/service.yml +++ b/Resources/Prototypes/Loadouts/Jobs/service.yml @@ -4,7 +4,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Clown items: @@ -18,7 +18,7 @@ cost: 3 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Clown items: @@ -32,7 +32,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Bartender items: @@ -44,7 +44,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Botanist items: @@ -56,7 +56,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -68,7 +68,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -80,7 +80,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -92,7 +92,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -104,7 +104,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -116,7 +116,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -128,7 +128,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -140,7 +140,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Lawyer items: @@ -152,7 +152,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Reporter items: @@ -164,7 +164,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Reporter items: @@ -176,7 +176,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Reporter items: diff --git a/Resources/Prototypes/Loadouts/uniform.yml b/Resources/Prototypes/Loadouts/uniform.yml index 097577febab..5afdd303c0b 100644 --- a/Resources/Prototypes/Loadouts/uniform.yml +++ b/Resources/Prototypes/Loadouts/uniform.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !type:LoadoutJobRequirement + - !type:CharacterJobRequirement jobs: - Passenger items: From 4c4c38f169e1830bb96d04593752a4aff00f4a71 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 23:06:05 -0700 Subject: [PATCH 06/30] fix captain too --- .../Loadouts/Jobs/Heads/captain.yml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml b/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml index ef417ee0d61..d8849472ff4 100644 --- a/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml +++ b/Resources/Prototypes/Loadouts/Jobs/Heads/captain.yml @@ -4,7 +4,7 @@ cost: 2 exclusive: true requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -16,7 +16,7 @@ cost: 2 exclusive: true requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -28,7 +28,7 @@ cost: 2 exclusive: true requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -40,7 +40,7 @@ cost: 3 exclusive: true requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -52,7 +52,7 @@ cost: 3 exclusive: true requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -63,7 +63,7 @@ category: Jobs cost: 2 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -74,7 +74,7 @@ category: Jobs cost: 1 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -85,7 +85,7 @@ category: Jobs cost: 1 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -96,7 +96,7 @@ category: Jobs cost: 1 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -107,7 +107,7 @@ category: Jobs cost: 1 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -118,7 +118,7 @@ category: Jobs cost: 1 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -130,7 +130,7 @@ cost: 1 exclusive: true requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: @@ -141,7 +141,7 @@ category: Jobs cost: 1 requirements: - - !lype:CharacterJobRequirement + - !type:CharacterJobRequirement jobs: - Captain items: From 8472e2bb0e0fd49f7b0df302f39c063b25f1b85b Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 23:06:35 -0700 Subject: [PATCH 07/30] rename loadout reqs to character reqs --- .../en-US/customization/character-requirements.ftl | 13 +++++++++++++ .../Locale/en-US/loadouts/loadout-requirements.ftl | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 Resources/Locale/en-US/customization/character-requirements.ftl delete mode 100644 Resources/Locale/en-US/loadouts/loadout-requirements.ftl diff --git a/Resources/Locale/en-US/customization/character-requirements.ftl b/Resources/Locale/en-US/customization/character-requirements.ftl new file mode 100644 index 00000000000..ded66f23046 --- /dev/null +++ b/Resources/Locale/en-US/customization/character-requirements.ftl @@ -0,0 +1,13 @@ +character-age-requirement = You must be within {$min} and {$max} years old +character-species-requirement = You must be a {$species} +character-trait-requirement = You must have the trait {$trait} +character-backpack-type-requirement = You must use a {$type} as your bag +character-clothing-preference-requirement = You must wear a {$type} + +character-job-requirement = You must be one of these jobs: {$job} +character-timer-department-insufficient = You require [color=yellow]{TOSTRING($time, "0")}[/color] more minutes of [color={$departmentColor}]{$department}[/color] department playtime +character-timer-department-too-high = You require [color=yellow]{TOSTRING($time, "0")}[/color] fewer minutes in [color={$departmentColor}]{$department}[/color] department +character-timer-overall-insufficient = You require [color=yellow]{TOSTRING($time, "0")}[/color] more minutes of playtime +character-timer-overall-too-high = You require [color=yellow]{TOSTRING($time, "0")}[/color] fewer minutes of playtime +character-timer-role-insufficient = You require [color=yellow]{TOSTRING($time, "0")}[/color] more minutes with [color={$departmentColor}]{$job}[/color] +character-timer-role-too-high = You require[color=yellow] {TOSTRING($time, "0")}[/color] fewer minutes with [color={$departmentColor}]{$job}[/color] diff --git a/Resources/Locale/en-US/loadouts/loadout-requirements.ftl b/Resources/Locale/en-US/loadouts/loadout-requirements.ftl deleted file mode 100644 index 5a453ed5cbf..00000000000 --- a/Resources/Locale/en-US/loadouts/loadout-requirements.ftl +++ /dev/null @@ -1,13 +0,0 @@ -loadout-age-requirement = You must be within {$min} and {$max} years old -loadout-species-requirement = You must be a {$species} -loadout-trait-requirement = You must have the trait {$trait} -loadout-backpack-type-requirement = You must use a {$type} as your bag -loadout-clothing-preference-requirement = You must wear a {$type} - -loadout-job-requirement = You must be one of these jobs: {$job} -loadout-timer-department-insufficient = You require [color=yellow]{TOSTRING($time, "0")}[/color] more minutes of [color={$departmentColor}]{$department}[/color] department playtime -loadout-timer-department-too-high = You require [color=yellow]{TOSTRING($time, "0")}[/color] fewer minutes in [color={$departmentColor}]{$department}[/color] department -loadout-timer-overall-insufficient = You require [color=yellow]{TOSTRING($time, "0")}[/color] more minutes of playtime -loadout-timer-overall-too-high = You require [color=yellow]{TOSTRING($time, "0")}[/color] fewer minutes of playtime -loadout-timer-role-insufficient = You require [color=yellow]{TOSTRING($time, "0")}[/color] more minutes with [color={$departmentColor}]{$job}[/color] -loadout-timer-role-too-high = You require[color=yellow] {TOSTRING($time, "0")}[/color] fewer minutes with [color={$departmentColor}]{$job}[/color] From 23b4b10ef1059af89b33878123a2ee715ef1f28c Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Sun, 2 Jun 2024 23:07:55 -0700 Subject: [PATCH 08/30] mostly functional everything else --- .../Preferences/UI/HumanoidProfileEditor.xaml | 21 +- .../UI/HumanoidProfileEditor.xaml.cs | 371 +++++++++++++++--- Content.Server/Traits/TraitSystem.cs | 40 +- Content.Shared/CCVar/CCVars.cs | 24 +- .../ui/humanoid-profile-editor.ftl | 1 - Resources/Locale/en-US/traits/categories.ftl | 2 + 6 files changed, 379 insertions(+), 80 deletions(-) create mode 100644 Resources/Locale/en-US/traits/categories.ftl diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml index 9a70d678310..38d4a411ff3 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -142,18 +142,29 @@ - + - - - +