mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description Ports MODsuits from Goobstation PR https://github.com/Goob-Station/Goob-Station/pull/1242. The PR author has confirmed that he is okay with me doing this. --- # TODO - [X] Port in sprites - [x] Port in YMLs - [X] Port code - [x] Port code PATCHES - [x] Update EE with required fixes --- <details><summary><h1>Media</h1></summary> <p> ## Modsuit crafting https://github.com/user-attachments/assets/8ff03d3a-0fc1-4818-b710-bfc43f0e2a68 ## Modsuit sealing https://github.com/user-attachments/assets/6671459a-7767-499b-8678-062fc1db7134 </p> </details> --- # Changelog 🆑 - add: Modsuits have been ported from Goobstation! --------- Signed-off-by: Eris <erisfiregamer1@gmail.com> Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com> Co-authored-by: VMSolidus <evilexecutive@gmail.com> (cherry picked from commit cb06c41fc07275e1f15af916babb44368c0c26c2)
58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
using Content.Client._Goobstation.Clothing.Components;
|
|
using Content.Client.Clothing;
|
|
using Content.Shared._Goobstation.Clothing;
|
|
using Content.Shared.Clothing;
|
|
using Content.Shared.Item;
|
|
using Robust.Client.GameObjects;
|
|
using System.Linq;
|
|
|
|
namespace Content.Client._Goobstation.Clothing.EntitySystems;
|
|
|
|
public sealed class SealableClothingVisualizerSystem : VisualizerSystem<SealableClothingVisualsComponent>
|
|
{
|
|
[Dependency] private readonly SharedItemSystem _itemSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<SealableClothingVisualsComponent, GetEquipmentVisualsEvent>(OnGetEquipmentVisuals, after: new[] { typeof(ClientClothingSystem) });
|
|
}
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, SealableClothingVisualsComponent component, ref AppearanceChangeEvent args)
|
|
{
|
|
if (!AppearanceSystem.TryGetData<bool>(uid, SealableClothingVisuals.Sealed, out var isSealed, args.Component))
|
|
return;
|
|
|
|
if (args.Sprite != null && component.SpriteLayer != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
|
|
args.Sprite.LayerSetVisible(layer, isSealed);
|
|
|
|
_itemSystem.VisualsChanged(uid);
|
|
}
|
|
|
|
private void OnGetEquipmentVisuals(Entity<SealableClothingVisualsComponent> sealable, ref GetEquipmentVisualsEvent args)
|
|
{
|
|
var (uid, comp) = sealable;
|
|
|
|
if (!TryComp(uid, out AppearanceComponent? appearance)
|
|
|| !AppearanceSystem.TryGetData<bool>(uid, SealableClothingVisuals.Sealed, out var isSealed, appearance)
|
|
|| !isSealed)
|
|
return;
|
|
|
|
if (!comp.VisualLayers.TryGetValue(args.Slot, out var layers))
|
|
return;
|
|
|
|
var i = 0;
|
|
foreach (var layer in layers)
|
|
{
|
|
var key = layer.MapKeys?.FirstOrDefault();
|
|
if (key == null)
|
|
{
|
|
key = i == 0 ? $"{args.Slot}-sealed" : $"{args.Slot}-sealed-{i}";
|
|
i++;
|
|
}
|
|
|
|
args.Layers.Add((key, layer));
|
|
}
|
|
}
|
|
}
|