Skip to content

Commit

Permalink
Merge branch 'master' into 2024-09-17-vox-loadouts
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Sep 19, 2024
2 parents a883982 + bbd4841 commit 24c22a8
Show file tree
Hide file tree
Showing 16 changed files with 1,745 additions and 1,669 deletions.
8 changes: 8 additions & 0 deletions Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Content.Shared._NC.Radio; // Nuclear-14
using Robust.Server.GameObjects; // Nuclear-14
using Robust.Shared.Prototypes;
using Content.Shared.Access.Systems; // Frontier

namespace Content.Server.Radio.EntitySystems;

Expand All @@ -30,6 +31,7 @@ public sealed class RadioDeviceSystem : EntitySystem
[Dependency] private readonly InteractionSystem _interaction = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly AccessReaderSystem _access = default!; // Frontier: access

// Used to prevent a shitter from using a bunch of radios to spam chat.
private HashSet<(string, EntityUid)> _recentlySent = new();
Expand Down Expand Up @@ -250,6 +252,8 @@ private void OnToggleIntercomMic(Entity<IntercomComponent> ent, ref ToggleInterc
{
if (ent.Comp.RequiresPower && !this.IsPowered(ent, EntityManager))
return;
if (!_access.IsAllowed(args.Actor, ent.Owner)) // Frontier
return; // Frontier

SetMicrophoneEnabled(ent, args.Actor, args.Enabled, true);
ent.Comp.MicrophoneEnabled = args.Enabled;
Expand All @@ -260,6 +264,8 @@ private void OnToggleIntercomSpeaker(Entity<IntercomComponent> ent, ref ToggleIn
{
if (ent.Comp.RequiresPower && !this.IsPowered(ent, EntityManager))
return;
if (!_access.IsAllowed(args.Actor, ent.Owner)) // Frontier
return; // Frontier

SetSpeakerEnabled(ent, args.Actor, args.Enabled, true);
ent.Comp.SpeakerEnabled = args.Enabled;
Expand All @@ -270,6 +276,8 @@ private void OnSelectIntercomChannel(Entity<IntercomComponent> ent, ref SelectIn
{
if (ent.Comp.RequiresPower && !this.IsPowered(ent, EntityManager))
return;
if (!_access.IsAllowed(args.Actor, ent.Owner)) // Frontier
return; // Frontier

if (!_protoMan.TryIndex<RadioChannelPrototype>(args.Channel, out var channel) || !ent.Comp.SupportedChannels.Contains(args.Channel)) // Nuclear-14: add channel
return;
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Robust.Shared.Map;
using Robust.Shared.Utility;
using Content.Shared.UserInterface;
using Content.Shared.Access.Systems; // Frontier

namespace Content.Server.Shuttles.Systems;

Expand All @@ -37,6 +38,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
[Dependency] private readonly TagSystem _tags = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly SharedContentEyeSystem _eyeSystem = default!;
[Dependency] private readonly AccessReaderSystem _access = default!;

private EntityQuery<MetaDataComponent> _metaQuery;
private EntityQuery<TransformComponent> _xformQuery;
Expand Down Expand Up @@ -78,6 +80,8 @@ public override void Initialize()
SubscribeLocalEvent<FTLDestinationComponent, ComponentShutdown>(OnFtlDestShutdown);

InitializeFTL();

InitializeNFDrone(); // Frontier: add our drone subscriptions
}

private void OnFtlDestStartup(EntityUid uid, FTLDestinationComponent component, ComponentStartup args)
Expand Down Expand Up @@ -178,6 +182,9 @@ private bool TryPilot(EntityUid user, EntityUid uid)
return false;
}

if (!_access.IsAllowed(user, uid)) // Frontier: check access
return false; // Frontier

var pilotComponent = EnsureComp<PilotComponent>(user);
var console = pilotComponent.Console;

Expand Down
17 changes: 17 additions & 0 deletions Content.Server/_NF/Shuttles/NFDroneConsoleComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Content.Server.Shuttles.Components;

/// <summary>
/// Lets you remotely control a shuttle.
/// </summary>
[RegisterComponent]
public sealed partial class NFDroneConsoleComponent : Component
{
[DataField(required: true)]
public string Id = default!;

/// <summary>
/// <see cref="ShuttleConsoleComponent"/> that we're proxied into.
/// </summary>
[DataField]
public EntityUid? Entity;
}
11 changes: 11 additions & 0 deletions Content.Server/_NF/Shuttles/NFDroneConsoleTargetComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Content.Server.Shuttles;

/// <summary>
/// Lets you remotely control a shuttle.
/// </summary>
[RegisterComponent]
public sealed partial class NFDroneConsoleTargetComponent : Component
{
[DataField(required: true)]
public string Id = default!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Shared.UserInterface;
using Content.Shared.Shuttles.Components;

namespace Content.Server.Shuttles.Systems;

public sealed partial class ShuttleConsoleSystem
{
public void InitializeNFDrone()
{
SubscribeLocalEvent<NFDroneConsoleComponent, ConsoleShuttleEvent>(OnNFCargoGetConsole);
SubscribeLocalEvent<NFDroneConsoleComponent, AfterActivatableUIOpenEvent>(OnNFDronePilotConsoleOpen);
Subs.BuiEvents<NFDroneConsoleComponent>(ShuttleConsoleUiKey.Key, subs =>
{
subs.Event<BoundUIClosedEvent>(OnNFDronePilotConsoleClose);
});
}

/// <summary>
/// Gets the drone console target if applicable otherwise returns itself.
/// </summary>
public EntityUid? GetNFDroneConsole(EntityUid consoleUid)
{
var getShuttleEv = new ConsoleShuttleEvent
{
Console = consoleUid,
};

RaiseLocalEvent(consoleUid, ref getShuttleEv);
return getShuttleEv.Console;
}

private void OnNFDronePilotConsoleOpen(EntityUid uid, NFDroneConsoleComponent component, AfterActivatableUIOpenEvent args)
{
component.Entity = GetNFShuttleConsole(uid);
}

private void OnNFDronePilotConsoleClose(EntityUid uid, NFDroneConsoleComponent component, BoundUIClosedEvent args)
{
// Only if last person closed UI.
if (!_ui.IsUiOpen(uid, args.UiKey))
component.Entity = null;
}

private void OnNFCargoGetConsole(EntityUid uid, NFDroneConsoleComponent component, ref ConsoleShuttleEvent args)
{
args.Console = GetNFShuttleConsole(uid, component);
}

/// <summary>
/// Gets the relevant shuttle console to proxy from the drone console.
/// </summary>
private EntityUid? GetNFShuttleConsole(EntityUid uid, NFDroneConsoleComponent? sourceComp = null)
{
if (!Resolve(uid, ref sourceComp))
return null;

var query = AllEntityQuery<ShuttleConsoleComponent, NFDroneConsoleTargetComponent>();

while (query.MoveNext(out var cUid, out _, out var targetComp))
{
if (sourceComp.Id == targetComp.Id)
return cUid;
}

return null;
}
}
14 changes: 14 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7056,3 +7056,17 @@ Entries:
message: The PAL can now choose between a jumpsuit and jumpskirt.
id: 5283
time: '2024-09-18T04:12:12.0000000+00:00'
- author: whatston3
changes:
- type: Add
message: >-
An extra radar has been added to the Frontier Outpost bridge to monitor
Trade Outpost traffic.
- type: Add
message: >-
The STC now has an off-base office in the Trade Outpost near the gravity
generator.
- type: Fix
message: The SR's main office door is now accessible by the STC.
id: 5284
time: '2024-09-18T22:30:44.0000000+00:00'
Loading

0 comments on commit 24c22a8

Please sign in to comment.