SUPER CAMERA(OCHKO) (#501)
* SUPER CAMERA(OCHKO) * Удобный монитор камер и портативный мониторинг для детектива. (#25) * Улучшение мониторинга камер * Портативный монитор камер для дека * чейнжлог * Revert "Удобный монитор камер и портативный мониторинг для детектива. (#25)" This reverts commit adf35bb8f6ddd6256b18841a81b330224ebff103. * Revert "Revert "Удобный монитор камер и портативный мониторинг для детектива. (#25)"" This reverts commit bd30fe45046b7b8508e8277f8c186d03338354cd. * cleanups * its so over --------- Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com> Co-authored-by: drdth <drdtheuser@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a1f562d181
commit
3ed0f2c4bb
@@ -2,6 +2,7 @@ using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.Radio;
|
||||
using Content.Server.SurveillanceCamera;
|
||||
using Content.Server.SurveillanceCamera.Systems;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Content.Server._White.SurveillanceCamera;
|
||||
using Content.Server.SurveillanceCamera.Systems;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
namespace Content.Server.SurveillanceCamera.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[Access(typeof(SurveillanceCameraSystem), typeof(SurveillanceBodyCameraSystem))]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
using Content.Server.SurveillanceCamera.Systems;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[Access(typeof(SurveillanceCameraMonitorSystem))]
|
||||
@@ -29,14 +32,10 @@ public sealed partial class SurveillanceCameraMonitorComponent : Component
|
||||
// Set of viewers currently looking at this monitor.
|
||||
public HashSet<EntityUid> Viewers { get; } = new();
|
||||
|
||||
// Current active subnet.
|
||||
[ViewVariables]
|
||||
public string ActiveSubnet { get; set; } = default!;
|
||||
|
||||
// Known cameras in this subnet by address with name values.
|
||||
// This is cleared when the subnet is changed.
|
||||
[ViewVariables]
|
||||
public Dictionary<string, string> KnownCameras { get; } = new();
|
||||
public Dictionary<NetEntity, CameraData> KnownCameras { get; } = new();
|
||||
|
||||
[ViewVariables]
|
||||
// The subnets known by this camera monitor.
|
||||
|
||||
@@ -28,4 +28,9 @@ public sealed partial class SurveillanceCameraRouterComponent : Component
|
||||
|
||||
[DataField("setupAvailableNetworks", customTypeSerializer:typeof(PrototypeIdListSerializer<DeviceFrequencyPrototype>))]
|
||||
public List<string> AvailableNetworks { get; private set; } = new();
|
||||
|
||||
// Sunrise-start
|
||||
[DataField("subnetColor")]
|
||||
public Color SubnetColor;
|
||||
// Sunrise-end
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Speech;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Server.SurveillanceCamera.Components;
|
||||
using Robust.Shared.Player;
|
||||
using static Content.Server.Chat.Systems.ChatSystem;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
namespace Content.Server.SurveillanceCamera.Systems;
|
||||
|
||||
public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
|
||||
{
|
||||
|
||||
@@ -2,13 +2,16 @@ using System.Linq;
|
||||
using Content.Server.DeviceNetwork;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.SurveillanceCamera.Components;
|
||||
using Content.Server.SurveillanceCamera.Systems;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.UserInterface;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
namespace Content.Server.SurveillanceCamera.Systems;
|
||||
|
||||
public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
{
|
||||
@@ -28,7 +31,6 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
subs.Event<SurveillanceCameraRefreshCamerasMessage>(OnRefreshCamerasMessage);
|
||||
subs.Event<SurveillanceCameraRefreshSubnetsMessage>(OnRefreshSubnetsMessage);
|
||||
subs.Event<SurveillanceCameraDisconnectMessage>(OnDisconnectMessage);
|
||||
subs.Event<SurveillanceCameraMonitorSubnetRequestMessage>(OnSubnetRequest);
|
||||
subs.Event<SurveillanceCameraMonitorSwitchMessage>(OnSwitchMessage);
|
||||
subs.Event<BoundUIClosedEvent>(OnBoundUiClose);
|
||||
});
|
||||
@@ -87,15 +89,6 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
RefreshSubnets(uid, component);
|
||||
}
|
||||
|
||||
private void OnSubnetRequest(EntityUid uid, SurveillanceCameraMonitorComponent component,
|
||||
SurveillanceCameraMonitorSubnetRequestMessage args)
|
||||
{
|
||||
if (args.Session.AttachedEntity != null)
|
||||
{
|
||||
SetActiveSubnet(uid, args.Subnet, component);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPacketReceived(EntityUid uid, SurveillanceCameraMonitorComponent component,
|
||||
DeviceNetworkPacketEvent args)
|
||||
{
|
||||
@@ -127,28 +120,48 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
case SurveillanceCameraSystem.CameraDataMessage:
|
||||
if (!args.Data.TryGetValue(SurveillanceCameraSystem.CameraNameData, out string? name)
|
||||
|| !args.Data.TryGetValue(SurveillanceCameraSystem.CameraSubnetData, out string? subnetData)
|
||||
|| !args.Data.TryGetValue(SurveillanceCameraSystem.CameraAddressData, out string? address))
|
||||
|| !args.Data.TryGetValue(SurveillanceCameraSystem.CameraAddressData, out string? address)
|
||||
|| !args.Data.TryGetValue(SurveillanceCameraSystem.CameraUid, out EntityUid cameraUid)
|
||||
|| !args.Data.TryGetValue(SurveillanceCameraSystem.CameraSubnetColor, out Color color))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.ActiveSubnet != subnetData)
|
||||
if (!component.KnownSubnets.TryGetValue(subnetData, out var subnetAddress))
|
||||
{
|
||||
DisconnectFromSubnet(uid, subnetData);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.KnownCameras.ContainsKey(address))
|
||||
var netEntCamera = GetNetEntity(cameraUid);
|
||||
|
||||
if (!component.KnownCameras.ContainsKey(netEntCamera))
|
||||
{
|
||||
component.KnownCameras.Add(address, name);
|
||||
var coordinates = EntityCoordinates.Invalid;
|
||||
|
||||
if (TryComp<TransformComponent>(cameraUid, out var transform))
|
||||
{
|
||||
if (transform.GridUid != null)
|
||||
{
|
||||
coordinates = transform.Coordinates;
|
||||
}
|
||||
}
|
||||
|
||||
component.KnownCameras.Add(netEntCamera,
|
||||
new CameraData {
|
||||
Name = name,
|
||||
CameraAddress = address,
|
||||
SubnetAddress = subnetAddress,
|
||||
SubnetColor = color,
|
||||
Coordinates = GetNetCoordinates(coordinates)
|
||||
});
|
||||
}
|
||||
|
||||
UpdateUserInterface(uid, component);
|
||||
break;
|
||||
case SurveillanceCameraSystem.CameraSubnetData:
|
||||
if (args.Data.TryGetValue(SurveillanceCameraSystem.CameraSubnetData, out string? subnet)
|
||||
&& !component.KnownSubnets.ContainsKey(subnet))
|
||||
if (args.Data.TryGetValue(SurveillanceCameraSystem.CameraSubnetData, out string? subnet))
|
||||
{
|
||||
component.KnownSubnets.Add(subnet, args.SenderAddress);
|
||||
component.KnownSubnets.TryAdd(subnet, args.SenderAddress);
|
||||
}
|
||||
|
||||
UpdateUserInterface(uid, component);
|
||||
@@ -161,13 +174,30 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
SurveillanceCameraDisconnectMessage message)
|
||||
{
|
||||
DisconnectCamera(uid, true, component);
|
||||
// Sunrise-start
|
||||
foreach (var subnet in component.KnownSubnets)
|
||||
{
|
||||
DisconnectFromSubnet(uid, subnet.Key);
|
||||
component.KnownCameras.Clear();
|
||||
UpdateUserInterface(uid, component);
|
||||
ConnectToSubnet(uid, subnet.Key);
|
||||
}
|
||||
// Sunrise-end
|
||||
}
|
||||
|
||||
private void OnRefreshCamerasMessage(EntityUid uid, SurveillanceCameraMonitorComponent component,
|
||||
SurveillanceCameraRefreshCamerasMessage message)
|
||||
{
|
||||
component.KnownCameras.Clear();
|
||||
RequestActiveSubnetInfo(uid, component);
|
||||
// Sunrise-start
|
||||
foreach (var subnet in component.KnownSubnets)
|
||||
{
|
||||
DisconnectFromSubnet(uid, subnet.Key);
|
||||
DisconnectCamera(uid, true, component);
|
||||
component.KnownCameras.Clear();
|
||||
UpdateUserInterface(uid, component);
|
||||
ConnectToSubnet(uid, subnet.Key);
|
||||
}
|
||||
// Sunrise-end
|
||||
}
|
||||
|
||||
private void OnRefreshSubnetsMessage(EntityUid uid, SurveillanceCameraMonitorComponent component,
|
||||
@@ -181,7 +211,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
// there would be a null check here, but honestly
|
||||
// whichever one is the "latest" switch message gets to
|
||||
// do the switch
|
||||
TrySwitchCameraByAddress(uid, message.Address, component);
|
||||
TrySwitchCameraByUid(uid, GetEntity(message.CameraNetEntity), component);
|
||||
}
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, SurveillanceCameraMonitorComponent component, ref PowerChangedEvent args)
|
||||
@@ -190,7 +220,6 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
{
|
||||
RemoveActiveCamera(uid, component);
|
||||
component.NextCameraAddress = null;
|
||||
component.ActiveSubnet = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,20 +237,17 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
|
||||
private void OnBoundUiClose(EntityUid uid, SurveillanceCameraMonitorComponent component, BoundUIClosedEvent args)
|
||||
{
|
||||
if (args.Session.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RemoveViewer(uid, args.Session.AttachedEntity.Value, component);
|
||||
RemoveViewer(uid, args.Entity, component);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SendHeartbeat(EntityUid uid, SurveillanceCameraMonitorComponent? monitor = null)
|
||||
{
|
||||
if (!Resolve(uid, ref monitor)
|
||||
|| monitor.LastHeartbeatSent < _heartbeatDelay
|
||||
|| !monitor.KnownSubnets.TryGetValue(monitor.ActiveSubnet, out var subnetAddress))
|
||||
|| monitor.ActiveCamera == null
|
||||
|| !monitor.KnownCameras.TryGetValue(GetNetEntity(monitor.ActiveCamera.Value), out var cameraData))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -232,7 +258,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
{ SurveillanceCameraSystem.CameraAddressData, monitor.ActiveCameraAddress }
|
||||
};
|
||||
|
||||
_deviceNetworkSystem.QueuePacket(uid, subnetAddress, payload);
|
||||
_deviceNetworkSystem.QueuePacket(uid, cameraData.SubnetAddress, payload);
|
||||
}
|
||||
|
||||
private void DisconnectCamera(EntityUid uid, bool removeViewers, SurveillanceCameraMonitorComponent? monitor = null)
|
||||
@@ -278,28 +304,10 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
_deviceNetworkSystem.QueuePacket(uid, null, payload);
|
||||
}
|
||||
|
||||
private void SetActiveSubnet(EntityUid uid, string subnet,
|
||||
SurveillanceCameraMonitorComponent? monitor = null)
|
||||
private void RequestSubnetInfo(EntityUid uid, string subnet, SurveillanceCameraMonitorComponent? monitor = null)
|
||||
{
|
||||
if (!Resolve(uid, ref monitor)
|
||||
|| !monitor.KnownSubnets.ContainsKey(subnet))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DisconnectFromSubnet(uid, monitor.ActiveSubnet);
|
||||
DisconnectCamera(uid, true, monitor);
|
||||
monitor.ActiveSubnet = subnet;
|
||||
monitor.KnownCameras.Clear();
|
||||
UpdateUserInterface(uid, monitor);
|
||||
|
||||
ConnectToSubnet(uid, subnet);
|
||||
}
|
||||
|
||||
private void RequestActiveSubnetInfo(EntityUid uid, SurveillanceCameraMonitorComponent? monitor = null)
|
||||
{
|
||||
if (!Resolve(uid, ref monitor)
|
||||
|| !monitor.KnownSubnets.TryGetValue(monitor.ActiveSubnet, out var address))
|
||||
|| !monitor.KnownSubnets.TryGetValue(subnet, out var address))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -325,7 +333,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
};
|
||||
_deviceNetworkSystem.QueuePacket(uid, address, payload);
|
||||
|
||||
RequestActiveSubnetInfo(uid);
|
||||
RequestSubnetInfo(uid, subnet, monitor);
|
||||
}
|
||||
|
||||
private void DisconnectFromSubnet(EntityUid uid, string subnet, SurveillanceCameraMonitorComponent? monitor = null)
|
||||
@@ -415,11 +423,12 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
UpdateUserInterface(uid, monitor);
|
||||
}
|
||||
|
||||
private void TrySwitchCameraByAddress(EntityUid uid, string address,
|
||||
private void TrySwitchCameraByAddress(EntityUid uid,
|
||||
string camera,
|
||||
string subnet,
|
||||
SurveillanceCameraMonitorComponent? monitor = null)
|
||||
{
|
||||
if (!Resolve(uid, ref monitor)
|
||||
|| !monitor.KnownSubnets.TryGetValue(monitor.ActiveSubnet, out var subnetAddress))
|
||||
if (!Resolve(uid, ref monitor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -427,11 +436,11 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
var payload = new NetworkPayload()
|
||||
{
|
||||
{DeviceNetworkConstants.Command, SurveillanceCameraSystem.CameraConnectMessage},
|
||||
{SurveillanceCameraSystem.CameraAddressData, address}
|
||||
{SurveillanceCameraSystem.CameraAddressData, camera}
|
||||
};
|
||||
|
||||
monitor.NextCameraAddress = address;
|
||||
_deviceNetworkSystem.QueuePacket(uid, subnetAddress, payload);
|
||||
monitor.NextCameraAddress = camera;
|
||||
_deviceNetworkSystem.QueuePacket(uid, subnet, payload);
|
||||
}
|
||||
|
||||
// Attempts to switch over the current viewed camera on this monitor
|
||||
@@ -486,7 +495,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var state = new SurveillanceCameraMonitorUiState(GetNetEntity(monitor.ActiveCamera), monitor.KnownSubnets.Keys.ToHashSet(), monitor.ActiveCameraAddress, monitor.ActiveSubnet, monitor.KnownCameras);
|
||||
var state = new SurveillanceCameraMonitorUiState(GetNetEntity(monitor.ActiveCamera), monitor.KnownSubnets.Keys.ToHashSet(), monitor.ActiveCameraAddress, monitor.KnownCameras);
|
||||
_userInterface.TrySetUiState(uid, SurveillanceCameraMonitorUiKey.Key, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ using Content.Server.DeviceNetwork;
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.SurveillanceCamera;
|
||||
using Content.Server.SurveillanceCamera.Systems;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
@@ -10,7 +12,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
namespace Content.Server.SurveillanceCamera.Systems;
|
||||
|
||||
public sealed class SurveillanceCameraRouterSystem : EntitySystem
|
||||
{
|
||||
@@ -244,7 +246,8 @@ public sealed class SurveillanceCameraRouterSystem : EntitySystem
|
||||
var payload = new NetworkPayload()
|
||||
{
|
||||
{ DeviceNetworkConstants.Command, SurveillanceCameraSystem.CameraPingMessage },
|
||||
{ SurveillanceCameraSystem.CameraSubnetData, router.SubnetName }
|
||||
{ SurveillanceCameraSystem.CameraSubnetData, router.SubnetName },
|
||||
{ SurveillanceCameraSystem.CameraSubnetColor, router.SubnetColor}
|
||||
};
|
||||
|
||||
_deviceNetworkSystem.QueuePacket(uid, null, payload, router.SubnetFrequency);
|
||||
@@ -257,6 +260,10 @@ public sealed class SurveillanceCameraRouterSystem : EntitySystem
|
||||
{
|
||||
return;
|
||||
}
|
||||
payload[SurveillanceCameraSystem.CameraSubnetData] = router.SubnetFrequencyId;
|
||||
payload[SurveillanceCameraSystem.CameraSubnetColor] = router.SubnetColor;
|
||||
|
||||
payload[SurveillanceCameraSystem.CameraSubnetData] = router.SubnetFrequencyId;
|
||||
|
||||
foreach (var address in router.MonitorRoutes)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Content.Shared.Speech;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
namespace Content.Server.SurveillanceCamera.Systems;
|
||||
|
||||
/// <summary>
|
||||
/// This handles speech for surveillance camera monitors.
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.SurveillanceCamera.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.SurveillanceCamera;
|
||||
@@ -12,7 +13,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.SurveillanceCamera;
|
||||
namespace Content.Server.SurveillanceCamera.Systems;
|
||||
|
||||
public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
{
|
||||
@@ -47,8 +48,10 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
public const string CameraSubnetDisconnectMessage = "surveillance_camera_subnet_disconnect";
|
||||
|
||||
public const string CameraAddressData = "surveillance_camera_data_origin";
|
||||
public const string CameraUid = "surveillance_camera_data_uid";
|
||||
public const string CameraNameData = "surveillance_camera_data_name";
|
||||
public const string CameraSubnetData = "surveillance_camera_data_subnet";
|
||||
public const string CameraSubnetColor = "surveillance_camera_color_subnet";
|
||||
|
||||
public const int CameraNameLimit = 32;
|
||||
|
||||
@@ -84,7 +87,9 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
{ DeviceNetworkConstants.Command, string.Empty },
|
||||
{ CameraAddressData, deviceNet.Address },
|
||||
{ CameraNameData, component.CameraId },
|
||||
{ CameraSubnetData, string.Empty }
|
||||
{ CameraSubnetData, string.Empty },
|
||||
{ CameraSubnetColor, new Color() },
|
||||
{ CameraUid, uid }
|
||||
};
|
||||
|
||||
var dest = string.Empty;
|
||||
@@ -92,60 +97,50 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
switch (command)
|
||||
{
|
||||
case CameraConnectMessage:
|
||||
if (!args.Data.TryGetValue(CameraAddressData, out dest)
|
||||
|| string.IsNullOrEmpty(args.Address))
|
||||
{
|
||||
if (!args.Data.TryGetValue(CameraAddressData, out dest) || string.IsNullOrEmpty(args.Address))
|
||||
return;
|
||||
}
|
||||
|
||||
payload[DeviceNetworkConstants.Command] = CameraConnectMessage;
|
||||
break;
|
||||
|
||||
case CameraHeartbeatMessage:
|
||||
if (!args.Data.TryGetValue(CameraAddressData, out dest)
|
||||
|| string.IsNullOrEmpty(args.Address))
|
||||
{
|
||||
if (!args.Data.TryGetValue(CameraAddressData, out dest) || string.IsNullOrEmpty(args.Address))
|
||||
return;
|
||||
}
|
||||
|
||||
payload[DeviceNetworkConstants.Command] = CameraHeartbeatMessage;
|
||||
break;
|
||||
|
||||
case CameraPingMessage:
|
||||
if (!args.Data.TryGetValue(CameraSubnetData, out string? subnet))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Data.TryGetValue(CameraSubnetColor, out Color color))
|
||||
return;
|
||||
|
||||
dest = args.SenderAddress;
|
||||
payload[CameraSubnetData] = subnet;
|
||||
payload[CameraSubnetColor] = color;
|
||||
payload[CameraUid] = uid;
|
||||
payload[DeviceNetworkConstants.Command] = CameraDataMessage;
|
||||
break;
|
||||
}
|
||||
|
||||
_deviceNetworkSystem.QueuePacket(
|
||||
uid,
|
||||
dest,
|
||||
payload);
|
||||
_deviceNetworkSystem.QueuePacket(uid, dest, payload);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddVerbs(EntityUid uid, SurveillanceCameraComponent component, GetVerbsEvent<AlternativeVerb> verbs)
|
||||
{
|
||||
if (!_actionBlocker.CanInteract(verbs.User, uid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<SurveillanceBodyCameraComponent>(uid, out _)) // WD EDIT
|
||||
{
|
||||
if (HasComp<SurveillanceBodyCameraComponent>(uid)) // WD EDIT
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.NameSet && component.NetworkSet)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AlternativeVerb verb = new();
|
||||
var verb = new AlternativeVerb();
|
||||
verb.Text = Loc.GetString("surveillance-camera-setup");
|
||||
verb.Act = () => OpenSetupInterface(uid, verbs.User, component);
|
||||
verbs.Verbs.Add(verb);
|
||||
@@ -181,21 +176,14 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
private void OnSetNetwork(EntityUid uid, SurveillanceCameraComponent component,
|
||||
SurveillanceCameraSetupSetNetwork args)
|
||||
{
|
||||
if (args.UiKey is not SurveillanceCameraSetupUiKey key
|
||||
|| key != SurveillanceCameraSetupUiKey.Camera)
|
||||
{
|
||||
if (args.UiKey is not SurveillanceCameraSetupUiKey key || key != SurveillanceCameraSetupUiKey.Camera)
|
||||
return;
|
||||
}
|
||||
if (args.Network < 0 || args.Network >= component.AvailableNetworks.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_prototypeManager.TryIndex<DeviceFrequencyPrototype>(component.AvailableNetworks[args.Network],
|
||||
out var frequency))
|
||||
{
|
||||
if (args.Network < 0 || args.Network >= component.AvailableNetworks.Count)
|
||||
return;
|
||||
|
||||
if (!_prototypeManager.TryIndex<DeviceFrequencyPrototype>(component.AvailableNetworks[args.Network], out var frequency))
|
||||
return;
|
||||
}
|
||||
|
||||
_deviceNetworkSystem.SetReceiveFrequency(uid, frequency.Frequency);
|
||||
component.NetworkSet = true;
|
||||
@@ -206,6 +194,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
{
|
||||
if (!Resolve(uid, ref camera) || !Resolve(player, ref actor))
|
||||
return;
|
||||
|
||||
if (!_userInterface.TryGetUi(uid, SurveillanceCameraSetupUiKey.Camera, out var bui))
|
||||
return;
|
||||
|
||||
@@ -216,9 +205,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
public void UpdateSetupInterface(EntityUid uid, SurveillanceCameraComponent? camera = null, DeviceNetworkComponent? deviceNet = null)
|
||||
{
|
||||
if (!Resolve(uid, ref camera, ref deviceNet))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (camera.NameSet && camera.NetworkSet && !TryComp<SurveillanceBodyCameraComponent>(uid, out _)) // WD EDIT
|
||||
{
|
||||
@@ -249,9 +236,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem
|
||||
private void Deactivate(EntityUid camera, SurveillanceCameraComponent? component = null)
|
||||
{
|
||||
if (!Resolve(camera, ref component))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var ev = new SurveillanceCameraDeactivateEvent(camera);
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.PowerCell;
|
||||
using Content.Server.SurveillanceCamera;
|
||||
using Content.Server.SurveillanceCamera.Components;
|
||||
using Content.Server.SurveillanceCamera.Systems;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Item;
|
||||
|
||||
Reference in New Issue
Block a user