Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seperate EMAG into EMAG and Authentication Disruptor #34337

Merged
merged 37 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a9a319e
Init
ScarKy0 Jan 9, 2025
afc48a4
further stuff
ScarKy0 Jan 9, 2025
fbfdda5
Cleanup
ScarKy0 Jan 9, 2025
50217e8
cleaning
ScarKy0 Jan 9, 2025
6ca5af0
stfu YAML Linter
ScarKy0 Jan 9, 2025
73d6c02
Merge branch 'master' into access-breaker
ScarKy0 Jan 10, 2025
ef552fb
oops
ScarKy0 Jan 10, 2025
3f4653c
sprite!
ScarKy0 Jan 19, 2025
b20817c
oops
ScarKy0 Jan 19, 2025
af3af29
I would never web edit
ScarKy0 Jan 20, 2025
95cd740
I hate it here
ScarKy0 Jan 26, 2025
d18d046
+ cryopod, disposal, ninja | - access breaker
ScarKy0 Jan 26, 2025
aed0b06
+ CloneMachine, FireAlarm, Fax
ScarKy0 Jan 26, 2025
f1611aa
refactor refactor
ScarKy0 Jan 27, 2025
0ef5a7b
+ Disposal Unit
ScarKy0 Jan 27, 2025
65e110c
+ Cryopod
ScarKy0 Jan 27, 2025
916530d
+ Vape and comments
ScarKy0 Jan 27, 2025
20a0e83
+ Stasis Bed
ScarKy0 Jan 27, 2025
9d28644
+ Cloning Pod, Fire Alarm
ScarKy0 Jan 27, 2025
e1fbd5c
+ Fat Extractor, Fax
ScarKy0 Jan 27, 2025
1dc62b6
+ APC, Cyborgs
ScarKy0 Jan 27, 2025
91f7179
+ Vending Machines
ScarKy0 Jan 28, 2025
a08b02a
+ Lathes
ScarKy0 Jan 28, 2025
1358dd9
+ PDA Lights
ScarKy0 Jan 28, 2025
5a4c324
+ Material Reclaimer
ScarKy0 Jan 29, 2025
475186d
+ Pinpointer
ScarKy0 Jan 29, 2025
60e33f3
+ Medibot
ScarKy0 Jan 29, 2025
721747f
pinpointer cleanup
ScarKy0 Jan 29, 2025
d4d7927
+ Singulo Gen
ScarKy0 Jan 29, 2025
2c9d2c2
+ Artifact Crusher
ScarKy0 Jan 29, 2025
7e3afd2
+ Cargo Console
ScarKy0 Jan 29, 2025
042a876
+ Comms Console
ScarKy0 Jan 29, 2025
ba5963e
+ Research Console
ScarKy0 Jan 29, 2025
cb7ab90
+ Access Wire
ScarKy0 Jan 29, 2025
b21a841
Final cleanup (I HOPE)
ScarKy0 Jan 29, 2025
cd9e574
Merge branch 'master' into access-breaker
ScarKy0 Jan 29, 2025
bcb8f61
something something ✨ clean ✨
ScarKy0 Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Content.Server/Access/AccessWireAction.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Server.Wires;
using Content.Shared.Access;
using Content.Shared.Access.Components;
using Content.Shared.Emag.Components;
using Content.Shared.Wires;

namespace Content.Server.Access;
Expand Down Expand Up @@ -31,11 +30,9 @@ public override bool Cut(EntityUid user, Wire wire, AccessReaderComponent comp)

public override bool Mend(EntityUid user, Wire wire, AccessReaderComponent comp)
{
if (!EntityManager.HasComponent<EmaggedComponent>(wire.Owner))
{
comp.Enabled = true;
EntityManager.Dirty(wire.Owner, comp);
}
comp.Enabled = true;
EntityManager.Dirty(wire.Owner, comp);

return true;
}

Expand All @@ -58,7 +55,7 @@ private void AwaitPulseCancel(Wire wire)
{
if (!wire.IsCut)
{
if (EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var access) && !EntityManager.HasComponent<EmaggedComponent>(wire.Owner))
if (EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var access))
{
access.Enabled = true;
EntityManager.Dirty(wire.Owner, access);
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Access/Systems/AccessOverriderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid,
$"{ToPrettyString(player):player} has modified {ToPrettyString(accessReaderEnt.Value):entity} with the following allowed access level holders: [{string.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]");

accessReaderEnt.Value.Comp.AccessLists = ConvertAccessListToHashSet(newAccessList);

var ev = new OnAccessOverriderAccessUpdatedEvent(player);
RaiseLocalEvent(component.TargetAccessReaderId, ref ev);

Dirty(accessReaderEnt.Value);
}

Expand Down
7 changes: 5 additions & 2 deletions Content.Server/Anomaly/Effects/TechAnomalySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ private void OnSupercritical(Entity<TechAnomalyComponent> tech, ref AnomalySuper

if (_random.Prob(tech.Comp.EmagSupercritProbability))
{
_emag.DoEmagEffect(tech, source);
_emag.DoEmagEffect(tech, sink);
var sourceEv = new GotEmaggedEvent(tech, EmagType.Access | EmagType.Interaction);
RaiseLocalEvent(source, ref sourceEv);

var sinkEv = new GotEmaggedEvent(tech, EmagType.Access | EmagType.Interaction);
RaiseLocalEvent(sink, ref sinkEv);
}

CreateNewLink(tech, source, sink);
Expand Down
20 changes: 14 additions & 6 deletions Content.Server/Atmos/Monitor/Systems/FireAlarmSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public sealed class FireAlarmSystem : EntitySystem
{
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNet = default!;
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly AccessReaderSystem _access = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
Expand Down Expand Up @@ -77,11 +78,18 @@ private void OnInteractHand(EntityUid uid, FireAlarmComponent component, Interac

private void OnEmagged(EntityUid uid, FireAlarmComponent component, ref GotEmaggedEvent args)
{
if (TryComp<AtmosAlarmableComponent>(uid, out var alarmable))
{
// Remove the atmos alarmable component permanently from this device.
_atmosAlarmable.ForceAlert(uid, AtmosAlarmType.Emagged, alarmable);
RemCompDeferred<AtmosAlarmableComponent>(uid);
}
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(uid, EmagType.Interaction))
return;

if (!TryComp<AtmosAlarmableComponent>(uid, out var alarmable))
return;

// Remove the atmos alarmable component permanently from this device.
_atmosAlarmable.ForceAlert(uid, AtmosAlarmType.Emagged, alarmable);
RemCompDeferred<AtmosAlarmableComponent>(uid);
args.Handled = true;
}
}
8 changes: 7 additions & 1 deletion Content.Server/Bed/BedSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public sealed class BedSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly SleepingSystem _sleepingSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
Expand Down Expand Up @@ -114,7 +115,12 @@ private void OnPowerChanged(EntityUid uid, StasisBedComponent component, ref Pow

private void OnEmagged(EntityUid uid, StasisBedComponent component, ref GotEmaggedEvent args)
{
args.Repeatable = true;
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(uid, EmagType.Interaction))
return;

// Reset any metabolisms first so they receive the multiplier correctly
UpdateMetabolisms(uid, component, false);
component.Multiplier = 1 / component.Multiplier;
Expand Down
17 changes: 15 additions & 2 deletions Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Content.Shared.Cargo.Events;
using Content.Shared.Cargo.Prototypes;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Paper;
Expand All @@ -21,6 +21,7 @@ namespace Content.Server.Cargo.Systems
public sealed partial class CargoSystem
{
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly EmagSystem _emag = default!;

/// <summary>
/// How much time to wait (in seconds) before increasing bank accounts balance.
Expand All @@ -41,6 +42,7 @@ private void InitializeConsole()
SubscribeLocalEvent<CargoOrderConsoleComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<CargoOrderConsoleComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<CargoOrderConsoleComponent, BankBalanceUpdatedEvent>(OnOrderBalanceUpdated);
SubscribeLocalEvent<CargoOrderConsoleComponent, GotEmaggedEvent>(OnEmagged);
Reset();
}

Expand Down Expand Up @@ -75,6 +77,17 @@ private void Reset()
_timer = 0;
}

private void OnEmagged(Entity<CargoOrderConsoleComponent> ent, ref GotEmaggedEvent args)
{
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(ent, EmagType.Interaction))
return;

args.Handled = true;
}

private void UpdateConsole(float frameTime)
{
_timer += frameTime;
Expand Down Expand Up @@ -192,7 +205,7 @@ private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent com
order.Approved = true;
_audio.PlayPvs(component.ConfirmSound, uid);

if (!HasComp<EmaggedComponent>(uid))
if (!_emag.CheckFlag(uid, EmagType.Interaction))
{
var tryGetIdentityShortInfoEvent = new TryGetIdentityShortInfoEvent(uid, player);
RaiseLocalEvent(tryGetIdentityShortInfoEvent);
Expand Down
12 changes: 9 additions & 3 deletions Content.Server/Cloning/CloningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public sealed class CloningSystem : EntitySystem
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
[Dependency] private readonly EmagSystem _emag = default!;

public readonly Dictionary<MindComponent, EntityUid> ClonesWaitingForMind = new();
public const float EasyModeCloningCost = 0.7f;
Expand Down Expand Up @@ -276,10 +277,15 @@ public override void Update(float frameTime)
/// </summary>
private void OnEmagged(EntityUid uid, CloningPodComponent clonePod, ref GotEmaggedEvent args)
{
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(uid, EmagType.Interaction))
return;

if (!this.IsPowered(uid, EntityManager))
return;

_audio.PlayPvs(clonePod.SparkSound, uid);
_popupSystem.PopupEntity(Loc.GetString("cloning-pod-component-upgrade-emag-requirement"), uid);
args.Handled = true;
}
Expand Down Expand Up @@ -309,7 +315,7 @@ private void EndFailedCloning(EntityUid uid, CloningPodComponent clonePod)
var indices = _transformSystem.GetGridTilePositionOrDefault((uid, transform));
var tileMix = _atmosphereSystem.GetTileMixture(transform.GridUid, null, indices, true);

if (HasComp<EmaggedComponent>(uid))
if (_emag.CheckFlag(uid, EmagType.Interaction))
{
_audio.PlayPvs(clonePod.ScreamSound, uid);
Spawn(clonePod.MobSpawnId, transform.Coordinates);
Expand All @@ -327,7 +333,7 @@ private void EndFailedCloning(EntityUid uid, CloningPodComponent clonePod)
}
_puddleSystem.TrySpillAt(uid, bloodSolution, out _);

if (!HasComp<EmaggedComponent>(uid))
if (!_emag.CheckFlag(uid, EmagType.Interaction))
{
_material.SpawnMultipleFromMaterial(_robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)), clonePod.RequiredMaterial, Transform(uid).Coordinates);
}
Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Content.Shared.Communications;
using Content.Shared.Database;
using Content.Shared.DeviceNetwork;
using Content.Shared.Emag.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
Expand Down Expand Up @@ -177,7 +176,7 @@ private static bool CanAnnounce(CommunicationsConsoleComponent comp)

private bool CanUse(EntityUid user, EntityUid console)
{
if (TryComp<AccessReaderComponent>(console, out var accessReaderComponent) && !HasComp<EmaggedComponent>(console))
if (TryComp<AccessReaderComponent>(console, out var accessReaderComponent))
{
return _accessReaderSystem.IsAllowed(user, console, accessReaderComponent);
}
Expand Down
14 changes: 10 additions & 4 deletions Content.Server/Fax/FaxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public sealed class FaxSystem : EntitySystem
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly FaxecuteSystem _faxecute = default!;
[Dependency] private readonly EmagSystem _emag = default!;

private const string PaperSlotId = "Paper";

Expand Down Expand Up @@ -227,7 +228,7 @@ private void OnInteractUsing(EntityUid uid, FaxMachineComponent component, Inter
return;
}

if (component.KnownFaxes.ContainsValue(newName) && !HasComp<EmaggedComponent>(uid)) // Allow existing names if emagged for fun
if (component.KnownFaxes.ContainsValue(newName) && !_emag.CheckFlag(uid, EmagType.Interaction)) // Allow existing names if emagged for fun
{
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-name-exist"), uid);
return;
Expand All @@ -246,7 +247,12 @@ private void OnInteractUsing(EntityUid uid, FaxMachineComponent component, Inter

private void OnEmagged(EntityUid uid, FaxMachineComponent component, ref GotEmaggedEvent args)
{
_audioSystem.PlayPvs(component.EmagSound, uid);
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(uid, EmagType.Interaction))
return;

args.Handled = true;
}

Expand All @@ -260,7 +266,7 @@ private void OnPacketReceived(EntityUid uid, FaxMachineComponent component, Devi
switch (command)
{
case FaxConstants.FaxPingCommand:
var isForSyndie = HasComp<EmaggedComponent>(uid) &&
var isForSyndie = _emag.CheckFlag(uid, EmagType.Interaction) &&
args.Data.ContainsKey(FaxConstants.FaxSyndicateData);
if (!isForSyndie && !component.ResponsePings)
return;
Expand Down Expand Up @@ -405,7 +411,7 @@ public void Refresh(EntityUid uid, FaxMachineComponent? component = null)
{ DeviceNetworkConstants.Command, FaxConstants.FaxPingCommand }
};

if (HasComp<EmaggedComponent>(uid))
if (_emag.CheckFlag(uid, EmagType.Interaction))
payload.Add(FaxConstants.FaxSyndicateData, true);

_deviceNetworkSystem.QueuePacket(uid, null, payload);
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Lathe/LatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.Examine;
using Content.Shared.Lathe;
using Content.Shared.Materials;
Expand All @@ -42,6 +43,7 @@ public sealed class LatheSystem : SharedLatheSystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly UserInterfaceSystem _uiSys = default!;
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
[Dependency] private readonly PopupSystem _popup = default!;
Expand Down Expand Up @@ -292,7 +294,7 @@ private void GetEmagLatheRecipes(EntityUid uid, EmagLatheRecipesComponent compon
{
if (uid != args.Lathe || !TryComp<TechnologyDatabaseComponent>(uid, out var technologyDatabase))
return;
if (!args.getUnavailable && !HasComp<EmaggedComponent>(uid))
if (!args.getUnavailable && !_emag.CheckFlag(uid, EmagType.Interaction))
return;
foreach (var recipe in component.EmagDynamicRecipes)
{
Expand Down
10 changes: 8 additions & 2 deletions Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Content.Server.Nutrition.EntitySystems;
public sealed class FatExtractorSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
Expand All @@ -36,8 +37,13 @@ public override void Initialize()

private void OnGotEmagged(EntityUid uid, FatExtractorComponent component, ref GotEmaggedEvent args)
{
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(uid, EmagType.Interaction))
return;

args.Handled = true;
args.Repeatable = false;
}

private void OnClosed(EntityUid uid, FatExtractorComponent component, ref StorageAfterCloseEvent args)
Expand Down Expand Up @@ -103,7 +109,7 @@ public bool TryGetValidOccupant(EntityUid uid, [NotNullWhen(true)] out EntityUid
if (_hunger.GetHunger(hunger) < component.NutritionPerSecond)
return false;

if (hunger.CurrentThreshold < component.MinHungerThreshold && !HasComp<EmaggedComponent>(uid))
if (hunger.CurrentThreshold < component.MinHungerThreshold && !_emag.CheckFlag(uid, EmagType.Interaction))
return false;

return true;
Expand Down
10 changes: 9 additions & 1 deletion Content.Server/Nutrition/EntitySystems/SmokingSystem.Vape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public sealed partial class SmokingSystem
{
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly FoodSystem _foodSystem = default!;
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
Expand Down Expand Up @@ -63,7 +64,7 @@ private void OnVapeInteraction(Entity<VapeComponent> entity, ref AfterInteractEv
forced = false;
}

if (entity.Comp.ExplodeOnUse || HasComp<EmaggedComponent>(entity.Owner))
if (entity.Comp.ExplodeOnUse || _emag.CheckFlag(entity, EmagType.Interaction))
{
_explosionSystem.QueueExplosion(entity.Owner, "Default", entity.Comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false);
EntityManager.DeleteEntity(entity);
Expand Down Expand Up @@ -161,8 +162,15 @@ private void OnVapeDoAfter(Entity<VapeComponent> entity, ref VapeDoAfterEvent ar
args.Args.Target.Value);
}
}

private void OnEmagged(Entity<VapeComponent> entity, ref GotEmaggedEvent args)
{
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(entity, EmagType.Interaction))
return;

args.Handled = true;
}
}
Expand Down
Loading
Loading