Skip to content

Commit

Permalink
Fixed signal switch (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheArturZh authored Jul 22, 2023
1 parent 4ecd6c8 commit 2a018b9
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions Content.Server/DeviceLinking/Systems/SignalSwitchSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Server.MachineLinking.System;
using Content.Shared.Audio;
using Content.Shared.DeviceLinking;
using Content.Shared.Interaction;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Player;

namespace Content.Server.DeviceLinking.Systems;

Expand Down Expand Up @@ -36,7 +32,11 @@ private void OnActivated(EntityUid uid, SignalSwitchComponent comp, ActivateInWo
return;

comp.State = !comp.State;
_appearance.SetData(uid, SignalSwitchVisuals.State, comp.State);
_deviceLink.InvokePort(uid, comp.State ? comp.OnPort : comp.OffPort);
_audio.PlayPvs(comp.ClickSound, uid);

// Invoke status port
var data = new NetworkPayload
{
[DeviceNetworkConstants.LogicState] = comp.State ? SignalState.High : SignalState.Low
Expand All @@ -48,18 +48,4 @@ private void OnActivated(EntityUid uid, SignalSwitchComponent comp, ActivateInWo
_deviceLink.InvokePort(uid, comp.StatusPort, data);
}
}

/*private void OnActivated(EntityUid uid, SignalSwitchComponent component, ActivateInWorldEvent args)
{
if (args.Handled)
return;
component.State = !component.State;
_appearance.SetData(uid, SignalSwitchVisuals.State, component.State);
_deviceLink.InvokePort(uid, component.State ? component.OnPort : component.OffPort);
_audio.PlayPvs(component.ClickSound, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(8f));
args.Handled = true;
}*/
}

0 comments on commit 2a018b9

Please sign in to comment.