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?
This commit is contained in:
committed by
Pieter-Jan Briers
parent
50433c7ab6
commit
35f3cbe3f9
@@ -1,11 +1,21 @@
|
||||
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)
|
||||
{
|
||||
@@ -15,7 +25,8 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
}
|
||||
|
||||
var rsi = GetRSI();
|
||||
var stateId = EquippedPrefix != null ? $"{EquippedPrefix}-equipped-{slot}" : $"equipped-{slot}";
|
||||
var prefix = ClothingEquippedPrefix ?? EquippedPrefix;
|
||||
var stateId = prefix != null ? $"{prefix}-equipped-{slot}" : $"equipped-{slot}";
|
||||
if (rsi.TryGetState(stateId, out _))
|
||||
{
|
||||
return (rsi, stateId);
|
||||
@@ -23,5 +34,12 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState state)
|
||||
{
|
||||
var clothingComponentState = (ClothingComponentState)state;
|
||||
ClothingEquippedPrefix = clothingComponentState.ClothingEquippedPrefix;
|
||||
EquippedPrefix = clothingComponentState.EquippedPrefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Items;
|
||||
using SS14.Client.Graphics;
|
||||
using SS14.Client.Interfaces.ResourceManagement;
|
||||
using SS14.Client.ResourceManagement;
|
||||
@@ -8,12 +9,15 @@ using SS14.Shared.IoC;
|
||||
using SS14.Shared.Serialization;
|
||||
using SS14.Shared.Utility;
|
||||
using SS14.Shared.ViewVariables;
|
||||
using System;
|
||||
|
||||
namespace Content.Client.GameObjects
|
||||
{
|
||||
public class ItemComponent : Component
|
||||
{
|
||||
public override string Name => "Item";
|
||||
public override uint? NetID => ContentNetIDs.ITEM;
|
||||
public override Type StateType => typeof(ItemComponentState);
|
||||
|
||||
[ViewVariables] protected ResourcePath RsiPath;
|
||||
|
||||
@@ -56,5 +60,11 @@ namespace Content.Client.GameObjects
|
||||
var resourceCache = IoCManager.Resolve<IResourceCache>();
|
||||
return resourceCache.GetResource<RSIResource>(SharedSpriteComponent.TextureRoot / RsiPath).RSI;
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState state)
|
||||
{
|
||||
var itemComponentState = (ItemComponentState)state;
|
||||
EquippedPrefix = itemComponentState.EquippedPrefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user