Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add carp hardsuit for traitors #25155

Merged
merged 10 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Content.Shared/Clothing/Components/FactionClothingComponent.cs
Original file line number Diff line number Diff line change
@@ -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;
}
42 changes: 42 additions & 0 deletions Content.Shared/Clothing/EntitySystems/FactionClothingSystem.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,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
Expand Down
16 changes: 16 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Head/hoods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
true
- type: NpcFactionMember
factions:
- SimpleHostile
- Dragon
- type: Sprite
drawdepth: Mobs
sprite: Mobs/Aliens/Carps/space.rsi
Expand Down
Loading