Power stuff (#31314)
* Power stuff - Add shared IsPowered - Add shared ResolveApc - Move PowerChangedEvent to shared for now - Add SlimPoweredLight that actually functions how you'd expect a PoweredLight to function it id didn't have a bunch of bloat on it. * big update * boing
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
|
||||
@@ -11,9 +11,8 @@ using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Administration.UI.Bwoink
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.CrewManifest;
|
||||
using Content.Client.CrewManifest.UI;
|
||||
using Content.Shared.CrewManifest;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Client.Materials;
|
||||
using Content.Client.Materials.UI;
|
||||
using Content.Client.Message;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Construction.Components;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Client.CrewManifest.UI;
|
||||
using Content.Shared.CrewManifest;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Prometheus;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Client.Message;
|
||||
using Content.Client.UserInterface.Systems.EscapeMenu;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.State;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Client.TextScreen;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.MachineLinking.UI;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Client.Options.UI.Tabs;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Client.Power.Components;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Power.EntitySystems;
|
||||
@@ -27,4 +28,16 @@ public sealed class PowerReceiverSystem : SharedPowerReceiverSystem
|
||||
|
||||
component.Powered = state.Powered;
|
||||
}
|
||||
|
||||
public override bool ResolveApc(EntityUid entity, [NotNullWhen(true)] ref SharedApcPowerReceiverComponent? component)
|
||||
{
|
||||
if (component != null)
|
||||
return true;
|
||||
|
||||
if (!TryComp(entity, out ApcPowerReceiverComponent? receiver))
|
||||
return false;
|
||||
|
||||
component = receiver;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Power.Generator;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Client.Power.Generator;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Threading.Channels;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Radio.Components;
|
||||
using Robust.Client.AutoGenerated;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.StationRecords;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
namespace Content.Client.StationRecords;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.Chemistry.Visualizers;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
|
||||
namespace Content.Client.Storage.Components;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Xenoarchaeology.Equipment;
|
||||
using Microsoft.VisualBasic;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.AlertLevel;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.AlertLevel;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Ame.Components;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Anomaly.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Map;
|
||||
using System.Numerics;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Anomaly;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Shared.UserInterface;
|
||||
using Content.Server.Advertise;
|
||||
using Content.Server.Advertise.Components;
|
||||
using Content.Shared.Arcade;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Shared.UserInterface;
|
||||
using Content.Server.Advertise;
|
||||
using Content.Server.Advertise.Components;
|
||||
using Content.Shared.Power;
|
||||
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Content.Shared.DeviceLinking;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.DeviceNetwork.Systems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Wires;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Atmos.Monitor;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Monitor;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ using Content.Shared.Atmos.Visuals;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Tools.Systems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Content.Shared.Atmos.Monitor;
|
||||
using Content.Shared.Atmos.Piping.Unary.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Tools.Systems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Server.Administration.Logs;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Atmos.Portable
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Atmos.Piping.Portable.Components;
|
||||
using Content.Shared.Atmos.Visuals;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.UserInterface;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Audio;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Audio.Jukebox;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Components;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Atmos.Rotting;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Buckle.Systems;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Station.Components;
|
||||
using Content.Shared.Cargo;
|
||||
using Content.Shared.Cargo.Components;
|
||||
using Content.Shared.DeviceLinking;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Power;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Computer;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Construction;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.DeviceLinking.Systems;
|
||||
using Content.Shared.DeviceLinking;
|
||||
using Content.Shared.Power.Generator;
|
||||
using Content.Shared.Tools;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Power.EntitySystems;
|
||||
|
||||
namespace Content.Server.DeviceNetwork.Systems;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.Medical.CrewMonitoring;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.DeviceNetwork.Systems;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Wires;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Wires;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Content.Server.Access;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.Doors.Systems;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Monitor;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.NameModifier.Components;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Fax;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ using Robust.Shared.Timing;
|
||||
using System.Linq;
|
||||
using Content.Server.Jittering;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.ReagentSpeed;
|
||||
using Content.Shared.Research.Components;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Station.Systems;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Light;
|
||||
using Content.Shared.Light.Components;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Station.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Color = Robust.Shared.Maths.Color;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Light.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
|
||||
namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@ using Robust.Shared.Timing;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
|
||||
namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ using Content.Server.Repairable;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Destructible;
|
||||
using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Materials;
|
||||
|
||||
@@ -24,6 +24,7 @@ using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
@@ -29,6 +29,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Medical.Cryogenics;
|
||||
using Content.Shared.MedicalScanner;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Nutrition.EntitySystems;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.StoryGen;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.Utility;
|
||||
using System.Diagnostics;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Destructible;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Physics.Controllers;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
@@ -59,11 +59,4 @@ namespace Content.Server.Power.Components
|
||||
|
||||
public float PowerReceived => NetworkLoad.ReceivingPower;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised whenever an ApcPowerReceiver becomes powered / unpowered.
|
||||
/// Does nothing on the client.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct PowerChangedEvent(bool Powered, float ReceivingPower);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Tools;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using System.Diagnostics.Tracing;
|
||||
using Content.Shared.Tools.Systems;
|
||||
|
||||
namespace Content.Server.Power.Components;
|
||||
|
||||
@@ -14,11 +15,11 @@ namespace Content.Server.Power.Components;
|
||||
[Access(typeof(CableSystem))]
|
||||
public sealed partial class CableComponent : Component
|
||||
{
|
||||
[DataField("cableDroppedOnCutPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string CableDroppedOnCutPrototype = "CableHVStack1";
|
||||
[DataField]
|
||||
public EntProtoId CableDroppedOnCutPrototype = "CableHVStack1";
|
||||
|
||||
[DataField("cuttingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
||||
public string CuttingQuality = "Cutting";
|
||||
[DataField]
|
||||
public ProtoId<ToolQualityPrototype> CuttingQuality = SharedToolSystem.CutQuality;
|
||||
|
||||
/// <summary>
|
||||
/// Checked by <see cref="CablePlacerComponent"/> to determine if there is
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Power.EntitySystems;
|
||||
using Content.Shared.UserInterface;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Power.NodeGroups;
|
||||
using Content.Server.Tools;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tools.Systems;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -27,7 +28,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
|
||||
private void OnAfterInteractUsing(EntityUid uid, CableComponent component, AfterInteractUsingEvent args)
|
||||
{
|
||||
if (args.Handled || args.Target == null || !args.CanReach || !_toolSystem.HasQuality(args.Used, "Pulsing"))
|
||||
if (args.Handled || args.Target == null || !args.CanReach || !_toolSystem.HasQuality(args.Used, SharedToolSystem.PulseQuality))
|
||||
return;
|
||||
|
||||
var markup = FormattedMessage.FromMarkup(GenerateCableMarkup(uid));
|
||||
@@ -45,7 +46,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
|
||||
// Pulsing is hardcoded here because I don't think it needs to be more complex than that right now.
|
||||
// Update if I'm wrong.
|
||||
var enabled = held != null && _toolSystem.HasQuality(held.Value, "Pulsing");
|
||||
var enabled = held != null && _toolSystem.HasQuality(held.Value, SharedToolSystem.PulseQuality);
|
||||
var verb = new ExamineVerb
|
||||
{
|
||||
Disabled = !enabled,
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.Emp;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Server.Containers;
|
||||
using Content.Shared.Whitelist;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Power.NodeGroups;
|
||||
using Content.Server.Power.Pow3r;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Power.Components;
|
||||
@@ -197,5 +198,17 @@ namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
comp.Load = load;
|
||||
}
|
||||
|
||||
public override bool ResolveApc(EntityUid entity, [NotNullWhen(true)] ref SharedApcPowerReceiverComponent? component)
|
||||
{
|
||||
if (component != null)
|
||||
return true;
|
||||
|
||||
if (!TryComp(entity, out ApcPowerReceiverComponent? receiver))
|
||||
return false;
|
||||
|
||||
component = receiver;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ using Content.Server.Power.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Power.Generation.Teg;
|
||||
using Content.Shared.Rounding;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -5,6 +5,8 @@ using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
|
||||
namespace Content.Server.Power.Generator;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.DeviceLinking;
|
||||
using Content.Shared.Power.Generator;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Power.Generator;
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Server.Speech;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Radio;
|
||||
using Content.Shared.Radio.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Shared.Shuttles.Events;
|
||||
using Content.Shared.Shuttles.Systems;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Shuttles.UI.MapObjects;
|
||||
using Content.Shared.Timing;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -19,6 +19,7 @@ using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Localizations;
|
||||
using Content.Shared.Power;
|
||||
|
||||
namespace Content.Server.Shuttles.Systems;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using Content.Shared.Singularity.EntitySystems;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Sound.Components;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.DeviceNetwork;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.UserInterface;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Emp;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Temperature;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Audio;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.UserInterface;
|
||||
using Content.Shared.VendingMachines;
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.GameTicking;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Shared.Wires;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.DeviceLinking.Events;
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Research.Components;
|
||||
using Content.Shared.Xenoarchaeology.Equipment;
|
||||
using Content.Shared.Xenoarchaeology.XenoArtifacts;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Storage.Components;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Whitelist;
|
||||
using Content.Shared.Xenoarchaeology.Equipment;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Cargo.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Can be inserted into a <see cref="Content.Server.Cargo.Components.CargoOrderConsoleComponent"/> to increase the station's bank account.
|
||||
/// Can be inserted into a <see cref="CargoOrderConsoleComponent"/> to increase the station's bank account.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class CashComponent : Component
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Clothing.Components;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Item.ItemToggle.Components;
|
||||
using Content.Shared.Toggleable;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
using Robust.Shared.Serialization.Markdown.Mapping;
|
||||
|
||||
17
Content.Shared/Light/Components/SlimPoweredLightComponent.cs
Normal file
17
Content.Shared/Light/Components/SlimPoweredLightComponent.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Light.Components;
|
||||
|
||||
// All content light code is terrible and everything is baked-in. Power code got predicted before light code did.
|
||||
/// <summary>
|
||||
/// Handles turning a pointlight on / off based on power. Nothing else
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class SlimPoweredLightComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to make this as being lit. If unpowered then the light will still be off.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool Enabled = true;
|
||||
}
|
||||
67
Content.Shared/Light/EntitySystems/SlimPoweredLightSystem.cs
Normal file
67
Content.Shared/Light/EntitySystems/SlimPoweredLightSystem.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Content.Shared.Light.Components;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Power.EntitySystems;
|
||||
|
||||
namespace Content.Shared.Light.EntitySystems;
|
||||
|
||||
public sealed class SlimPoweredLightSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPowerReceiverSystem _receiver = default!;
|
||||
[Dependency] private readonly SharedPointLightSystem _lights = default!;
|
||||
|
||||
private bool _setting;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SlimPoweredLightComponent, AttemptPointLightToggleEvent>(OnLightAttempt);
|
||||
SubscribeLocalEvent<SlimPoweredLightComponent, PowerChangedEvent>(OnLightPowerChanged);
|
||||
}
|
||||
|
||||
private void OnLightAttempt(Entity<SlimPoweredLightComponent> ent, ref AttemptPointLightToggleEvent args)
|
||||
{
|
||||
// Early-out to avoid having to trycomp stuff if we're the caller setting it
|
||||
if (_setting)
|
||||
return;
|
||||
|
||||
if (args.Enabled && !_receiver.IsPowered(ent.Owner))
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnLightPowerChanged(Entity<SlimPoweredLightComponent> ent, ref PowerChangedEvent args)
|
||||
{
|
||||
// Early out if we don't need to trycomp.
|
||||
if (args.Powered)
|
||||
{
|
||||
if (!ent.Comp.Enabled)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ent.Comp.Enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_lights.TryGetLight(ent.Owner, out var light))
|
||||
return;
|
||||
|
||||
var enabled = ent.Comp.Enabled && args.Powered;
|
||||
_setting = true;
|
||||
_lights.SetEnabled(ent.Owner, enabled, light);
|
||||
_setting = false;
|
||||
}
|
||||
|
||||
public void SetEnabled(Entity<SlimPoweredLightComponent?> entity, bool enabled)
|
||||
{
|
||||
if (!Resolve(entity.Owner, ref entity.Comp, false))
|
||||
return;
|
||||
|
||||
if (entity.Comp.Enabled == enabled)
|
||||
return;
|
||||
|
||||
entity.Comp.Enabled = enabled;
|
||||
Dirty(entity);
|
||||
_lights.SetEnabled(entity.Owner, enabled);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ namespace Content.Shared.Light.EntitySystems;
|
||||
|
||||
public sealed class UnpoweredFlashlightSystem : EntitySystem
|
||||
{
|
||||
// TODO: Split some of this to ItemTogglePointLight
|
||||
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Objectives.Components;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Explosion.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Power.Components;
|
||||
|
||||
@@ -5,6 +6,16 @@ namespace Content.Shared.Power.EntitySystems;
|
||||
|
||||
public abstract class SharedPowerReceiverSystem : EntitySystem
|
||||
{
|
||||
public abstract bool ResolveApc(EntityUid entity, [NotNullWhen(true)] ref SharedApcPowerReceiverComponent? component);
|
||||
|
||||
public bool IsPowered(Entity<SharedApcPowerReceiverComponent?> entity)
|
||||
{
|
||||
if (!ResolveApc(entity.Owner, ref entity.Comp))
|
||||
return true;
|
||||
|
||||
return entity.Comp.Powered;
|
||||
}
|
||||
|
||||
protected string GetExamineText(bool powered)
|
||||
{
|
||||
return Loc.GetString("power-receiver-component-on-examine-main",
|
||||
|
||||
8
Content.Shared/Power/PowerChangedEvent.cs
Normal file
8
Content.Shared/Power/PowerChangedEvent.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Content.Shared.Power;
|
||||
|
||||
/// <summary>
|
||||
/// Raised whenever an ApcPowerReceiver becomes powered / unpowered.
|
||||
/// Does nothing on the client.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct PowerChangedEvent(bool Powered, float ReceivingPower);
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Item.ItemToggle.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ public abstract partial class SharedToolSystem : EntitySystem
|
||||
[Dependency] private readonly TurfSystem _turfs = default!;
|
||||
[Dependency] protected readonly SharedSolutionContainerSystem SolutionContainer = default!;
|
||||
|
||||
public const string CutQuality = "Cutting";
|
||||
public const string PulseQuality = "Pulsing";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
InitializeMultipleTool();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Weapons.Melee.Components;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user