forked from new-frontiers-14/frontier-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: 20kdc <[email protected]>
- Loading branch information
Showing
212 changed files
with
8,580 additions
and
4,422 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,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=power_005Cvisualizers/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
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
23 changes: 23 additions & 0 deletions
23
Content.Client/Light/Visualizers/EmergencyLightVisualizer.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,23 @@ | ||
using Content.Shared.Light.Component; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
|
||
namespace Content.Client.Light.Visualizers | ||
{ | ||
[DataDefinition] | ||
public sealed class EmergencyLightVisualizer : AppearanceVisualizer | ||
{ | ||
public override void OnChangeData(AppearanceComponent component) | ||
{ | ||
base.OnChangeData(component); | ||
|
||
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite)) | ||
return; | ||
|
||
if (!component.TryGetData(EmergencyLightVisuals.On, out bool on)) | ||
on = false; | ||
|
||
sprite.LayerSetState(0, on ? "emergency_light_on" : "emergency_light_off"); | ||
} | ||
} | ||
} |
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,99 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Content.Shared.NodeContainer; | ||
using JetBrains.Annotations; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Input; | ||
using Robust.Client.ResourceManagement; | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.IoC; | ||
using Robust.Shared.Map; | ||
|
||
namespace Content.Client.NodeContainer | ||
{ | ||
[UsedImplicitly] | ||
public sealed class NodeGroupSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IOverlayManager _overlayManager = default!; | ||
[Dependency] private readonly IEntityLookup _entityLookup = default!; | ||
[Dependency] private readonly IMapManager _mapManager = default!; | ||
[Dependency] private readonly IInputManager _inputManager = default!; | ||
[Dependency] private readonly IEyeManager _eyeManager = default!; | ||
[Dependency] private readonly IResourceCache _resourceCache = default!; | ||
|
||
public bool VisEnabled { get; private set; } | ||
|
||
public Dictionary<int, NodeVis.GroupData> Groups { get; } = new(); | ||
public HashSet<string> Filtered { get; } = new(); | ||
|
||
public Dictionary<EntityUid, (NodeVis.GroupData group, NodeVis.NodeDatum node)[]> | ||
Entities { get; private set; } = new(); | ||
|
||
public Dictionary<(int group, int node), NodeVis.NodeDatum> NodeLookup { get; private set; } = new(); | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeNetworkEvent<NodeVis.MsgData>(DataMsgHandler); | ||
} | ||
|
||
public override void Shutdown() | ||
{ | ||
base.Shutdown(); | ||
|
||
_overlayManager.RemoveOverlay<NodeVisualizationOverlay>(); | ||
} | ||
|
||
private void DataMsgHandler(NodeVis.MsgData ev) | ||
{ | ||
if (!VisEnabled) | ||
return; | ||
|
||
foreach (var deletion in ev.GroupDeletions) | ||
{ | ||
Groups.Remove(deletion); | ||
} | ||
|
||
foreach (var group in ev.Groups) | ||
{ | ||
Groups.Add(group.NetId, group); | ||
} | ||
|
||
Entities = Groups.Values | ||
.SelectMany(g => g.Nodes, (data, nodeData) => (data, nodeData)) | ||
.GroupBy(n => n.nodeData.Entity) | ||
.ToDictionary(g => g.Key, g => g.ToArray()); | ||
|
||
NodeLookup = Groups.Values | ||
.SelectMany(g => g.Nodes, (data, nodeData) => (data, nodeData)) | ||
.ToDictionary(n => (n.data.NetId, n.nodeData.NetId), n => n.nodeData); | ||
} | ||
|
||
public void SetVisEnabled(bool enabled) | ||
{ | ||
VisEnabled = enabled; | ||
|
||
RaiseNetworkEvent(new NodeVis.MsgEnable(enabled)); | ||
|
||
if (enabled) | ||
{ | ||
var overlay = new NodeVisualizationOverlay( | ||
this, | ||
_entityLookup, | ||
_mapManager, | ||
_inputManager, | ||
_eyeManager, | ||
_resourceCache, | ||
EntityManager); | ||
|
||
_overlayManager.AddOverlay(overlay); | ||
} | ||
else | ||
{ | ||
Groups.Clear(); | ||
Entities.Clear(); | ||
} | ||
} | ||
} | ||
} |
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,56 @@ | ||
using Content.Client.Administration.Managers; | ||
using Content.Shared.Administration; | ||
using Robust.Shared.Console; | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.IoC; | ||
|
||
namespace Content.Client.NodeContainer | ||
{ | ||
public sealed class NodeVisCommand : IConsoleCommand | ||
{ | ||
public string Command => "nodevis"; | ||
public string Description => "Toggles node group visualization"; | ||
public string Help => ""; | ||
|
||
public void Execute(IConsoleShell shell, string argStr, string[] args) | ||
{ | ||
var adminMan = IoCManager.Resolve<IClientAdminManager>(); | ||
if (!adminMan.HasFlag(AdminFlags.Debug)) | ||
{ | ||
shell.WriteError("You need +DEBUG for this command"); | ||
return; | ||
} | ||
|
||
var sys = EntitySystem.Get<NodeGroupSystem>(); | ||
sys.SetVisEnabled(!sys.VisEnabled); | ||
} | ||
} | ||
|
||
public sealed class NodeVisFilterCommand : IConsoleCommand | ||
{ | ||
public string Command => "nodevisfilter"; | ||
public string Description => "Toggles showing a specific group on nodevis"; | ||
public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off"; | ||
|
||
public void Execute(IConsoleShell shell, string argStr, string[] args) | ||
{ | ||
var sys = EntitySystem.Get<NodeGroupSystem>(); | ||
|
||
if (args.Length == 0) | ||
{ | ||
foreach (var filtered in sys.Filtered) | ||
{ | ||
shell.WriteLine(filtered); | ||
} | ||
} | ||
else | ||
{ | ||
var filter = args[0]; | ||
if (!sys.Filtered.Add(filter)) | ||
{ | ||
sys.Filtered.Remove(filter); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.