Files
OldThink/Content.Server/Power/Components/PowerMonitoringDeviceComponent.cs

90 lines
3.1 KiB
C#
Raw Normal View History

Power monitoring console overhaul (#20927) * Prototyping whole station wire map * More prototyping * Added icons for the different power distributors and toggleable cable displays * Power cable layouts are now only sent to the client when the power monitor is open * UI prototyping * Power monitors can now see the sprites of distant entities, long entity names are truncated * Updated how network devices are added to the player's PVS * More feature prototypes * Added source / load symbols * Final prototype! Time to actually code it properly... * Start of code clean up * Continuing code clean up * Fixed UI appearance * Code clean up complete * Removed unnecessary changes * Updated how power values are calculated, added UI warnings for power sinks and power net checks * Updated how power values are calculated again, added support for portable generators * Removed unnecessary files * Map beacons start toggled off, console map now works outside the station, fixed substation icon * Made some of Sloth's requested changes. Power distributors don't blink anymore, unless selected * Moved a number of static variables in PowerMonitoringHelper to sensible places in the main files. Added a NavMapTrackableComponent so that you can specify how individual entities appear on the navmap * Updated the colors/positions of HV cables and SMESes to improve contrast * Fixed SMES color in map legend * Partially fixed auto-scrolling on device selection, made sublists alphabetical * Changed how auto-scroll is handled * Changed the font color of the console warning messages * Reduced the font size of beacon labels * Added the station name to the console * Organized references * Removed unwanted changes to RobustToolbox * Fix merge conflict * Fix merge conflict, maybe * Fix merge conflict * Updated outdated reference * Fixed portable_generator.yml * Implemented a number of requested changes, move bit masks to a shared component * Navigate listings via the navmap * First attempt at improving efficiency * Second attempt at optimization, entity grouping added for solar panels * Finished solar panel entity joining * Finished major revisions, code clean up needed * Finializing optimizations * Made requested changes * Bug fix, removed obsolete code * Bug fixes * Bug fixes * STarted revisions * Further revisions * More revision * Finalizing revisions. Need to make RT PR * Code tidying * More code tidying * Trying to avoid merge conflicts * Trying to avoid merge conflicts * Removed use of PVS * Improving efficiency * Addressed a bunch of outstanding issues * Clear old data on console refresh * UI adjustments * Made node comparison more robust. More devices can be combined into one entry * Added missing component 'dirty'
2023-12-24 00:07:41 -06:00
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.Power.EntitySystems;
using Content.Shared.Power;
namespace Content.Server.Power.Components;
/// <summary>
/// Used to flag any entities that should appear on a power monitoring console
/// </summary>
[RegisterComponent, Access(typeof(PowerMonitoringConsoleSystem))]
public sealed partial class PowerMonitoringDeviceComponent : Component
{
/// <summary>
/// Name of the node that this device draws its power from (see <see cref="NodeContainerComponent"/>)
/// </summary>
[DataField("sourceNode"), ViewVariables]
public string SourceNode = string.Empty;
/// <summary>
/// Name of the node that this device distributes power to (see <see cref="NodeContainerComponent"/>)
/// </summary>
[DataField("loadNode"), ViewVariables]
public string LoadNode = string.Empty;
/// <summary>
/// Names of the nodes that this device can potentially distributes power to (see <see cref="NodeContainerComponent"/>)
/// </summary>
[DataField("loadNodes"), ViewVariables]
public List<string>? LoadNodes;
/// <summary>
/// This entity will be grouped with entities that have the same collection name
/// </summary>
[DataField("collectionName"), ViewVariables]
public string CollectionName = string.Empty;
[ViewVariables]
public BaseNodeGroup? NodeGroup = null;
/// <summary>
/// Indicates whether the entity is/should be part of a collection
/// </summary>
public bool IsCollectionMasterOrChild { get { return CollectionName != string.Empty; } }
/// <summary>
/// Specifies the uid of the master that represents this entity
/// </summary>
/// <remarks>
/// Used when grouping multiple entities into a single power monitoring console entry
/// </remarks>
[ViewVariables]
public EntityUid CollectionMaster;
/// <summary>
/// Indicates if this entity represents a group of entities
/// </summary>
/// <remarks>
/// Used when grouping multiple entities into a single power monitoring console entry
/// </remarks>
public bool IsCollectionMaster { get { return Owner == CollectionMaster; } }
/// <summary>
/// A list of other entities that are to be represented by this entity
/// </summary>
/// /// <remarks>
/// Used when grouping multiple entities into a single power monitoring console entry
/// </remarks>
[ViewVariables]
public Dictionary<EntityUid, PowerMonitoringDeviceComponent> ChildDevices = new();
/// <summary>
/// Path to the .rsi folder
/// </summary>
[DataField("sprite"), ViewVariables]
public string SpritePath = string.Empty;
/// <summary>
/// The .rsi state
/// </summary>
[DataField("state"), ViewVariables]
public string SpriteState = string.Empty;
/// <summary>
/// Determines what power monitoring group this entity should belong to
/// </summary>
[DataField("group", required: true), ViewVariables]
public PowerMonitoringConsoleGroup Group;
}