Remove server/client clothing components. (#11981)

This commit is contained in:
Leon Friedrich
2022-10-23 11:30:37 +13:00
committed by GitHub
parent 4a3df4f85a
commit 7d276d1101
29 changed files with 110 additions and 131 deletions

View File

@@ -4,11 +4,11 @@ using System.Linq;
using Content.Client.Inventory; using Content.Client.Inventory;
using Content.Shared.Clothing; using Content.Shared.Clothing;
using Content.Shared.Clothing.Components; using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Humanoid; using Content.Shared.Humanoid;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
using Content.Shared.Item; using Content.Shared.Item;
using Content.Shared.Tag;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
@@ -17,7 +17,7 @@ using static Robust.Shared.GameObjects.SharedSpriteComponent;
namespace Content.Client.Clothing; namespace Content.Client.Clothing;
public sealed class ClothingVisualsSystem : EntitySystem public sealed class ClientClothingSystem : ClothingSystem
{ {
/// <summary> /// <summary>
/// This is a shitty hotfix written by me (Paul) to save me from renaming all files. /// This is a shitty hotfix written by me (Paul) to save me from renaming all files.
@@ -44,15 +44,11 @@ public sealed class ClothingVisualsSystem : EntitySystem
[Dependency] private IResourceCache _cache = default!; [Dependency] private IResourceCache _cache = default!;
[Dependency] private InventorySystem _inventorySystem = default!; [Dependency] private InventorySystem _inventorySystem = default!;
[Dependency] private TagSystem _tagSystem = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<ClothingComponent, GotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<ClothingComponent, GotUnequippedEvent>(OnGotUnequipped);
SubscribeLocalEvent<ClothingComponent, GetEquipmentVisualsEvent>(OnGetVisuals); SubscribeLocalEvent<ClothingComponent, GetEquipmentVisualsEvent>(OnGetVisuals);
SubscribeLocalEvent<ClientInventoryComponent, VisualsChangedEvent>(OnVisualsChanged); SubscribeLocalEvent<ClientInventoryComponent, VisualsChangedEvent>(OnVisualsChanged);
@@ -148,11 +144,6 @@ public sealed class ClothingVisualsSystem : EntitySystem
RenderEquipment(uid, args.Item, clothing.InSlot, component, null, clothing); RenderEquipment(uid, args.Item, clothing.InSlot, component, null, clothing);
} }
private void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{
component.InSlot = null;
}
private void OnDidUnequip(EntityUid uid, SpriteComponent component, DidUnequipEvent args) private void OnDidUnequip(EntityUid uid, SpriteComponent component, DidUnequipEvent args)
{ {
if (!TryComp(uid, out ClientInventoryComponent? inventory) || !TryComp(uid, out SpriteComponent? sprite)) if (!TryComp(uid, out ClientInventoryComponent? inventory) || !TryComp(uid, out SpriteComponent? sprite))
@@ -184,9 +175,9 @@ public sealed class ClothingVisualsSystem : EntitySystem
} }
} }
private void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args) protected override void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{ {
component.InSlot = args.Slot; base.OnGotEquipped(uid, component, args);
RenderEquipment(args.Equipee, uid, args.Slot, clothingComponent: component); RenderEquipment(args.Equipee, uid, args.Slot, clothingComponent: component);
} }

View File

@@ -1,12 +0,0 @@
using Content.Shared.Clothing.Components;
using Robust.Shared.GameStates;
namespace Content.Client.Clothing
{
[RegisterComponent]
[ComponentReference(typeof(SharedClothingComponent))]
public sealed class ClothingComponent : SharedClothingComponent
{
public string? InSlot;
}
}

View File

@@ -3,6 +3,7 @@ using Content.Client.Examine;
using Content.Client.Storage; using Content.Client.Storage;
using Content.Client.UserInterface.Controls; using Content.Client.UserInterface.Controls;
using Content.Client.Verbs; using Content.Client.Verbs;
using Content.Shared.Clothing.Components;
using Content.Shared.Hands.Components; using Content.Shared.Hands.Components;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
@@ -23,7 +24,7 @@ namespace Content.Client.Inventory
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly ClothingVisualsSystem _clothingVisualsSystem = default!; [Dependency] private readonly ClientClothingSystem _clothingVisualsSystem = default!;
[Dependency] private readonly ExamineSystem _examine = default!; [Dependency] private readonly ExamineSystem _examine = default!;
[Dependency] private readonly VerbSystem _verbs = default!; [Dependency] private readonly VerbSystem _verbs = default!;

View File

@@ -1,11 +1,8 @@
using Content.Client.Clothing; using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems; using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Movement.Components; using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Client.Animations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Timing; using Robust.Shared.Timing;

View File

@@ -18,7 +18,7 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<ToggleableLightVisualsComponent, GetInhandVisualsEvent>(OnGetHeldVisuals, after: new[] { typeof(ItemSystem) }); SubscribeLocalEvent<ToggleableLightVisualsComponent, GetInhandVisualsEvent>(OnGetHeldVisuals, after: new[] { typeof(ItemSystem) });
SubscribeLocalEvent<ToggleableLightVisualsComponent, GetEquipmentVisualsEvent>(OnGetEquipmentVisuals, after: new[] { typeof(ClothingVisualsSystem) }); SubscribeLocalEvent<ToggleableLightVisualsComponent, GetEquipmentVisualsEvent>(OnGetEquipmentVisuals, after: new[] { typeof(ClientClothingSystem) });
} }
protected override void OnAppearanceChange(EntityUid uid, ToggleableLightVisualsComponent component, ref AppearanceChangeEvent args) protected override void OnAppearanceChange(EntityUid uid, ToggleableLightVisualsComponent component, ref AppearanceChangeEvent args)

View File

@@ -1,14 +1,13 @@
using System.Threading.Tasks;
using Content.Server.Clothing.Components;
using Content.Server.Inventory; using Content.Server.Inventory;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems; using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Item;
using NUnit.Framework; using NUnit.Framework;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using System.Threading.Tasks;
namespace Content.IntegrationTests.Tests namespace Content.IntegrationTests.Tests
{ {

View File

@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using Content.Server.Administration.Commands; using Content.Server.Administration.Commands;
using Content.Server.Administration.Components; using Content.Server.Administration.Components;
@@ -28,6 +28,7 @@ using Content.Server.Tools.Systems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using Content.Shared.Body.Part; using Content.Shared.Body.Part;
using Content.Shared.Clothing.Components;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Disease; using Content.Shared.Disease;

View File

@@ -1,24 +1,22 @@
using Content.Server.Humanoid; using Content.Server.Humanoid;
using Content.Shared.Clothing.Components; using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Humanoid; using Content.Shared.Humanoid;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
using Content.Shared.Tag; using Content.Shared.Tag;
namespace Content.Server.Clothing; namespace Content.Server.Clothing;
public sealed class ServerClothingSystem : EntitySystem public sealed class ServerClothingSystem : ClothingSystem
{ {
[Dependency] private readonly HumanoidSystem _humanoidSystem = default!; [Dependency] private readonly HumanoidSystem _humanoidSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
public override void Initialize() protected override void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{ {
SubscribeLocalEvent<SharedClothingComponent, GotEquippedEvent>(OnGotEquipped); base.OnGotEquipped(uid, component, args);
SubscribeLocalEvent<SharedClothingComponent, GotUnequippedEvent>(OnGotUnequipped); // why the fuck is humanoid visuals server-only???
}
private void OnGotEquipped(EntityUid uid, SharedClothingComponent component, GotEquippedEvent args)
{
if (args.Slot == "head" if (args.Slot == "head"
&& _tagSystem.HasTag(args.Equipment, "HidesHair")) && _tagSystem.HasTag(args.Equipment, "HidesHair"))
{ {
@@ -27,8 +25,12 @@ public sealed class ServerClothingSystem : EntitySystem
} }
} }
private void OnGotUnequipped(EntityUid uid, SharedClothingComponent component, GotUnequippedEvent args) protected override void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{ {
base.OnGotUnequipped(uid, component, args);
// why the fuck is humanoid visuals server-only???
if (args.Slot == "head" if (args.Slot == "head"
&& _tagSystem.HasTag(args.Equipment, "HidesHair")) && _tagSystem.HasTag(args.Equipment, "HidesHair"))
{ {

View File

@@ -1,13 +0,0 @@
using Content.Shared.Clothing.Components;
using Content.Shared.Item;
using Robust.Shared.GameStates;
namespace Content.Server.Clothing.Components
{
// Needed for client-side clothing component.
[RegisterComponent]
[ComponentReference(typeof(SharedClothingComponent))]
public sealed class ClothingComponent : SharedClothingComponent
{
}
}

View File

@@ -1,8 +1,3 @@
using Content.Shared.Actions;
using Content.Shared.Toggleable;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Server.Actions; using Content.Server.Actions;
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
@@ -14,8 +9,12 @@ using Content.Server.IdentityManagement;
using Content.Server.Nutrition.EntitySystems; using Content.Server.Nutrition.EntitySystems;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Server.VoiceMask; using Content.Server.VoiceMask;
using Content.Shared.Actions;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems; using Content.Shared.Clothing.EntitySystems;
using Content.Shared.IdentityManagement.Components; using Content.Shared.IdentityManagement.Components;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Robust.Shared.Player; using Robust.Shared.Player;
namespace Content.Server.Clothing namespace Content.Server.Clothing

View File

@@ -1,27 +1,27 @@
using System.Threading;
using Content.Shared.Disease;
using Content.Shared.Disease.Components;
using Content.Server.Disease.Components;
using Content.Server.Clothing.Components;
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
using Content.Shared.MobState.Components; using Content.Server.Disease.Components;
using Content.Shared.Examine;
using Content.Shared.Inventory;
using Content.Shared.Interaction;
using Content.Server.Popups;
using Content.Server.DoAfter; using Content.Server.DoAfter;
using Content.Server.MobState;
using Content.Server.Nutrition.EntitySystems;
using Content.Server.Popups;
using Content.Shared.Clothing.Components;
using Content.Shared.Disease;
using Content.Shared.Disease.Components;
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.MobState.Components;
using Content.Shared.Rejuvenate;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Manager;
using Content.Shared.Inventory.Events;
using Content.Server.Nutrition.EntitySystems;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Content.Shared.IdentityManagement; using System.Threading;
using Content.Shared.Item;
using Content.Server.MobState;
using Content.Shared.Rejuvenate;
namespace Content.Server.Disease namespace Content.Server.Disease
{ {

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Eye.Blinding.EyeProtection
private void OnEquipped(EntityUid uid, EyeProtectionComponent component, GotEquippedEvent args) private void OnEquipped(EntityUid uid, EyeProtectionComponent component, GotEquippedEvent args)
{ {
if (!TryComp<SharedClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP) if (!TryComp<ClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP)
return; return;
if (!clothing.Slots.HasFlag(args.SlotFlags)) if (!clothing.Slots.HasFlag(args.SlotFlags))

View File

@@ -1,15 +1,11 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Chemistry.EntitySystems; using Content.Server.Chemistry.EntitySystems;
using Content.Server.Clothing.Components;
using Content.Server.DoAfter; using Content.Server.DoAfter;
using Content.Server.Fluids.Components; using Content.Server.Fluids.Components;
using Content.Server.Nutrition.Components; using Content.Server.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Clothing.Components;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
@@ -18,6 +14,9 @@ using Content.Shared.Verbs;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
namespace Content.Server.Fluids.EntitySystems; namespace Content.Server.Fluids.EntitySystems;

View File

@@ -1,7 +1,7 @@
using Content.Server.Clothing.Components;
using Content.Server.Storage.Components; using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems; using Content.Server.Storage.EntitySystems;
using Content.Server.Temperature.Systems; using Content.Server.Temperature.Systems;
using Content.Shared.Clothing.Components;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;

View File

@@ -1,5 +1,5 @@
using Content.Server.Clothing.Components;
using Content.Server.Light.Components; using Content.Server.Light.Components;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems; using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Item; using Content.Shared.Item;

View File

@@ -1,17 +1,16 @@
using System.Threading;
using Content.Shared.Verbs;
using Content.Shared.Inventory.Events;
using Content.Shared.MobState.Components;
using Content.Shared.FixedPoint;
using Content.Shared.Damage;
using Content.Shared.Actions;
using Content.Server.Clothing.Components;
using Content.Server.Medical.Components;
using Content.Server.Popups;
using Content.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.DoAfter; using Content.Server.DoAfter;
using Content.Server.Medical.Components;
using Content.Server.Popups;
using Content.Shared.Actions;
using Content.Shared.Clothing.Components;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Content.Shared.Inventory.Events;
using Content.Shared.MobState.Components;
using Content.Shared.Verbs;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Prototypes; using System.Threading;
namespace Content.Server.Medical namespace Content.Server.Medical
{ {

View File

@@ -1,12 +1,11 @@
using System.Linq;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems; using Content.Server.Chemistry.EntitySystems;
using Content.Server.Clothing.Components;
using Content.Server.Nutrition.Components; using Content.Server.Nutrition.Components;
using Content.Shared.Chemistry; using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems; using Content.Shared.Clothing.EntitySystems;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Inventory; using Content.Shared.Inventory;
@@ -15,6 +14,7 @@ using Content.Shared.Smoking;
using Content.Shared.Temperature; using Content.Shared.Temperature;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using System.Linq;
namespace Content.Server.Nutrition.EntitySystems namespace Content.Server.Nutrition.EntitySystems
{ {

View File

@@ -1,5 +1,5 @@
using Content.Server.Clothing.Components;
using Content.Server.Speech.Components; using Content.Server.Speech.Components;
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
namespace Content.Server.Speech.EntitySystems; namespace Content.Server.Speech.EntitySystems;

View File

@@ -10,8 +10,9 @@ namespace Content.Shared.Clothing.Components;
/// This handles entities which can be equipped. /// This handles entities which can be equipped.
/// </summary> /// </summary>
[NetworkedComponent] [NetworkedComponent]
[RegisterComponent]
[Access(typeof(ClothingSystem), typeof(InventorySystem))] [Access(typeof(ClothingSystem), typeof(InventorySystem))]
public abstract class SharedClothingComponent : Component public sealed class ClothingComponent : Component
{ {
[DataField("clothingVisuals")] [DataField("clothingVisuals")]
[Access(typeof(ClothingSystem), typeof(InventorySystem), Other = AccessPermissions.ReadExecute)] // TODO remove execute permissions. [Access(typeof(ClothingSystem), typeof(InventorySystem), Other = AccessPermissions.ReadExecute)] // TODO remove execute permissions.
@@ -46,6 +47,8 @@ public abstract class SharedClothingComponent : Component
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
[DataField("femaleMask")] [DataField("femaleMask")]
public FemaleClothingMask FemaleMask = FemaleClothingMask.UniformFull; public FemaleClothingMask FemaleMask = FemaleClothingMask.UniformFull;
public string? InSlot;
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -1,11 +1,12 @@
using Content.Shared.Clothing.Components; using Content.Shared.Clothing.Components;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item; using Content.Shared.Item;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
namespace Content.Shared.Clothing.EntitySystems; namespace Content.Shared.Clothing.EntitySystems;
public sealed class ClothingSystem : EntitySystem public abstract class ClothingSystem : EntitySystem
{ {
[Dependency] private readonly SharedItemSystem _itemSys = default!; [Dependency] private readonly SharedItemSystem _itemSys = default!;
@@ -13,16 +14,28 @@ public sealed class ClothingSystem : EntitySystem
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<SharedClothingComponent, ComponentGetState>(OnGetState); SubscribeLocalEvent<ClothingComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<SharedClothingComponent, ComponentHandleState>(OnHandleState); SubscribeLocalEvent<ClothingComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<ClothingComponent, GotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<ClothingComponent, GotUnequippedEvent>(OnGotUnequipped);
} }
private void OnGetState(EntityUid uid, SharedClothingComponent component, ref ComponentGetState args) protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{
component.InSlot = args.Slot;
}
protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{
component.InSlot = null;
}
private void OnGetState(EntityUid uid, ClothingComponent component, ref ComponentGetState args)
{ {
args.State = new ClothingComponentState(component.EquippedPrefix); args.State = new ClothingComponentState(component.EquippedPrefix);
} }
private void OnHandleState(EntityUid uid, SharedClothingComponent component, ref ComponentHandleState args) private void OnHandleState(EntityUid uid, ClothingComponent component, ref ComponentHandleState args)
{ {
if (args.Current is ClothingComponentState state) if (args.Current is ClothingComponentState state)
SetEquippedPrefix(uid, state.EquippedPrefix, component); SetEquippedPrefix(uid, state.EquippedPrefix, component);
@@ -30,7 +43,7 @@ public sealed class ClothingSystem : EntitySystem
#region Public API #region Public API
public void SetEquippedPrefix(EntityUid uid, string? prefix, SharedClothingComponent? clothing = null) public void SetEquippedPrefix(EntityUid uid, string? prefix, ClothingComponent? clothing = null)
{ {
if (!Resolve(uid, ref clothing, false)) if (!Resolve(uid, ref clothing, false))
return; return;
@@ -43,7 +56,7 @@ public sealed class ClothingSystem : EntitySystem
Dirty(clothing); Dirty(clothing);
} }
public void SetSlots(EntityUid uid, SlotFlags slots, SharedClothingComponent? clothing = null) public void SetSlots(EntityUid uid, SlotFlags slots, ClothingComponent? clothing = null)
{ {
if (!Resolve(uid, ref clothing)) if (!Resolve(uid, ref clothing))
return; return;
@@ -55,7 +68,7 @@ public sealed class ClothingSystem : EntitySystem
/// <summary> /// <summary>
/// Copy all clothing specific visuals from another item. /// Copy all clothing specific visuals from another item.
/// </summary> /// </summary>
public void CopyVisuals(EntityUid uid, SharedClothingComponent otherClothing, SharedClothingComponent? clothing = null) public void CopyVisuals(EntityUid uid, ClothingComponent otherClothing, ClothingComponent? clothing = null)
{ {
if (!Resolve(uid, ref clothing)) if (!Resolve(uid, ref clothing))
return; return;

View File

@@ -39,8 +39,8 @@ public abstract class SharedChameleonClothingSystem : EntitySystem
} }
// clothing sprite logic // clothing sprite logic
if (TryComp(uid, out SharedClothingComponent? clothing) && if (TryComp(uid, out ClothingComponent? clothing) &&
proto.TryGetComponent("Clothing", out SharedClothingComponent? otherClothing)) proto.TryGetComponent("Clothing", out ClothingComponent? otherClothing))
{ {
_clothingSystem.CopyVisuals(uid, otherClothing, clothing); _clothingSystem.CopyVisuals(uid, otherClothing, clothing);
} }
@@ -62,7 +62,7 @@ public abstract class SharedChameleonClothingSystem : EntitySystem
return false; return false;
// check if it's valid clothing // check if it's valid clothing
if (!proto.TryGetComponent("Clothing", out SharedClothingComponent? clothing)) if (!proto.TryGetComponent("Clothing", out ClothingComponent? clothing))
return false; return false;
if (!clothing.Slots.HasFlag(chameleonSlot)) if (!clothing.Slots.HasFlag(chameleonSlot))
return false; return false;

View File

@@ -27,7 +27,7 @@ namespace Content.Shared.Eye.Blinding
private void OnEquipped(EntityUid uid, BlindfoldComponent component, GotEquippedEvent args) private void OnEquipped(EntityUid uid, BlindfoldComponent component, GotEquippedEvent args)
{ {
if (!TryComp<SharedClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP) // we live in a society if (!TryComp<ClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP) // we live in a society
return; return;
// Is the clothing in its actual slot? // Is the clothing in its actual slot?
if (!clothing.Slots.HasFlag(args.SlotFlags)) if (!clothing.Slots.HasFlag(args.SlotFlags))
@@ -51,7 +51,7 @@ namespace Content.Shared.Eye.Blinding
private void OnGlassesEquipped(EntityUid uid, VisionCorrectionComponent component, GotEquippedEvent args) private void OnGlassesEquipped(EntityUid uid, VisionCorrectionComponent component, GotEquippedEvent args)
{ {
if (!TryComp<SharedClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP) // we live in a society if (!TryComp<ClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP) // we live in a society
return; return;
// Is the clothing in its actual slot? // Is the clothing in its actual slot?
if (!clothing.Slots.HasFlag(args.SlotFlags)) if (!clothing.Slots.HasFlag(args.SlotFlags))

View File

@@ -38,7 +38,7 @@ public abstract partial class InventorySystem
SubscribeAllEvent<UseSlotNetworkMessage>(OnUseSlot); SubscribeAllEvent<UseSlotNetworkMessage>(OnUseSlot);
} }
protected void QuickEquip(EntityUid uid, SharedClothingComponent component, UseInHandEvent args) protected void QuickEquip(EntityUid uid, ClothingComponent component, UseInHandEvent args)
{ {
if (!TryComp(args.User, out InventoryComponent? inv) if (!TryComp(args.User, out InventoryComponent? inv)
|| !TryComp(args.User, out SharedHandsComponent? hands) || !TryComp(args.User, out SharedHandsComponent? hands)
@@ -53,7 +53,7 @@ public abstract partial class InventorySystem
if (TryGetSlotEntity(args.User, slotDef.Name, out var slotEntity, inv)) if (TryGetSlotEntity(args.User, slotDef.Name, out var slotEntity, inv))
{ {
// Item in slot has to be quick equipable as well // Item in slot has to be quick equipable as well
if (TryComp(slotEntity, out SharedClothingComponent? item) && !item.QuickEquip) if (TryComp(slotEntity, out ClothingComponent? item) && !item.QuickEquip)
continue; continue;
if (!TryUnequip(args.User, slotDef.Name, true, inventory: inv)) if (!TryUnequip(args.User, slotDef.Name, true, inventory: inv))
@@ -157,11 +157,11 @@ public abstract partial class InventorySystem
} }
public bool TryEquip(EntityUid uid, EntityUid itemUid, string slot, bool silent = false, bool force = false, bool predicted = false, public bool TryEquip(EntityUid uid, EntityUid itemUid, string slot, bool silent = false, bool force = false, bool predicted = false,
InventoryComponent? inventory = null, SharedClothingComponent? clothing = null) => InventoryComponent? inventory = null, ClothingComponent? clothing = null) =>
TryEquip(uid, uid, itemUid, slot, silent, force, predicted, inventory, clothing); TryEquip(uid, uid, itemUid, slot, silent, force, predicted, inventory, clothing);
public bool TryEquip(EntityUid actor, EntityUid target, EntityUid itemUid, string slot, bool silent = false, bool force = false, bool predicted = false, public bool TryEquip(EntityUid actor, EntityUid target, EntityUid itemUid, string slot, bool silent = false, bool force = false, bool predicted = false,
InventoryComponent? inventory = null, SharedClothingComponent? clothing = null) InventoryComponent? inventory = null, ClothingComponent? clothing = null)
{ {
if (!Resolve(target, ref inventory, false)) if (!Resolve(target, ref inventory, false))
{ {
@@ -250,11 +250,11 @@ public abstract partial class InventorySystem
public bool CanEquip(EntityUid uid, EntityUid itemUid, string slot, [NotNullWhen(false)] out string? reason, public bool CanEquip(EntityUid uid, EntityUid itemUid, string slot, [NotNullWhen(false)] out string? reason,
SlotDefinition? slotDefinition = null, InventoryComponent? inventory = null, SlotDefinition? slotDefinition = null, InventoryComponent? inventory = null,
SharedClothingComponent? clothing = null, ItemComponent? item = null) => ClothingComponent? clothing = null, ItemComponent? item = null) =>
CanEquip(uid, uid, itemUid, slot, out reason, slotDefinition, inventory, clothing, item); CanEquip(uid, uid, itemUid, slot, out reason, slotDefinition, inventory, clothing, item);
public bool CanEquip(EntityUid actor, EntityUid target, EntityUid itemUid, string slot, [NotNullWhen(false)] out string? reason, SlotDefinition? slotDefinition = null, public bool CanEquip(EntityUid actor, EntityUid target, EntityUid itemUid, string slot, [NotNullWhen(false)] out string? reason, SlotDefinition? slotDefinition = null,
InventoryComponent? inventory = null, SharedClothingComponent? clothing = null, ItemComponent? item = null) InventoryComponent? inventory = null, ClothingComponent? clothing = null, ItemComponent? item = null)
{ {
reason = "inventory-component-can-equip-cannot"; reason = "inventory-component-can-equip-cannot";
if (!Resolve(target, ref inventory, false)) if (!Resolve(target, ref inventory, false))
@@ -326,17 +326,17 @@ public abstract partial class InventorySystem
} }
public bool TryUnequip(EntityUid uid, string slot, bool silent = false, bool force = false, bool predicted = false, public bool TryUnequip(EntityUid uid, string slot, bool silent = false, bool force = false, bool predicted = false,
InventoryComponent? inventory = null, SharedClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, silent, force, predicted, inventory, clothing); InventoryComponent? inventory = null, ClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, silent, force, predicted, inventory, clothing);
public bool TryUnequip(EntityUid actor, EntityUid target, string slot, bool silent = false, public bool TryUnequip(EntityUid actor, EntityUid target, string slot, bool silent = false,
bool force = false, bool predicted = false, InventoryComponent? inventory = null, SharedClothingComponent? clothing = null) => bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null) =>
TryUnequip(actor, target, slot, out _, silent, force, predicted, inventory, clothing); TryUnequip(actor, target, slot, out _, silent, force, predicted, inventory, clothing);
public bool TryUnequip(EntityUid uid, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false, bool force = false, bool predicted = false, public bool TryUnequip(EntityUid uid, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false, bool force = false, bool predicted = false,
InventoryComponent? inventory = null, SharedClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, out removedItem, silent, force, predicted, inventory, clothing); InventoryComponent? inventory = null, ClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, out removedItem, silent, force, predicted, inventory, clothing);
public bool TryUnequip(EntityUid actor, EntityUid target, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false, public bool TryUnequip(EntityUid actor, EntityUid target, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false,
bool force = false, bool predicted = false, InventoryComponent? inventory = null, SharedClothingComponent? clothing = null) bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null)
{ {
removedItem = null; removedItem = null;
if (!Resolve(target, ref inventory, false)) if (!Resolve(target, ref inventory, false))

View File

@@ -8,9 +8,10 @@
sprite: Clothing/OuterClothing/WinterCoats/coat.rsi sprite: Clothing/OuterClothing/WinterCoats/coat.rsi
- type: Clothing - type: Clothing
sprite: Clothing/OuterClothing/WinterCoats/coat.rsi sprite: Clothing/OuterClothing/WinterCoats/coat.rsi
size: 10
- type: TemperatureProtection - type: TemperatureProtection
coefficient: 0.1 coefficient: 0.1
- type: Item
size: 10
- type: Armor - type: Armor
modifiers: modifiers:
coefficients: coefficients:

View File

@@ -156,9 +156,9 @@
state: bearpelt state: bearpelt
- type: Item - type: Item
sprite: Clothing/Head/Misc/hides.rsi sprite: Clothing/Head/Misc/hides.rsi
heldPrefix: bear
- type: Clothing - type: Clothing
sprite: Clothing/Head/Misc/hides.rsi sprite: Clothing/Head/Misc/hides.rsi
heldPrefix: bear
slots: slots:
- HEAD - HEAD

View File

@@ -45,8 +45,7 @@
type: GasTankBoundUserInterface type: GasTankBoundUserInterface
- type: Clothing - type: Clothing
sprite: Objects/Tanks/Jetpacks/blue.rsi sprite: Objects/Tanks/Jetpacks/blue.rsi
QuickEquip: false quickEquip: false
size: 100
slots: slots:
- Back - Back
- type: GasTank - type: GasTank

View File

@@ -308,11 +308,12 @@
- state: mag-unshaded-0 - state: mag-unshaded-0
map: ["enum.GunVisualLayers.MagUnshaded"] map: ["enum.GunVisualLayers.MagUnshaded"]
shader: unshaded shader: unshaded
- type: Item
heldPrefix: taser4
- type: Clothing - type: Clothing
quickEquip: false quickEquip: false
slots: slots:
- Belt - Belt
heldPrefix: taser4
- type: Gun - type: Gun
soundGunshot: soundGunshot:
path: /Audio/Weapons/Guns/Gunshots/taser.ogg path: /Audio/Weapons/Guns/Gunshots/taser.ogg

View File

@@ -74,7 +74,7 @@
- type: Sprite - type: Sprite
sprite: Objects/Weapons/Guns/Snipers/musket.rsi sprite: Objects/Weapons/Guns/Snipers/musket.rsi
- type: Clothing - type: Clothing
icon: Objects/Weapons/Guns/Snipers/musket.rsi sprite: Objects/Weapons/Guns/Snipers/musket.rsi
- type: Gun - type: Gun
selectedMode: SemiAuto selectedMode: SemiAuto
availableModes: availableModes:
@@ -95,7 +95,7 @@
- type: Sprite - type: Sprite
sprite: Objects/Weapons/Guns/Snipers/flintlock.rsi sprite: Objects/Weapons/Guns/Snipers/flintlock.rsi
- type: Clothing - type: Clothing
icon: Objects/Weapons/Guns/Snipers/flintlock.rsi sprite: Objects/Weapons/Guns/Snipers/flintlock.rsi
- type: BallisticAmmoProvider - type: BallisticAmmoProvider
whitelist: whitelist:
tags: tags:

View File

@@ -30,7 +30,6 @@
size: 20 size: 20
- type: Clothing - type: Clothing
sprite: Objects/Weapons/Melee/stunbaton.rsi sprite: Objects/Weapons/Melee/stunbaton.rsi
heldPrefix: off
quickEquip: false quickEquip: false
slots: slots:
- Belt - Belt