mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* weldingOverlay * more universal * fixes * colors back to black * overlay image moved * fixes fixes * smal fixes * path * fixes * shader removal * cleanup * Added Activiate option * scrap metal helmet * png moved out of rsi * overlay sticking with zoom * Apply suggestions from code review Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * fixes * partial and readonly * again * whitespace * ws * refresh * Typos and inherits Signed-off-by: Connor Huffine <chuffine@gmail.com> * gasmask parent and merge mistake * fix for multi mask problems * fix for same shader toggle * turn this off on other viewports * docs * Implement scaling and scale down the textures --------- Signed-off-by: Connor Huffine <chuffine@gmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Connor Huffine <chuffine@gmail.com> Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using Content.Shared.Clothing;
|
|
using Content.Shared.Inventory.Events;
|
|
using Content.Shared.Overlays;
|
|
using Robust.Client.Graphics;
|
|
|
|
namespace Content.Client.Overlays;
|
|
|
|
/// <summary>
|
|
/// Adds image overlay when wearing item with <see cref="ImageOverlayComponent"/>
|
|
/// </summary>
|
|
public sealed partial class ImageOverlaySystem : EquipmentHudSystem<ImageOverlayComponent>
|
|
{
|
|
[Dependency] private IOverlayManager _overlayMan = default!;
|
|
|
|
private ImageOverlay _overlay = default!;
|
|
|
|
/// <inheritdoc />
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
_overlay = new();
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnItemToggled(Entity<ImageOverlayComponent> ent, ref ItemMaskToggledEvent args)
|
|
{
|
|
_overlay.SetActive(ent.Comp, !args.Mask.Comp.IsToggled);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void UpdateInternal(RefreshEquipmentHudEvent<ImageOverlayComponent> component)
|
|
{
|
|
base.UpdateInternal(component);
|
|
if (component.Components.Count == 0)
|
|
{
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
return;
|
|
}
|
|
|
|
_overlayMan.AddOverlay(_overlay);
|
|
_overlay.UpdateState(component.Components);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void DeactivateInternal()
|
|
{
|
|
base.DeactivateInternal();
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
}
|
|
}
|