Lock Anomaly generator to research access (#24464)

* small patch

* fix

* remove garbage

* fix

* moved to shared events

* fix

* LocId

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Ed
2024-02-01 11:45:24 +03:00
committed by GitHub
parent f3ff35dcfa
commit 498ad2d5d7
42 changed files with 142 additions and 92 deletions

View File

@@ -1,6 +1,6 @@
using Content.Server.Access.Components;
using Content.Server.Popups;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Interaction;

View File

@@ -1,5 +1,5 @@
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Arcade;
using Robust.Server.GameObjects;
using Robust.Shared.Player;

View File

@@ -1,5 +1,5 @@
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;

View File

@@ -4,7 +4,7 @@ using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Cargo.Systems;
using Content.Server.Explosion.EntitySystems;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Actions;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;

View File

@@ -14,7 +14,7 @@ using Content.Shared.Atmos.Piping.Unary.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Content.Server.Power.EntitySystems;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Examine;

View File

@@ -6,7 +6,7 @@ using Content.Server.Inventory;
using Content.Server.Popups;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access.Systems;
using Content.Shared.Bed.Cryostorage;
using Content.Shared.Chat;

View File

@@ -5,7 +5,7 @@ using Content.Server.DeviceLinking.Systems;
using Content.Server.Medical.Components;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Cloning;
using Content.Shared.Cloning.CloningConsole;
using Content.Shared.Database;

View File

@@ -1,11 +1,10 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceLinking.Events;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access.Systems;
using Content.Shared.MachineLinking;
using Content.Shared.TextScreen;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Timing;

View File

@@ -2,7 +2,6 @@ using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.DeviceLinking.Systems;
using Content.Server.DeviceNetwork.Components;
using Content.Server.UserInterface;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Database;
@@ -13,6 +12,7 @@ using Content.Shared.DeviceNetwork.Systems;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.UserInterface;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.Audio;

View File

@@ -3,7 +3,7 @@ using Content.Server.Drone.Components;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Popups;
using Content.Server.Tools.Innate;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Body.Components;
using Content.Shared.Drone;
using Content.Shared.Emoting;

View File

@@ -1,5 +1,5 @@
using Content.Shared.Eye.Blinding;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Server.Popups;
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.Eye.Blinding.Systems;

View File

@@ -8,7 +8,7 @@ using Content.Server.Paper;
using Content.Server.Popups;
using Content.Server.Power.Components;
using Content.Server.Tools;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Administration.Logs;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Database;

View File

@@ -2,7 +2,7 @@ using System.Linq;
using System.Text;
using Content.Server.Paper;
using Content.Server.Popups;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.DoAfter;
using Content.Shared.Forensics;
using Content.Shared.Hands.EntitySystems;

View File

@@ -1,6 +1,6 @@
using Content.Server.Gateway.Components;
using Content.Server.Station.Systems;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access.Systems;
using Content.Shared.Gateway;
using Content.Shared.Popups;

View File

@@ -8,7 +8,7 @@ using Content.Server.Materials;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Stack;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.Lathe;

View File

@@ -1,7 +1,8 @@
using Content.Server.Lock.Components;
using Content.Server.Popups;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Lock;
using Content.Server.UserInterface;
namespace Content.Server.Lock.EntitySystems;
public sealed class ActivatableUIRequiresLockSystem : EntitySystem

View File

@@ -1,7 +1,7 @@
using System.Linq;
using Content.Server.DoAfter;
using Content.Server.Humanoid;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.DoAfter;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;

View File

@@ -13,7 +13,7 @@ using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Temperature.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;

View File

@@ -1,12 +1,12 @@
using Content.Server.Administration.Logs;
using Content.Server.Administration.Logs;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Popups;
using Content.Server.UserInterface;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Database;
using Content.Shared.NukeOps;
using Content.Shared.UserInterface;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;

View File

@@ -1,7 +1,7 @@
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Popups;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.Interaction;

View File

@@ -1,8 +1,9 @@
using Content.Shared.Popups;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using JetBrains.Annotations;
using Content.Shared.Wires;
using Content.Server.UserInterface;
namespace Content.Server.Power.EntitySystems;

View File

@@ -6,7 +6,7 @@ using Content.Server.Power.EntitySystems;
using Content.Server.Radio.Components;
using Content.Server.Speech;
using Content.Server.Speech.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Chat;
using Content.Shared.Examine;
using Content.Shared.Interaction;

View File

@@ -1,6 +1,6 @@
using Content.Server.Power.EntitySystems;
using Content.Server.Research.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access.Components;
using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;

View File

@@ -1,6 +1,6 @@
using Content.Server.Research.Systems;
using Content.Server.Research.Systems;
using Content.Server.Research.TechnologyDisk.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Research;
using Content.Shared.Research.Components;
using Robust.Server.Audio;

View File

@@ -4,7 +4,7 @@ using Content.Server.DeviceNetwork.Components;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access;
using Content.Shared.CCVar;
using Content.Shared.Database;

View File

@@ -1,7 +1,7 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
namespace Content.Server.Shuttles.Systems;

View File

@@ -20,6 +20,7 @@ using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Shared.UserInterface;
namespace Content.Server.Shuttles.Systems;

View File

@@ -1,5 +1,5 @@
using System.Linq;
using Content.Server.UserInterface;
using System.Linq;
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.NameIdentifier;
using Content.Shared.PowerCell.Components;

View File

@@ -1,9 +1,9 @@
using Content.Server.Actions;
using Content.Server.Actions;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Hands.Systems;
using Content.Server.PowerCell;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access.Systems;
using Content.Shared.Alert;
using Content.Shared.Database;

View File

@@ -1,6 +1,6 @@
using Content.Server.Explosion.EntitySystems;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Sound.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Sound;
using Robust.Shared.Random;

View File

@@ -4,13 +4,12 @@ using Content.Server.Administration.Logs;
using Content.Server.PDA.Ringer;
using Content.Server.Stack;
using Content.Server.Store.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Store;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;

View File

@@ -1,5 +1,5 @@
using Content.Server.Store.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.FixedPoint;
using Content.Shared.Implants.Components;
using Content.Shared.Interaction;

View File

@@ -2,7 +2,7 @@ using System.Linq;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.SurveillanceCamera;
using Robust.Server.GameObjects;
using Robust.Shared.Player;

View File

@@ -1,5 +1,6 @@
using Content.Server.PowerCell;
using Content.Shared.PowerCell;
using Content.Shared.UserInterface;
using Robust.Shared.Containers;
namespace Content.Server.UserInterface;

View File

@@ -218,53 +218,3 @@ public sealed partial class ActivatableUISystem : EntitySystem
CloseAll(uid, aui);
}
}
public sealed class ActivatableUIOpenAttemptEvent : CancellableEntityEventArgs
{
public EntityUid User { get; }
public ActivatableUIOpenAttemptEvent(EntityUid who)
{
User = who;
}
}
public sealed class UserOpenActivatableUIAttemptEvent : CancellableEntityEventArgs //have to one-up the already stroke-inducing name
{
public EntityUid User { get; }
public EntityUid Target { get; }
public UserOpenActivatableUIAttemptEvent(EntityUid who, EntityUid target)
{
User = who;
Target = target;
}
}
public sealed class AfterActivatableUIOpenEvent : EntityEventArgs
{
public EntityUid User { get; }
public readonly ICommonSession Session;
public AfterActivatableUIOpenEvent(EntityUid who, ICommonSession session)
{
User = who;
Session = session;
}
}
/// <summary>
/// This is after it's decided the user can open the UI,
/// but before the UI actually opens.
/// Use this if you need to prepare the UI itself
/// </summary>
public sealed class BeforeActivatableUIOpenEvent : EntityEventArgs
{
public EntityUid User { get; }
public BeforeActivatableUIOpenEvent(EntityUid who)
{
User = who;
}
}
public sealed class ActivatableUIPlayerChangedEvent : EntityEventArgs
{
}

View File

@@ -18,6 +18,7 @@ using Content.Shared.Emag.Systems;
using Content.Shared.Emp;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Content.Shared.UserInterface;
using Content.Shared.VendingMachines;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;

View File

@@ -5,7 +5,7 @@ using Content.Server.Administration.Logs;
using Content.Server.Construction;
using Content.Server.Construction.Components;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.GameTicking;
@@ -23,6 +23,7 @@ using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
using Content.Server.UserInterface;
namespace Content.Server.Wires;

View File

@@ -1,9 +1,8 @@
using System.Linq;
using Content.Server.Construction;
using Content.Server.Paper;
using Content.Server.Power.Components;
using Content.Server.Research.Systems;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Server.Xenoarchaeology.Equipment.Components;
using Content.Server.Xenoarchaeology.XenoArtifacts;
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;

View File

@@ -0,0 +1,11 @@
using Content.Shared.Access.Systems;
using Robust.Shared.GameStates;
namespace Content.Shared.Access.Components;
[RegisterComponent, NetworkedComponent, Access(typeof(ActivatableUIRequiresAccessSystem))]
public sealed partial class ActivatableUIRequiresAccessComponent : Component
{
[DataField]
public LocId? PopupMessage = "lock-comp-has-user-access-fail";
}

View File

@@ -0,0 +1,31 @@
using Content.Shared.Popups;
using Content.Shared.UserInterface;
using Content.Shared.Access.Components;
namespace Content.Shared.Access.Systems;
public sealed class ActivatableUIRequiresAccessSystem : EntitySystem
{
[Dependency] private readonly AccessReaderSystem _access = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ActivatableUIRequiresAccessComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
}
private void OnUIOpenAttempt(Entity<ActivatableUIRequiresAccessComponent> activatableUI, ref ActivatableUIOpenAttemptEvent args)
{
if (args.Cancelled)
return;
if (!_access.IsAllowed(args.User, activatableUI))
{
args.Cancel();
if (activatableUI.Comp.PopupMessage != null)
_popup.PopupClient(Loc.GetString(activatableUI.Comp.PopupMessage), activatableUI, args.User);
}
}
}

View File

@@ -0,0 +1,52 @@
using Robust.Shared.Player;
namespace Content.Shared.UserInterface;
public sealed class ActivatableUIOpenAttemptEvent : CancellableEntityEventArgs
{
public EntityUid User { get; }
public ActivatableUIOpenAttemptEvent(EntityUid who)
{
User = who;
}
}
public sealed class UserOpenActivatableUIAttemptEvent : CancellableEntityEventArgs //have to one-up the already stroke-inducing name
{
public EntityUid User { get; }
public EntityUid Target { get; }
public UserOpenActivatableUIAttemptEvent(EntityUid who, EntityUid target)
{
User = who;
Target = target;
}
}
public sealed class AfterActivatableUIOpenEvent : EntityEventArgs
{
public EntityUid User { get; }
public readonly ICommonSession Session;
public AfterActivatableUIOpenEvent(EntityUid who, ICommonSession session)
{
User = who;
Session = session;
}
}
/// <summary>
/// This is after it's decided the user can open the UI,
/// but before the UI actually opens.
/// Use this if you need to prepare the UI itself
/// </summary>
public sealed class BeforeActivatableUIOpenEvent : EntityEventArgs
{
public EntityUid User { get; }
public BeforeActivatableUIOpenEvent(EntityUid who)
{
User = who;
}
}
public sealed class ActivatableUIPlayerChangedEvent : EntityEventArgs
{
}

View File

@@ -296,6 +296,7 @@
acts: ["Breakage"]
- type: ActivatableUI
key: enum.AnomalyGeneratorUiKey.Key
- type: ActivatableUIRequiresAccess
- type: ActivatableUIRequiresPower
- type: UserInterface
interfaces:
@@ -318,6 +319,8 @@
- type: WiresVisuals
- type: StaticPrice
price: 5000
- type: AccessReader
access: [["Research"]]
- type: GuideHelp
guides:
- AnomalousResearch