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