mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
Removed all unused variables i could find, built and tested on a simple upstart and clicking trough most systems. Change Loc references to localization. <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p> "using Robust.Shared.Prototypes;" to "" "[dependency] private readonly ISpriteComponent" to "" </p> </details> --- No CL this isn't player facing. --------- Co-authored-by: ilmenwe <no@mail.com>
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
|
|
using Content.Shared.NPC.Components;
|
|
using Content.Shared.NPC.Events;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.NPC.Systems;
|
|
public sealed partial class NpcFactionSpriteStateSetterSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly EntityManager _entityManager = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<NpcFactionMemberComponent, NpcFactionAddedEvent>(OnFactionAdded);
|
|
}
|
|
|
|
private void OnFactionAdded(Entity<NpcFactionMemberComponent > entity, ref NpcFactionAddedEvent args)
|
|
{
|
|
if (!_entityManager.HasComponent(entity, typeof(NpcFactionSpriteStateSetterComponent)))
|
|
return;
|
|
|
|
SpriteComponent spriteComponent = _entityManager.GetComponent<SpriteComponent>(entity);
|
|
|
|
var rsi = spriteComponent.LayerGetActualRSI(0);
|
|
|
|
if(rsi != null && rsi.TryGetState(args.FactionID, out _))
|
|
spriteComponent.LayerSetState(0, new Robust.Client.Graphics.RSI.StateId(args.FactionID));
|
|
}
|
|
}
|