From e46085b47b0705364cf95e9613102ecf72c80f6f Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:57:57 +0000 Subject: [PATCH] add carp hardsuit for traitors (#25155) * FactionClothing * swtich carp to the Dragon faction * add carp hardsuit * add carp hardsuit to uplink * fixes * webedit ops 1 * why did i name it that wtf * among --------- Co-authored-by: deltanedas <@deltanedas:kde.org> --- .../Components/FactionClothingComponent.cs | 27 ++++++++++++ .../EntitySystems/FactionClothingSystem.cs | 42 +++++++++++++++++++ .../Locale/en-US/store/uplink-catalog.ftl | 3 ++ .../Prototypes/Catalog/uplink_catalog.yml | 11 +++++ .../Entities/Clothing/Head/hoods.yml | 16 +++++++ .../Entities/Clothing/OuterClothing/suits.yml | 13 ++++++ .../Prototypes/Entities/Mobs/NPCs/carp.yml | 2 +- 7 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 Content.Shared/Clothing/Components/FactionClothingComponent.cs create mode 100644 Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs diff --git a/Content.Shared/Clothing/Components/FactionClothingComponent.cs b/Content.Shared/Clothing/Components/FactionClothingComponent.cs new file mode 100644 index 00000000000..d49ee4f81d6 --- /dev/null +++ b/Content.Shared/Clothing/Components/FactionClothingComponent.cs @@ -0,0 +1,27 @@ +using Content.Shared.Clothing.EntitySystems; +using Content.Shared.NPC.Prototypes; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Clothing.Components; + +/// +/// When equipped, adds the wearer to a faction. +/// When removed, removes the wearer from a faction. +/// +[RegisterComponent, NetworkedComponent, Access(typeof(FactionClothingSystem))] +public sealed partial class FactionClothingComponent : Component +{ + /// + /// Faction to add and remove. + /// + [DataField(required: true)] + public ProtoId Faction = string.Empty; + + /// + /// If true, the wearer was already part of the faction. + /// This prevents wrongly removing them after removing the item. + /// + [DataField] + public bool AlreadyMember; +} diff --git a/Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs new file mode 100644 index 00000000000..76b7b9aa66d --- /dev/null +++ b/Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs @@ -0,0 +1,42 @@ +using Content.Shared.Clothing.Components; +using Content.Shared.Inventory.Events; +using Content.Shared.NPC.Components; +using Content.Shared.NPC.Systems; + +namespace Content.Shared.Clothing.EntitySystems; + +/// +/// Handles faction adding and removal. +/// +public sealed class FactionClothingSystem : EntitySystem +{ + [Dependency] private readonly NpcFactionSystem _faction = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnEquipped); + SubscribeLocalEvent(OnUnequipped); + } + + private void OnEquipped(Entity ent, ref GotEquippedEvent args) + { + TryComp(args.Equipee, out var factionComp); + var faction = (args.Equipee, factionComp); + ent.Comp.AlreadyMember = _faction.IsMember(faction, ent.Comp.Faction); + + _faction.AddFaction(faction, ent.Comp.Faction); + } + + private void OnUnequipped(Entity ent, ref GotUnequippedEvent args) + { + if (ent.Comp.AlreadyMember) + { + ent.Comp.AlreadyMember = false; + return; + } + + _faction.RemoveFaction(args.Equipee, ent.Comp.Faction); + } +} diff --git a/Resources/Locale/en-US/store/uplink-catalog.ftl b/Resources/Locale/en-US/store/uplink-catalog.ftl index 52c66727f03..d6afc6cd068 100644 --- a/Resources/Locale/en-US/store/uplink-catalog.ftl +++ b/Resources/Locale/en-US/store/uplink-catalog.ftl @@ -312,6 +312,9 @@ uplink-clothing-shoes-boots-mag-syndie-desc = A pair of boots that prevent slipp uplink-eva-syndie-name = Syndicate EVA Bundle uplink-eva-syndie-desc = A simple EVA suit that offers no protection other than what's needed to survive in space. +uplink-hardsuit-carp-name = Carp Hardsuit +uplink-hardsuit-carp-desc = Looks like an ordinary carp suit, except fully spaceproof and tricks space carp into thinking you are one of them. + uplink-hardsuit-syndie-name = Syndicate Hardsuit uplink-hardsuit-syndie-desc = The Syndicate's well known armored blood red hardsuit, capable of space walks and bullet resistant. diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index 145321484b2..04c34b74df8 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -1286,6 +1286,17 @@ categories: - UplinkWearables +- type: listing + id: UplinkHardsuitCarp + name: uplink-hardsuit-carp-name + description: uplink-hardsuit-carp-desc + icon: { sprite: /Textures/Clothing/OuterClothing/Suits/carpsuit.rsi, state: icon } + productEntity: ClothingOuterHardsuitCarp + cost: + Telecrystal: 4 + categories: + - UplinkWearables + - type: listing id: UplinkHardsuitSyndie name: uplink-hardsuit-syndie-name diff --git a/Resources/Prototypes/Entities/Clothing/Head/hoods.yml b/Resources/Prototypes/Entities/Clothing/Head/hoods.yml index 0bca209d51e..f2326a548fc 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hoods.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hoods.yml @@ -206,6 +206,22 @@ slots: - Hair +- type: entity + parent: ClothingHeadHatHoodCarp + id: ClothingHeadHelmetHardsuitCarp + noSpawn: true + components: + - type: PressureProtection + highPressureMultiplier: 0.6 + lowPressureMultiplier: 1000 + - type: TemperatureProtection + coefficient: 0.2 + - type: BreathMask + # this is on the hood so you only fool the fish if you wear the whole set + # wear carp suit and security helmet, they'll know you are fake + - type: FactionClothing + faction: Dragon + - type: entity parent: ClothingHeadBase id: ClothingHeadHatHoodMoth diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml index 08bbd83c489..ac5b888b401 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml @@ -246,3 +246,16 @@ - type: ContainerContainer containers: toggleable-clothing: !type:ContainerSlot {} + +- type: entity + parent: ClothingOuterSuitCarp + id: ClothingOuterHardsuitCarp + suffix: Hardsuit, DO NOT MAP + components: + - type: PressureProtection + highPressureMultiplier: 0.6 + lowPressureMultiplier: 1000 + - type: TemperatureProtection + coefficient: 0.01 + - type: ToggleableClothing + clothingPrototype: ClothingHeadHelmetHardsuitCarp diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml index 1ea7181d2b0..a197fc60d13 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml @@ -15,7 +15,7 @@ true - type: NpcFactionMember factions: - - SimpleHostile + - Dragon - type: Sprite drawdepth: Mobs sprite: Mobs/Aliens/Carps/space.rsi