-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #476 from Rxup/upstream-sync
Upstream sync
- Loading branch information
Showing
266 changed files
with
3,726 additions
and
14,482 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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,38 @@ | ||
using Content.Shared.Storage; | ||
using Content.Shared.Lock; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.Lock.Visualizers; | ||
|
||
public sealed class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent> | ||
{ | ||
protected override void OnAppearanceChange(EntityUid uid, LockVisualsComponent comp, ref AppearanceChangeEvent args) | ||
{ | ||
if (args.Sprite == null | ||
|| !AppearanceSystem.TryGetData<bool>(uid, LockVisuals.Locked, out _, args.Component)) | ||
return; | ||
|
||
// Lock state for the entity. | ||
if (!AppearanceSystem.TryGetData<bool>(uid, LockVisuals.Locked, out var locked, args.Component)) | ||
locked = true; | ||
|
||
var unlockedStateExist = args.Sprite.BaseRSI?.TryGetState(comp.StateUnlocked, out _); | ||
|
||
if (AppearanceSystem.TryGetData<bool>(uid, StorageVisuals.Open, out var open, args.Component)) | ||
{ | ||
args.Sprite.LayerSetVisible(LockVisualLayers.Lock, !open); | ||
} | ||
else if (!(bool) unlockedStateExist!) | ||
args.Sprite.LayerSetVisible(LockVisualLayers.Lock, locked); | ||
|
||
if (!open && (bool) unlockedStateExist!) | ||
{ | ||
args.Sprite.LayerSetState(LockVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked); | ||
} | ||
} | ||
} | ||
|
||
public enum LockVisualLayers : byte | ||
{ | ||
Lock | ||
} |
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,20 @@ | ||
namespace Content.Client.Lock.Visualizers; | ||
|
||
[RegisterComponent] | ||
[Access(typeof(LockVisualizerSystem))] | ||
public sealed partial class LockVisualsComponent : Component | ||
{ | ||
/// <summary> | ||
/// The RSI state used for the lock indicator while the entity is locked. | ||
/// </summary> | ||
[DataField("stateLocked")] | ||
[ViewVariables(VVAccess.ReadWrite)] | ||
public string? StateLocked = "locked"; | ||
|
||
/// <summary> | ||
/// The RSI state used for the lock indicator entity is unlocked. | ||
/// </summary> | ||
[DataField("stateUnlocked")] | ||
[ViewVariables(VVAccess.ReadWrite)] | ||
public string? StateUnlocked = "unlocked"; | ||
} |
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
Oops, something went wrong.