Clothing/item ECS & cleanup (#9706)
This commit is contained in:
@@ -1,22 +1,13 @@
|
||||
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(SharedItemComponent))]
|
||||
[Virtual]
|
||||
public class ItemComponent : SharedItemComponent{}
|
||||
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[ComponentReference(typeof(SharedItemComponent))]
|
||||
public sealed class ClothingComponent : ItemComponent
|
||||
[ComponentReference(typeof(SharedClothingComponent))]
|
||||
public sealed class ClothingComponent : SharedClothingComponent
|
||||
{
|
||||
[DataField("HeatResistance")]
|
||||
private int _heatResistance = 323;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int HeatResistance => _heatResistance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Content.Server.Clothing.Components;
|
||||
|
||||
/// <summary>
|
||||
/// TODO this needs removed somehow.
|
||||
/// Handles 'heat resistance' for gloves touching bulbs and that's it, ick.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class GloveHeatResistanceComponent : Component
|
||||
{
|
||||
[DataField("heatResistance")]
|
||||
public int HeatResistance = 323;
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Clothing.Components;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using static Content.Shared.Clothing.MagbootsComponent;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Server.Disease.Components;
|
||||
using Content.Server.IdentityManagement;
|
||||
using Content.Server.Nutrition.EntitySystems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.IdentityManagement.Components;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -26,6 +27,7 @@ namespace Content.Server.Clothing
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly IdentitySystem _identity = default!;
|
||||
[Dependency] private readonly ClothingSystem _clothing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -79,11 +81,10 @@ namespace Content.Server.Clothing
|
||||
private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, bool isEquip = false)
|
||||
{
|
||||
//toggle visuals
|
||||
if (TryComp<SharedItemComponent>(mask.Owner, out var item))
|
||||
if (TryComp<ClothingComponent>(mask.Owner, out var clothing))
|
||||
{
|
||||
//TODO: sprites for 'pulled down' state. defaults to invisible due to no sprite with this prefix
|
||||
item.EquippedPrefix = mask.IsToggled ? "toggled" : null;
|
||||
Dirty(item);
|
||||
_clothing.SetEquippedPrefix(uid, mask.IsToggled ? "toggled" : null, clothing);
|
||||
}
|
||||
|
||||
// toggle ingestion blocking
|
||||
|
||||
Reference in New Issue
Block a user