Predict two-way levers (#25043)
* Predict two-way levers Annoys me the rare occasions I touch cargo. Doesn't predict the signal but at least the lever responds immediately. * space * a
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DeviceLinking.Events;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -148,6 +149,9 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
/// </summary>
|
||||
public void EnsureSourcePorts(EntityUid uid, params string[] ports)
|
||||
{
|
||||
if (ports.Length == 0)
|
||||
return;
|
||||
|
||||
var comp = EnsureComp<DeviceLinkSourceComponent>(uid);
|
||||
comp.Ports ??= new HashSet<string>();
|
||||
|
||||
@@ -163,6 +167,9 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
/// </summary>
|
||||
public void EnsureSinkPorts(EntityUid uid, params string[] ports)
|
||||
{
|
||||
if (ports.Length == 0)
|
||||
return;
|
||||
|
||||
var comp = EnsureComp<DeviceLinkSinkComponent>(uid);
|
||||
comp.Ports ??= new HashSet<string>();
|
||||
|
||||
@@ -550,4 +557,20 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
("machine2", sinkUid), ("port2", PortName<SinkPortPrototype>(sink))), userId.Value, PopupType.Medium);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Sending & Receiving
|
||||
/// <summary>
|
||||
/// Sends a network payload directed at the sink entity.
|
||||
/// Just raises a <see cref="SignalReceivedEvent"/> without data if the source or the sink doesn't have a <see cref="DeviceNetworkComponent"/>
|
||||
/// </summary>
|
||||
/// <param name="uid">The source uid that invokes the port</param>
|
||||
/// <param name="port">The port to invoke</param>
|
||||
/// <param name="data">Optional data to send along</param>
|
||||
/// <param name="sourceComponent"></param>
|
||||
public virtual void InvokePort(EntityUid uid, string port, NetworkPayload? data = null,
|
||||
DeviceLinkSourceComponent? sourceComponent = null)
|
||||
{
|
||||
// NOOP on client for the moment.
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user