]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
add carp hardsuit for traitors (#25155)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Sun, 16 Jun 2024 11:57:57 +0000 (11:57 +0000)
committerGitHub <noreply@github.com>
Sun, 16 Jun 2024 11:57:57 +0000 (21:57 +1000)
* 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>
Content.Shared/Clothing/Components/FactionClothingComponent.cs [new file with mode: 0644]
Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/store/uplink-catalog.ftl
Resources/Prototypes/Catalog/uplink_catalog.yml
Resources/Prototypes/Entities/Clothing/Head/hoods.yml
Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml
Resources/Prototypes/Entities/Mobs/NPCs/carp.yml

diff --git a/Content.Shared/Clothing/Components/FactionClothingComponent.cs b/Content.Shared/Clothing/Components/FactionClothingComponent.cs
new file mode 100644 (file)
index 0000000..d49ee4f
--- /dev/null
@@ -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;
+
+/// <summary>
+/// When equipped, adds the wearer to a faction.
+/// When removed, removes the wearer from a faction.
+/// </summary>
+[RegisterComponent, NetworkedComponent, Access(typeof(FactionClothingSystem))]
+public sealed partial class FactionClothingComponent : Component
+{
+    /// <summary>
+    /// Faction to add and remove.
+    /// </summary>
+    [DataField(required: true)]
+    public ProtoId<NpcFactionPrototype> Faction = string.Empty;
+
+    /// <summary>
+    /// If true, the wearer was already part of the faction.
+    /// This prevents wrongly removing them after removing the item.
+    /// </summary>
+    [DataField]
+    public bool AlreadyMember;
+}
diff --git a/Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs
new file mode 100644 (file)
index 0000000..76b7b9a
--- /dev/null
@@ -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;
+
+/// <summary>
+/// Handles <see cref="FactionClothingComponent"/> faction adding and removal.
+/// </summary>
+public sealed class FactionClothingSystem : EntitySystem
+{
+    [Dependency] private readonly NpcFactionSystem _faction = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<FactionClothingComponent, GotEquippedEvent>(OnEquipped);
+        SubscribeLocalEvent<FactionClothingComponent, GotUnequippedEvent>(OnUnequipped);
+    }
+
+    private void OnEquipped(Entity<FactionClothingComponent> ent, ref GotEquippedEvent args)
+    {
+        TryComp<NpcFactionMemberComponent>(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<FactionClothingComponent> ent, ref GotUnequippedEvent args)
+    {
+        if (ent.Comp.AlreadyMember)
+        {
+            ent.Comp.AlreadyMember = false;
+            return;
+        }
+
+        _faction.RemoveFaction(args.Equipee, ent.Comp.Faction);
+    }
+}
index 78c094926f1d3de8f45b767f318698277a8fe0cf..2598970cefbe80631ae13fe3eb97672a61891862 100644 (file)
@@ -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.
 
index d39f9003575edc04a81ec1fdab29737db5a4b024..0ba83dfe735fb0a3b249f6bf34460fbba5bd59b2 100644 (file)
   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
index b62834dd98e0d615bf552eff7ac7bfdd64788bef..db1870691232a757fd098168705b5142169eba1c 100644 (file)
     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
index ccf6f09b19400c1ed396c499c50b860c4da1b927..79c116b3cad3c983334fdbfa59235e640ac22d71 100644 (file)
   - 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
index 3a77dbab4c98d74c0bb225aeb8c02e1597c968fa..10bc7861fac38ee895703559b15cd986d92d2eda 100644 (file)
@@ -15,7 +15,7 @@
           true
     - type: NpcFactionMember
       factions:
-        - SimpleHostile
+      - Dragon
     - type: Sprite
       drawdepth: Mobs
       sprite: Mobs/Aliens/Carps/space.rsi