Machine Port Prototypes (#7659)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
using System;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.DeviceNetwork;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Light.Components;
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.MachineLinking.Components;
|
||||
using Content.Server.MachineLinking.System;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Light;
|
||||
@@ -25,7 +23,7 @@ using Robust.Shared.Timing;
|
||||
namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
/// <summary>
|
||||
/// System for the PoweredLightComponens
|
||||
/// System for the PoweredLightComponents
|
||||
/// </summary>
|
||||
public sealed class PoweredLightSystem : EntitySystem
|
||||
{
|
||||
@@ -36,8 +34,11 @@ namespace Content.Server.Light.EntitySystems
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
|
||||
private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2);
|
||||
public const string LightBulbContainer = "light_bulb";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -58,12 +59,8 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
private void OnInit(EntityUid uid, PoweredLightComponent light, ComponentInit args)
|
||||
{
|
||||
light.LightBulbContainer = light.Owner.EnsureContainer<ContainerSlot>("light_bulb");
|
||||
|
||||
var receiver = EnsureComp<SignalReceiverComponent>(uid);
|
||||
foreach (string port in new[] { "On", "Off", "Toggle" })
|
||||
if (!receiver.Inputs.ContainsKey(port))
|
||||
receiver.AddPort(port);
|
||||
light.LightBulbContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, LightBulbContainer);
|
||||
_signalSystem.EnsureReceiverPorts(uid, light.OnPort, light.OffPort, light.TogglePort);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, PoweredLightComponent light, MapInitEvent args)
|
||||
@@ -335,12 +332,12 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
private void OnSignalReceived(EntityUid uid, PoweredLightComponent component, SignalReceivedEvent args)
|
||||
{
|
||||
switch (args.Port)
|
||||
{
|
||||
case "On": SetState(uid, true, component); break;
|
||||
case "Off": SetState(uid, false, component); break;
|
||||
case "Toggle": ToggleLight(uid, component); break;
|
||||
}
|
||||
if (args.Port == component.OffPort)
|
||||
SetState(uid, false, component);
|
||||
else if (args.Port == component.OnPort)
|
||||
SetState(uid, true, component);
|
||||
else if (args.Port == component.TogglePort)
|
||||
ToggleLight(uid, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user