Files
tbd-station-14/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs
PrPleGoo 35f3cbe3f9 Engineer's helmet (#188)
* refacting some sprite things

* fix sprites

* Netcode for sending a new icon state to the ClientComponent

* Fixed broken torches.

* Fix dirty calls.

* ClothingComponentState now also includes EquippedPrefix

* Inherritance ClothingComponent : ItemComponent

* Added parameter to ItemComponentState constructor.

* Update RobustToolbox

* Revert "Update RobustToolbox"

This reverts commit 82c7e98ff3853b64698d5e80a45cd7a3758618e0.

Undo weird commit to toolbox?
2019-04-08 12:18:27 +02:00

46 lines
1.5 KiB
C#

using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.Items;
using SS14.Client.Graphics;
using SS14.Shared.GameObjects;
using SS14.Shared.ViewVariables;
using System;
namespace Content.Client.GameObjects.Components.Clothing
{
public class ClothingComponent : ItemComponent
{
public override string Name => "Clothing";
public override uint? NetID => ContentNetIDs.CLOTHING;
public override Type StateType => typeof(ClothingComponentState);
[ViewVariables(VVAccess.ReadWrite)]
public string ClothingEquippedPrefix { get; set; }
public (RSI rsi, RSI.StateId stateId)? GetEquippedStateInfo(EquipmentSlotDefines.SlotFlags slot)
{
if (RsiPath == null)
{
return null;
}
var rsi = GetRSI();
var prefix = ClothingEquippedPrefix ?? EquippedPrefix;
var stateId = prefix != null ? $"{prefix}-equipped-{slot}" : $"equipped-{slot}";
if (rsi.TryGetState(stateId, out _))
{
return (rsi, stateId);
}
return null;
}
public override void HandleComponentState(ComponentState state)
{
var clothingComponentState = (ClothingComponentState)state;
ClothingEquippedPrefix = clothingComponentState.ClothingEquippedPrefix;
EquippedPrefix = clothingComponentState.EquippedPrefix;
}
}
}