Actually make the emagging popup work properly

This commit is contained in:
Saphire
2024-11-20 09:32:50 +06:00
parent 9c666457c2
commit 44db676b24
6 changed files with 23 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
using Content.Shared.Singularity.EntitySystems; using Content.Shared.Singularity.EntitySystems;
using Content.Shared.Singularity.Components; using Content.Shared.Singularity.Components;
namespace Content.Client.Singularity.EntitySystems; namespace Content.Client.Singularity.Systems;
/// <summary> /// <summary>
/// The client-side version of <see cref="SharedEventHorizonSystem"/>. /// The client-side version of <see cref="SharedEventHorizonSystem"/>.

View File

@@ -0,0 +1,12 @@
using Content.Shared.Singularity.EntitySystems;
using Content.Shared.Singularity.Components;
namespace Content.Client.Singularity.Systems;
/// <summary>
/// The client-side version of <see cref="SharedSingularityGeneratorSystem"/>.
/// Manages <see cref="SingularityGeneratorComponent"/>s.
/// Exists to make relevant signal handlers (ie: <see cref="SharedSingularityGeneratorSystem.OnEmagged"/>) work on the client.
/// </summary>
public sealed class SingularityGeneratorSystem : SharedSingularityGeneratorSystem
{}

View File

@@ -5,7 +5,7 @@ using Robust.Client.GameObjects;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Utility; using Robust.Shared.Utility;
namespace Content.Client.Singularity.EntitySystems; namespace Content.Client.Singularity.Systems;
/// <summary> /// <summary>
/// The client-side version of <see cref="SharedSingularitySystem"/>. /// The client-side version of <see cref="SharedSingularitySystem"/>.

View File

@@ -96,6 +96,13 @@ public sealed class EmagSystem : EntitySystem
} }
} }
/// <summary>
/// Shows a popup to emag user (client side only!) and adds <see cref="EmaggedComponent"/> to the entity when handled
/// </summary>
/// <param name="UserUid">Emag user</param>
/// <param name="Handled">Did the emagging succeed? Causes a user-only popup to show on client side</param>
/// <param name="Repeatable">Can the entity be emagged more than once? Prevents adding of <see cref="EmaggedComponent"/></param>
/// <remarks>Needs to be handled in shared/client, not just the server, to actually show the emagging popup</remarks>
[ByRefEvent] [ByRefEvent]
public record struct GotEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); public record struct GotEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false);

View File

@@ -3,10 +3,11 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
using Content.Shared.Physics; using Content.Shared.Physics;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.GameStates;
namespace Content.Shared.Singularity.Components; namespace Content.Shared.Singularity.Components;
[RegisterComponent, AutoGenerateComponentPause, AutoGenerateComponentState] [RegisterComponent, AutoGenerateComponentPause, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class SingularityGeneratorComponent : Component public sealed partial class SingularityGeneratorComponent : Component
{ {
/// <summary> /// <summary>

View File

@@ -22,7 +22,6 @@ public abstract class SharedSingularityGeneratorSystem : EntitySystem
private void OnEmagged(EntityUid uid, SingularityGeneratorComponent component, ref GotEmaggedEvent args) private void OnEmagged(EntityUid uid, SingularityGeneratorComponent component, ref GotEmaggedEvent args)
{ {
PopupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe-disabled", ("target", uid)), uid);
component.FailsafeDisabled = true; component.FailsafeDisabled = true;
args.Handled = true; args.Handled = true;
} }