diff --git a/Content.Server/Implants/SubdermalImplantSystem.cs b/Content.Server/Implants/SubdermalImplantSystem.cs index 05550e2f4b..5ccc07dbf0 100644 --- a/Content.Server/Implants/SubdermalImplantSystem.cs +++ b/Content.Server/Implants/SubdermalImplantSystem.cs @@ -19,9 +19,13 @@ using Robust.Shared.Physics.Components; using Robust.Shared.Random; using System.Numerics; using Content.Server.IdentityManagement; +using Content.Shared._Amour.GrammarSystem; +using Content.Shared.IdentityManagement.Components; using Content.Shared.Movement.Pulling.Components; using Content.Shared.Movement.Pulling.Systems; using Robust.Shared.Collections; +using Robust.Shared.Enums; +using Robust.Shared.GameObjects.Components.Localization; using Robust.Shared.Map.Components; namespace Content.Server.Implants; @@ -41,6 +45,7 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem [Dependency] private readonly EntityLookupSystem _lookupSystem = default!; [Dependency] private readonly SharedMapSystem _mapSystem = default!; [Dependency] private readonly IdentitySystem _identity = default!; // WD + [Dependency] private readonly GrammarSystem _grammar = default!; //Amour private EntityQuery _physicsQuery; private HashSet> _targetGrids = []; @@ -56,6 +61,7 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem SubscribeLocalEvent(OnActivateImplantEvent); SubscribeLocalEvent(OnScramImplant); SubscribeLocalEvent(OnDnaScramblerImplant); + SubscribeLocalEvent(OnGenderSwapImplant); //Amour } @@ -225,4 +231,42 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem args.Handled = true; QueueDel(uid); } + + //Amour Start + private void OnGenderSwapImplant(EntityUid uid, SubdermalImplantComponent component, UseGenderSwapImplantEvent args) + { + if (component.ImplantedEntity is not { } ent) + return; + + if (TryComp(ent, out var humanoid) && humanoid.Sex != Sex.Unsexed) + { + var newSex = humanoid.Sex; + + if (humanoid.Sex == Sex.Male) + newSex = Sex.Female; + else + newSex = Sex.Male; + + _humanoidAppearance.SetSex(ent, newSex); + } + + if (TryComp(ent, out var grammar) && + (grammar.Gender != Gender.Neuter || grammar.Gender != Gender.Epicene)) + { + var newGender = grammar.Gender; + + if (grammar.Gender == Gender.Male) + newGender = Gender.Female; + else + newGender = Gender.Male; + + _grammar.SetGender((ent, grammar), newGender); + if (HasComp(ent)) + _identity.QueueIdentityUpdate(ent); + } + + args.Handled = true; + QueueDel(uid); + } + //Amour End } diff --git a/Content.Shared/Implants/Components/SubdermalImplantComponent.cs b/Content.Shared/Implants/Components/SubdermalImplantComponent.cs index 09ef05e48a..26aab7e765 100644 --- a/Content.Shared/Implants/Components/SubdermalImplantComponent.cs +++ b/Content.Shared/Implants/Components/SubdermalImplantComponent.cs @@ -89,3 +89,10 @@ public sealed partial class UseDnaScramblerImplantEvent : InstantActionEvent { } + +//Amour +public sealed partial class UseGenderSwapImplantEvent : InstantActionEvent +{ + +} +//Amour diff --git a/Resources/Prototypes/Actions/types.yml b/Resources/Prototypes/Actions/types.yml index 85918e5679..cd9a6fe717 100644 --- a/Resources/Prototypes/Actions/types.yml +++ b/Resources/Prototypes/Actions/types.yml @@ -358,3 +358,18 @@ itemIconStyle: NoItem useDelay: 1 # emote spam event: !type:ToggleActionEvent + +#Amour +- type: entity + id: ActionActivateGenderSwapImplant + name: Swap Gender + description: Swaps your gender between male/female. + components: + - type: InstantAction + charges: 1 + itemIconStyle: BigAction + priority: -20 + icon: + sprite: Clothing/OuterClothing/Hardsuits/lingspacesuit.rsi + state: icon + event: !type:UseGenderSwapImplantEvent diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 8e01401dce..065155946e 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -918,6 +918,7 @@ - Saw - Hemostat - ClothingEyesGlassesChemical + - GenderSwapImplanter #Amour dynamicRecipes: - HandheldCrewMonitor - ChemicalPayload diff --git a/Resources/Prototypes/Recipes/Lathes/medical.yml b/Resources/Prototypes/Recipes/Lathes/medical.yml index 2b7840d0b1..0bb6a1277c 100644 --- a/Resources/Prototypes/Recipes/Lathes/medical.yml +++ b/Resources/Prototypes/Recipes/Lathes/medical.yml @@ -254,3 +254,11 @@ Steel: 600 Plastic: 300 +#Amour +- type: latheRecipe + id: GenderSwapImplanter + result: GenderSwapImplanter + completetime: 1 + materials: + Glass: 600 + Steel: 600 diff --git a/Resources/Prototypes/_White/Entities/Objects/Misc/implanters.yml b/Resources/Prototypes/_White/Entities/Objects/Misc/implanters.yml index 687ff5bb38..d229a9c5ed 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Misc/implanters.yml +++ b/Resources/Prototypes/_White/Entities/Objects/Misc/implanters.yml @@ -42,3 +42,12 @@ components: - type: Implanter implant: NeuroStabilizationImplant + +#Amour +- type: entity + id: GenderSwapImplanter + name: gender swap implanter + parent: BaseImplantOnlyImplanter + components: + - type: Implanter + implant: GenderSwapImplant diff --git a/Resources/Prototypes/_White/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/_White/Entities/Objects/Misc/subdermal_implants.yml index 33e09c8eb5..7b75f6d04f 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/_White/Entities/Objects/Misc/subdermal_implants.yml @@ -49,3 +49,13 @@ tags: - NeuroStabilization +#Amour +- type: entity + parent: BaseSubdermalImplant + id: GenderSwapImplant + name: Gender Swap Implant + description: This swaps the users gender on activation. + noSpawn: true + components: + - type: SubdermalImplant + implantAction: ActionActivateGenderSwapImplant