Logic stuff (#318)
* Logic stuff * Update logic gate appearance on init * Add components * Move port * Fix
This commit is contained in:
@@ -44,7 +44,7 @@ public sealed class LogicGateSystem : EntitySystem
|
||||
}
|
||||
if (comp.StateB == SignalState.Momentary)
|
||||
{
|
||||
comp.StateB = SignalState.High;
|
||||
comp.StateB = SignalState.Low;
|
||||
}
|
||||
|
||||
// output most likely changed so update it
|
||||
@@ -56,6 +56,8 @@ public sealed class LogicGateSystem : EntitySystem
|
||||
{
|
||||
_deviceLink.EnsureSinkPorts(uid, comp.InputPortA, comp.InputPortB);
|
||||
_deviceLink.EnsureSourcePorts(uid, comp.OutputPort);
|
||||
|
||||
_appearance.SetData(uid, LogicGateVisuals.Gate, comp.Gate); // WD
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, LogicGateComponent comp, ExaminedEvent args)
|
||||
|
||||
@@ -63,6 +63,9 @@ namespace Content.Server.Light.Components
|
||||
[DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
|
||||
public string TogglePort = "Toggle";
|
||||
|
||||
[DataField("statusPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
|
||||
public string StatusPort = "LightStatus";
|
||||
|
||||
/// <summary>
|
||||
/// How long it takes to eject a bulb from this
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Administration.Logs;
|
||||
using Content.Server.Clothing.Components;
|
||||
using Content.Server.DeviceLinking.Events;
|
||||
using Content.Server.DeviceLinking.Systems;
|
||||
using Content.Server.DeviceLinking.Components;
|
||||
using Content.Server.DeviceNetwork;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Emp;
|
||||
@@ -79,6 +80,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
light.LightBulbContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, LightBulbContainer);
|
||||
_signalSystem.EnsureSinkPorts(uid, light.OnPort, light.OffPort, light.TogglePort);
|
||||
_signalSystem.EnsureSourcePorts(uid, light.StatusPort); // WD
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, PoweredLightComponent light, MapInitEvent args)
|
||||
@@ -421,6 +423,15 @@ namespace Content.Server.Light.EntitySystems
|
||||
return;
|
||||
|
||||
light.On = !light.On;
|
||||
|
||||
// WD START
|
||||
var data = new NetworkPayload
|
||||
{
|
||||
{DeviceNetworkConstants.LogicState, light.On ? SignalState.High : SignalState.Low}
|
||||
};
|
||||
_signalSystem.InvokePort(uid, light.StatusPort, data);
|
||||
// WD END
|
||||
|
||||
UpdateLight(uid, light);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,3 +154,9 @@
|
||||
id: ChemMasterSender
|
||||
name: Раздатчик
|
||||
description: Передатчик сигнала ХимМастера
|
||||
|
||||
- type: sourcePort
|
||||
id: LightStatus
|
||||
name: Статус светильника
|
||||
description: Этот порт вызывается всякий раз, когда меняется статус светильника
|
||||
defaultLinks: [ Toggle ]
|
||||
|
||||
@@ -92,6 +92,9 @@
|
||||
receiveFrequencyId: SmartLight
|
||||
- type: WirelessNetworkConnection
|
||||
range: 200
|
||||
- type: DeviceLinkSource
|
||||
ports:
|
||||
- LightStatus
|
||||
- type: DeviceLinkSink
|
||||
ports:
|
||||
- On
|
||||
@@ -287,6 +290,9 @@
|
||||
on: base
|
||||
broken: broken
|
||||
burned: burned
|
||||
- type: DeviceLinkSource
|
||||
ports:
|
||||
- LightStatus
|
||||
- type: DeviceLinkSink
|
||||
ports:
|
||||
- On
|
||||
|
||||
@@ -95,6 +95,9 @@
|
||||
receiveFrequencyId: SmartLight
|
||||
- type: WirelessNetworkConnection
|
||||
range: 200
|
||||
- type: DeviceLinkSource
|
||||
ports:
|
||||
- LightStatus
|
||||
- type: DeviceLinkSink
|
||||
ports:
|
||||
- On
|
||||
|
||||
Reference in New Issue
Block a user