Working flashlight for hard hats (#2599)

* Add verb to toggle flashlight

* Playing with hand-held light for hard hat

* ClothingEquippedPrefix will update players sprite when changed

* Make abstract prototype for hardhat and fixed hardhat orange sprites

* Fixed all other hard hats

* Fixed requested changes

* Restore prototype and sprites changes

* Nullables

* That's actually nullable

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
Alex Evgrashin
2020-11-23 06:17:38 +03:00
committed by GitHub
parent e97763afd2
commit fb6dd4a490
44 changed files with 202 additions and 31 deletions

View File

@@ -1,9 +1,13 @@
using Content.Client.GameObjects.Components.Items;
#nullable enable
using Content.Client.GameObjects.Components.HUD.Inventory;
using Content.Client.GameObjects.Components.Items;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.Items;
using Robust.Client.Graphics;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -18,8 +22,29 @@ namespace Content.Client.GameObjects.Components.Clothing
public override string Name => "Clothing";
public override uint? NetID => ContentNetIDs.CLOTHING;
private string? _clothingEquippedPrefix;
[ViewVariables(VVAccess.ReadWrite)]
public string ClothingEquippedPrefix { get; set; }
public string? ClothingEquippedPrefix
{
get => _clothingEquippedPrefix;
set
{
if (_clothingEquippedPrefix == value)
return;
_clothingEquippedPrefix = value;
if (!Owner.TryGetContainer(out IContainer? container))
return;
if (!container.Owner.TryGetComponent(out ClientInventoryComponent? inventory))
return;
if (!inventory.TryFindItemSlots(Owner, out EquipmentSlotDefines.Slots? slots))
return;
inventory.SetSlotVisuals(slots.Value, Owner);
}
}
[ViewVariables(VVAccess.ReadWrite)]
public FemaleClothingMask FemaleMask
@@ -54,7 +79,7 @@ namespace Content.Client.GameObjects.Components.Clothing
return null;
}
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
if (curState == null)
return;