mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
Identity Mask now updates equipped Agent ID name (#42772)
* add identity mask updating agent id functionality * fix indentation * add check for voice mask item * use ChangeIDName field instead * Minor cleanup * remove trycomp --------- Co-authored-by: beck-thompson <beck314159@hotmail.com>
This commit is contained in:
@@ -11,10 +11,12 @@ using Content.Shared.Roles;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Clothing.Systems;
|
using Content.Server.Clothing.Systems;
|
||||||
using Content.Server.Implants;
|
using Content.Server.Implants;
|
||||||
|
using Content.Server.VoiceMask;
|
||||||
using Content.Shared.Implants;
|
using Content.Shared.Implants;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Lock;
|
using Content.Shared.Lock;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
|
using Content.Shared.VoiceMask;
|
||||||
|
|
||||||
namespace Content.Server.Access.Systems
|
namespace Content.Server.Access.Systems
|
||||||
{
|
{
|
||||||
@@ -39,6 +41,7 @@ namespace Content.Server.Access.Systems
|
|||||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobChangedMessage>(OnJobChanged);
|
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobChangedMessage>(OnJobChanged);
|
||||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobIconChangedMessage>(OnJobIconChanged);
|
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobIconChangedMessage>(OnJobIconChanged);
|
||||||
SubscribeLocalEvent<AgentIDCardComponent, InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent>>(OnChameleonControllerOutfitChangedItem);
|
SubscribeLocalEvent<AgentIDCardComponent, InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent>>(OnChameleonControllerOutfitChangedItem);
|
||||||
|
SubscribeLocalEvent<AgentIDCardComponent, InventoryRelayedEvent<VoiceMaskNameUpdatedEvent>>(OnVoiceMaskNameChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnChameleonControllerOutfitChangedItem(Entity<AgentIDCardComponent> ent, ref InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent> args)
|
private void OnChameleonControllerOutfitChangedItem(Entity<AgentIDCardComponent> ent, ref InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent> args)
|
||||||
@@ -80,6 +83,17 @@ namespace Content.Server.Access.Systems
|
|||||||
_chameleon.SetSelectedPrototype(ent, comp.IdCard);
|
_chameleon.SetSelectedPrototype(ent, comp.IdCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnVoiceMaskNameChanged(Entity<AgentIDCardComponent> ent, ref InventoryRelayedEvent<VoiceMaskNameUpdatedEvent> args)
|
||||||
|
{
|
||||||
|
if (!TryComp<IdCardComponent>(ent, out var idCard))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!args.Args.VoiceMask.Comp.ChangeIDName)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_cardSystem.TryChangeFullName(ent, args.Args.NewName, idCard);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnAfterInteract(EntityUid uid, AgentIDCardComponent component, AfterInteractEvent args)
|
private void OnAfterInteract(EntityUid uid, AgentIDCardComponent component, AfterInteractEvent args)
|
||||||
{
|
{
|
||||||
if (args.Target == null || !args.CanReach || _lock.IsLocked(uid) ||
|
if (args.Target == null || !args.CanReach || _lock.IsLocked(uid) ||
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Content.Shared.Light;
|
|||||||
using Content.Shared.Light.EntitySystems;
|
using Content.Shared.Light.EntitySystems;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
using Content.Shared.PDA.Ringer;
|
using Content.Shared.PDA.Ringer;
|
||||||
|
using Content.Shared.VoiceMask;
|
||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -58,10 +59,11 @@ namespace Content.Server.PDA
|
|||||||
SubscribeLocalEvent<StationRenamedEvent>(OnStationRenamed);
|
SubscribeLocalEvent<StationRenamedEvent>(OnStationRenamed);
|
||||||
SubscribeLocalEvent<EntityRenamedEvent>(OnEntityRenamed, after: new[] { typeof(IdCardSystem) });
|
SubscribeLocalEvent<EntityRenamedEvent>(OnEntityRenamed, after: new[] { typeof(IdCardSystem) });
|
||||||
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
||||||
SubscribeLocalEvent<PdaComponent, InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent>>(ChameleonControllerOutfitItemSelected);
|
SubscribeLocalEvent<PdaComponent, InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent>>(OnRelayedEventToIdCard);
|
||||||
|
SubscribeLocalEvent<PdaComponent, InventoryRelayedEvent<VoiceMaskNameUpdatedEvent>>(OnRelayedEventToIdCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChameleonControllerOutfitItemSelected(Entity<PdaComponent> ent, ref InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent> args)
|
private void OnRelayedEventToIdCard<T>(Entity<PdaComponent> ent, ref InventoryRelayedEvent<T> args)
|
||||||
{
|
{
|
||||||
// Relay it to your ID so it can update as well.
|
// Relay it to your ID so it can update as well.
|
||||||
if (ent.Comp.ContainedId != null)
|
if (ent.Comp.ContainedId != null)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using Content.Shared.Standing;
|
|||||||
using Content.Shared.Strip.Components;
|
using Content.Shared.Strip.Components;
|
||||||
using Content.Shared.Temperature;
|
using Content.Shared.Temperature;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.VoiceMask;
|
||||||
using Content.Shared.Weapons.Ranged.Events;
|
using Content.Shared.Weapons.Ranged.Events;
|
||||||
using Content.Shared.Wieldable;
|
using Content.Shared.Wieldable;
|
||||||
using Content.Shared.Zombies;
|
using Content.Shared.Zombies;
|
||||||
@@ -57,6 +58,7 @@ public partial class InventorySystem
|
|||||||
SubscribeLocalEvent<InventoryComponent, IsEquippingTargetAttemptEvent>(RelayInventoryEvent);
|
SubscribeLocalEvent<InventoryComponent, IsEquippingTargetAttemptEvent>(RelayInventoryEvent);
|
||||||
SubscribeLocalEvent<InventoryComponent, IsUnequippingTargetAttemptEvent>(RelayInventoryEvent);
|
SubscribeLocalEvent<InventoryComponent, IsUnequippingTargetAttemptEvent>(RelayInventoryEvent);
|
||||||
SubscribeLocalEvent<InventoryComponent, ChameleonControllerOutfitSelectedEvent>(RelayInventoryEvent);
|
SubscribeLocalEvent<InventoryComponent, ChameleonControllerOutfitSelectedEvent>(RelayInventoryEvent);
|
||||||
|
SubscribeLocalEvent<InventoryComponent, VoiceMaskNameUpdatedEvent>(RelayInventoryEvent);
|
||||||
SubscribeLocalEvent<InventoryComponent, BeforeEmoteEvent>(RelayInventoryEvent);
|
SubscribeLocalEvent<InventoryComponent, BeforeEmoteEvent>(RelayInventoryEvent);
|
||||||
SubscribeLocalEvent<InventoryComponent, StoodEvent>(RelayInventoryEvent);
|
SubscribeLocalEvent<InventoryComponent, StoodEvent>(RelayInventoryEvent);
|
||||||
SubscribeLocalEvent<InventoryComponent, DownedEvent>(RelayInventoryEvent);
|
SubscribeLocalEvent<InventoryComponent, DownedEvent>(RelayInventoryEvent);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Shared.Speech;
|
using Content.Shared.Speech;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.VoiceMask;
|
namespace Content.Shared.VoiceMask;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This component is for voice mask items! Adding this component to clothing will give the the voice mask UI
|
/// This component is for voice mask items! Adding this component to clothing will give the the voice mask UI
|
||||||
@@ -55,5 +55,11 @@ public sealed partial class VoiceMaskComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField]
|
||||||
public bool AccentHide = true;
|
public bool AccentHide = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If user's equipped agent id name is getting changed.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public bool ChangeIDName = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
|
using Content.Shared.Inventory;
|
||||||
|
|
||||||
namespace Content.Shared.VoiceMask;
|
namespace Content.Shared.VoiceMask;
|
||||||
|
|
||||||
@@ -9,8 +10,11 @@ public sealed partial class VoiceMaskSetNameEvent : InstantActionEvent
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised on an entity when their voice masks name is updated
|
/// Raised on an entity when their voice masks name is updated
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="VoiceMaskUid">Uid of the voice mask</param>
|
/// <param name="VoiceMask">VoiceMask component</param>
|
||||||
/// <param name="OldName">The old name</param>
|
/// <param name="OldName">The old name</param>
|
||||||
/// <param name="NewName">The new name</param>
|
/// <param name="NewName">The new name</param>
|
||||||
[ByRefEvent]
|
[ByRefEvent]
|
||||||
public readonly record struct VoiceMaskNameUpdatedEvent(EntityUid VoiceMaskUid, string? OldName, string NewName);
|
public readonly record struct VoiceMaskNameUpdatedEvent(Entity<VoiceMaskComponent> VoiceMask, string? OldName, string NewName) : IInventoryRelayEvent
|
||||||
|
{
|
||||||
|
SlotFlags IInventoryRelayEvent.TargetSlots => SlotFlags.WITHOUT_POCKET;
|
||||||
|
}
|
||||||
|
|||||||
@@ -250,6 +250,7 @@
|
|||||||
implantAction: ActionChangeVoiceMaskImplant
|
implantAction: ActionChangeVoiceMaskImplant
|
||||||
- type: VoiceMask
|
- type: VoiceMask
|
||||||
overrideIdentity: true
|
overrideIdentity: true
|
||||||
|
changeIDName: true
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
enum.VoiceMaskUIKey.Key:
|
enum.VoiceMaskUIKey.Key:
|
||||||
|
|||||||
Reference in New Issue
Block a user