forked from Grimbly-Station/Grimbly-Station
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge EE 11/10/24 (Grimbly-Station#131)
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Merges EE, do not merge.
- Loading branch information
Showing
191 changed files
with
28,432 additions
and
21,112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Content.Shared.FootPrint; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Client.FootPrint; | ||
|
||
public sealed class FootPrintsVisualizerSystem : VisualizerSystem<FootPrintComponent> | ||
{ | ||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<FootPrintComponent, ComponentInit>(OnInitialized); | ||
SubscribeLocalEvent<FootPrintComponent, ComponentShutdown>(OnShutdown); | ||
} | ||
|
||
private void OnInitialized(EntityUid uid, FootPrintComponent comp, ComponentInit args) | ||
{ | ||
if (!TryComp<SpriteComponent>(uid, out var sprite)) | ||
return; | ||
|
||
sprite.LayerMapReserveBlank(FootPrintVisualLayers.Print); | ||
UpdateAppearance(uid, comp, sprite); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, FootPrintComponent comp, ComponentShutdown args) | ||
{ | ||
if (TryComp<SpriteComponent>(uid, out var sprite) | ||
&& sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer)) | ||
sprite.RemoveLayer(layer); | ||
} | ||
|
||
private void UpdateAppearance(EntityUid uid, FootPrintComponent component, SpriteComponent sprite) | ||
{ | ||
if (!sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer) | ||
|| !TryComp<FootPrintsComponent>(component.PrintOwner, out var printsComponent) | ||
|| !TryComp<AppearanceComponent>(uid, out var appearance) | ||
|| !_appearance.TryGetData<FootPrintVisuals>(uid, FootPrintVisualState.State, out var printVisuals, appearance)) | ||
return; | ||
|
||
sprite.LayerSetState(layer, new RSI.StateId(printVisuals switch | ||
{ | ||
FootPrintVisuals.BareFootPrint => printsComponent.RightStep ? printsComponent.RightBarePrint : printsComponent.LeftBarePrint, | ||
FootPrintVisuals.ShoesPrint => printsComponent.ShoesPrint, | ||
FootPrintVisuals.SuitPrint => printsComponent.SuitPrint, | ||
FootPrintVisuals.Dragging => _random.Pick(printsComponent.DraggingPrint), | ||
_ => throw new ArgumentOutOfRangeException($"Unknown {printVisuals} parameter.") | ||
}), printsComponent.RsiPath); | ||
|
||
if (_appearance.TryGetData<Color>(uid, FootPrintVisualState.Color, out var printColor, appearance)) | ||
sprite.LayerSetColor(layer, printColor); | ||
} | ||
|
||
protected override void OnAppearanceChange (EntityUid uid, FootPrintComponent component, ref AppearanceChangeEvent args) | ||
{ | ||
if (args.Sprite is not { } sprite) | ||
return; | ||
|
||
UpdateAppearance(uid, component, sprite); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 6 additions & 86 deletions
92
Content.Server/DeltaV/Implants/SubdermalBionicSyrinxImplantSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,30 @@ | ||
using Content.Server.Administration.Logs; | ||
using Content.Server.Chat.Systems; | ||
using Content.Server.Popups; | ||
using Content.Server.VoiceMask; | ||
using Content.Shared.Database; | ||
using Content.Server.VoiceMask; | ||
using Content.Shared.Implants; | ||
using Content.Shared.Implants.Components; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Preferences; | ||
using Content.Shared.Tag; | ||
using Content.Shared.VoiceMask; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Containers; | ||
|
||
namespace Content.Server.Implants; | ||
|
||
public sealed class SubdermalBionicSyrinxImplantSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!; | ||
[Dependency] private readonly PopupSystem _popupSystem = default!; | ||
[Dependency] private readonly IAdminLogManager _adminLogger = default!; | ||
[Dependency] private readonly TagSystem _tag = default!; | ||
|
||
[ValidatePrototypeId<TagPrototype>] | ||
public const string BionicSyrinxImplant = "BionicSyrinxImplant"; | ||
|
||
private const string BionicSyrinxImplant = "BionicSyrinxImplant"; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<VoiceMaskerComponent, ImplantImplantedEvent>(OnInsert); | ||
SubscribeLocalEvent<SyrinxVoiceMaskComponent, TransformSpeakerNameEvent>(OnSpeakerNameTransform); | ||
SubscribeLocalEvent<SyrinxVoiceMaskComponent, VoiceMaskChangeNameMessage>(OnChangeName); | ||
// We need to remove the SyrinxVoiceMaskComponent from the owner before the implant | ||
// is removed, so we need to execute before the SubdermalImplantSystem. | ||
SubscribeLocalEvent<VoiceMaskerComponent, EntGotRemovedFromContainerMessage>(OnRemove, before: new[] { typeof(SubdermalImplantSystem) }); | ||
SubscribeLocalEvent<VoiceMaskComponent, ImplantImplantedEvent>(OnInsert); | ||
} | ||
|
||
private void OnInsert(EntityUid uid, VoiceMaskerComponent component, ImplantImplantedEvent args) | ||
private void OnInsert(EntityUid uid, VoiceMaskComponent component, ImplantImplantedEvent args) | ||
{ | ||
if (!args.Implanted.HasValue || | ||
!_tag.HasTag(args.Implant, BionicSyrinxImplant)) | ||
return; | ||
|
||
var voicemask = EnsureComp<SyrinxVoiceMaskComponent>(args.Implanted.Value); | ||
voicemask.VoiceName = MetaData(args.Implanted.Value).EntityName; | ||
Dirty(args.Implanted.Value, voicemask); | ||
} | ||
|
||
private void OnRemove(EntityUid uid, VoiceMaskerComponent component, EntGotRemovedFromContainerMessage args) | ||
{ | ||
if (!TryComp<SubdermalImplantComponent>(uid, out var implanted) || implanted.ImplantedEntity == null) | ||
return; | ||
|
||
RemComp<SyrinxVoiceMaskComponent>(implanted.ImplantedEntity.Value); | ||
} | ||
|
||
/// <summary> | ||
/// Copy from VoiceMaskSystem, adapted to work with SyrinxVoiceMaskComponent. | ||
/// </summary> | ||
private void OnChangeName(EntityUid uid, SyrinxVoiceMaskComponent component, VoiceMaskChangeNameMessage message) | ||
{ | ||
if (message.Name.Length > HumanoidCharacterProfile.MaxNameLength || message.Name.Length <= 0) | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-failure"), uid, message.Actor, PopupType.SmallCaution); | ||
return; | ||
} | ||
|
||
component.VoiceName = message.Name; | ||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(message.Actor):player} set voice of {ToPrettyString(uid):mask}: {component.VoiceName}"); | ||
|
||
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), uid, message.Actor); | ||
TrySetLastKnownName(uid, message.Name); | ||
UpdateUI(uid, component); | ||
} | ||
|
||
/// <summary> | ||
/// Copy from VoiceMaskSystem, adapted to work with SyrinxVoiceMaskComponent. | ||
/// </summary> | ||
private void TrySetLastKnownName(EntityUid implanted, string lastName) | ||
{ | ||
if (!HasComp<VoiceMaskComponent>(implanted) | ||
|| !TryComp<VoiceMaskerComponent>(implanted, out var maskComp)) | ||
return; | ||
|
||
maskComp.LastSetName = lastName; | ||
} | ||
|
||
/// <summary> | ||
/// Copy from VoiceMaskSystem, adapted to work with SyrinxVoiceMaskComponent. | ||
/// </summary> | ||
private void UpdateUI(EntityUid owner, SyrinxVoiceMaskComponent? component = null) | ||
{ | ||
if (!Resolve(owner, ref component, logMissing: false)) | ||
return; | ||
|
||
if (_uiSystem.TryGetOpenUi(owner, VoiceMaskUIKey.Key, out _)) | ||
_uiSystem.SetUiState(new(owner, null), VoiceMaskUIKey.Key, new VoiceMaskBuiState(component.VoiceName, null)); | ||
} | ||
|
||
/// <summary> | ||
/// Copy from VoiceMaskSystem, adapted to work with SyrinxVoiceMaskComponent. | ||
/// </summary> | ||
private void OnSpeakerNameTransform(EntityUid uid, SyrinxVoiceMaskComponent component, TransformSpeakerNameEvent args) | ||
{ | ||
if (component.Enabled) | ||
args.Name = component.VoiceName; | ||
// Update the name so it's the entities default name. You can't take it off like a voice mask so it's important! | ||
component.VoiceMaskName = Name(args.Implanted.Value); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.