-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
085598a
commit 0c82a61
Showing
4 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Delta-V - This file is licensed under AGPLv3 | ||
* Copyright (c) 2024 Delta-V Contributors | ||
* See AGPLv3.txt for details. | ||
*/ | ||
|
||
using Robust.Client.GameObjects; | ||
using System.Numerics; | ||
using Content.Shared.SegmentedEntity; | ||
|
||
namespace Content.Client.DeltaV.Lamiae; | ||
|
||
public sealed class ClientLamiaVisualSystem : VisualizerSystem<SegmentedEntitySegmentVisualsComponent> | ||
{ | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<SegmentedEntitySegmentComponent, AppearanceChangeEvent>(OnAppearanceChange); | ||
} | ||
private void OnAppearanceChange(EntityUid uid, SegmentedEntitySegmentComponent component, ref AppearanceChangeEvent args) | ||
{ | ||
if (args.Sprite == null) return; | ||
|
||
if (AppearanceSystem.TryGetData<float>(uid, ScaleVisuals.Scale, out var scale) && TryComp<SpriteComponent>(uid, out var sprite)) | ||
{ | ||
sprite.Scale = new Vector2(scale, scale); | ||
} | ||
|
||
if (AppearanceSystem.TryGetData<bool>(uid, SegmentedEntitySegmentVisualLayers.Armor, out var worn) | ||
&& AppearanceSystem.TryGetData<string>(uid, SegmentedEntitySegmentVisualLayers.ArmorRsi, out var path)) | ||
{ | ||
var valid = !string.IsNullOrWhiteSpace(path); | ||
if (valid) | ||
{ | ||
args.Sprite.LayerSetRSI(SegmentedEntitySegmentVisualLayers.Armor, path); | ||
} | ||
args.Sprite.LayerSetVisible(SegmentedEntitySegmentVisualLayers.Armor, worn); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Client/DeltaV/Lamiae/LamiaSegmentVisualsComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Delta-V - This file is licensed under AGPLv3 | ||
* Copyright (c) 2024 Delta-V Contributors | ||
* See AGPLv3.txt for details. | ||
*/ | ||
|
||
namespace Content.Client.DeltaV.Lamiae; | ||
|
||
[RegisterComponent] | ||
public sealed partial class SegmentedEntitySegmentVisualsComponent : Component | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters