mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* working yay * fixed the thing I had removed * there it works * i know my coding I hope * Update Resources/Textures/Interface/Actions/changeling2.rsi/meta.json Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Update Content.Server/VoiceMask/VoiceMaskSystem.cs Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Update Content.Server/VoiceMask/VoiceMaskSystem.cs Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Update Content.Server/VoiceMask/VoiceMaskSystem.cs Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Update Content.Server/VoiceMask/VoiceMaskSystem.cs Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Apply suggestions from code review oh god you can just do batches oh my god Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Update changeling-catalog.ftl new line at EOF * Update changeling.yml same * Update changeling.yml line * Update StoreSystem.Ui.cs * Update StoreSystem.Ui.cs * Update StoreSystem.Ui.cs just reverted it to master * Apply suggestions from code review Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> * Update VoiceMaskSystem.cs there ya go skar * fixed the bug, yay * clean * GITHUB, DO YOUR THING * [DataField] is in the air? WRONG. * minor spelling mistake * all is well all is well sometimes * minor fix * apathy * it works * VIVE LA RÉVOLUTION * minor spelling mistake *dies* * why the fuck are high-rez vest making tests fail * stuff * NEWLINENEWLINENEWLINE * Update Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Server/VoiceMask/VoiceMaskSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --------- Co-authored-by: nomdéraisonnablementlong <you@example.com> Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> Co-authored-by: ScarKy0 <scarky0@onet.eu> Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
80 lines
2.8 KiB
C#
80 lines
2.8 KiB
C#
using Content.Shared.Chat;
|
|
using Content.Shared.IdentityManagement.Components;
|
|
using Content.Shared.Implants.Components;
|
|
using Content.Shared.Interaction.Events;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared.Store;
|
|
using Content.Shared.VoiceMask;
|
|
|
|
namespace Content.Shared.Implants;
|
|
|
|
public abstract partial class SharedSubdermalImplantSystem
|
|
{
|
|
public void InitializeRelay()
|
|
{
|
|
SubscribeLocalEvent<ImplantedComponent, MobStateChangedEvent>(RelayToImplantEvent);
|
|
SubscribeLocalEvent<ImplantedComponent, SuicideEvent>(RelayToImplantEvent);
|
|
SubscribeLocalEvent<ImplantedComponent, TransformSpeakerNameEvent>(RelayToImplantEvent);
|
|
SubscribeLocalEvent<ImplantedComponent, TransformSpeechEvent>(RelayToImplantEvent);
|
|
SubscribeLocalEvent<ImplantedComponent, SeeIdentityAttemptEvent>(RelayToImplantEvent);
|
|
SubscribeLocalEvent<ImplantedComponent, VoiceMaskToggledEvent>(RelayToImplantEvent);
|
|
|
|
// Ref relays, for when you need to write to the event!
|
|
SubscribeLocalEvent<ImplantedComponent, CurrencyInsertAttemptEvent>(RefRelayToImplantEvent);
|
|
SubscribeLocalEvent<ImplantedComponent, GetStoreEvent>(RefRelayToImplantEvent);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Relays events from the implanted to the implant.
|
|
/// </summary>
|
|
private void RelayToImplantEvent<T>(EntityUid uid, ImplantedComponent component, T args) where T : notnull
|
|
{
|
|
if (!_container.TryGetContainer(uid, ImplanterComponent.ImplantSlotId, out var implantContainer))
|
|
return;
|
|
|
|
var relayEv = new ImplantRelayEvent<T>(args, uid);
|
|
foreach (var implant in implantContainer.ContainedEntities)
|
|
{
|
|
if (args is HandledEntityEventArgs { Handled: true })
|
|
return;
|
|
|
|
RaiseLocalEvent(implant, relayEv);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Relays events from the implanted to the implant.
|
|
/// </summary>
|
|
private void RefRelayToImplantEvent<T>(Entity<ImplantedComponent> entity, ref T args) where T : notnull
|
|
{
|
|
if (!_container.TryGetContainer(entity, ImplanterComponent.ImplantSlotId, out var implantContainer))
|
|
return;
|
|
|
|
var relayEv = new ImplantRelayEvent<T>(args, entity);
|
|
foreach (var implant in implantContainer.ContainedEntities)
|
|
{
|
|
if (args is HandledEntityEventArgs { Handled: true })
|
|
return;
|
|
|
|
RaiseLocalEvent(implant, relayEv);
|
|
}
|
|
|
|
args = relayEv.Args;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Wrapper for relaying events from an implanted entity to their implants.
|
|
/// </summary>
|
|
public sealed class ImplantRelayEvent<T> where T : notnull
|
|
{
|
|
public T Args;
|
|
|
|
public readonly EntityUid ImplantedEntity;
|
|
|
|
public ImplantRelayEvent(T ev, EntityUid implantedEntity)
|
|
{
|
|
Args = ev;
|
|
ImplantedEntity = implantedEntity;
|
|
}
|
|
}
|