* 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?
58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using Content.Shared.GameObjects;
|
|
using Content.Shared.GameObjects.Components.Items;
|
|
using SS14.Shared.GameObjects;
|
|
using SS14.Shared.Serialization;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
|
|
|
namespace Content.Server.GameObjects
|
|
{
|
|
public class ClothingComponent : ItemComponent
|
|
{
|
|
public override string Name => "Clothing";
|
|
public override uint? NetID => ContentNetIDs.CLOTHING;
|
|
public override Type StateType => typeof(ClothingComponentState);
|
|
|
|
public SlotFlags SlotFlags = SlotFlags.PREVENTEQUIP; //Different from None, NONE allows equips if no slot flags are required
|
|
|
|
private int _heatResistance;
|
|
public int HeatResistance => _heatResistance;
|
|
|
|
private string _clothingEquippedPrefix;
|
|
public string ClothingEquippedPrefix
|
|
{
|
|
get
|
|
{
|
|
return _clothingEquippedPrefix;
|
|
}
|
|
set
|
|
{
|
|
Dirty();
|
|
_clothingEquippedPrefix = value;
|
|
}
|
|
}
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
{
|
|
base.ExposeData(serializer);
|
|
|
|
// TODO: Writing.
|
|
serializer.DataReadFunction("Slots", new List<string>(0), list =>
|
|
{
|
|
foreach (var slotflagsloaded in list)
|
|
{
|
|
SlotFlags |= (SlotFlags)Enum.Parse(typeof(SlotFlags), slotflagsloaded.ToUpper());
|
|
}
|
|
});
|
|
|
|
serializer.DataFieldCached(ref _heatResistance, "HeatResistance", 323);
|
|
}
|
|
|
|
public override ComponentState GetComponentState()
|
|
{
|
|
return new ClothingComponentState(ClothingEquippedPrefix, EquippedPrefix);
|
|
}
|
|
}
|
|
}
|