2023-10-04 21:47:33 -04:00
|
|
|
using System.Linq;
|
|
|
|
|
using Content.Client.Antag;
|
2023-07-25 17:31:35 -04:00
|
|
|
using Content.Shared.Humanoid;
|
|
|
|
|
using Content.Shared.StatusIcon.Components;
|
|
|
|
|
using Content.Shared.Zombies;
|
|
|
|
|
using Robust.Client.GameObjects;
|
2022-09-06 21:59:27 -04:00
|
|
|
|
|
|
|
|
namespace Content.Client.Zombies;
|
|
|
|
|
|
2023-10-04 21:47:33 -04:00
|
|
|
public sealed class ZombieSystem : AntagStatusIconSystem<ZombieComponent>
|
2022-09-06 21:59:27 -04:00
|
|
|
{
|
|
|
|
|
|
2023-07-25 17:31:35 -04:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
SubscribeLocalEvent<ZombieComponent, ComponentStartup>(OnStartup);
|
|
|
|
|
SubscribeLocalEvent<ZombieComponent, GetStatusIconsEvent>(OnGetStatusIcon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnStartup(EntityUid uid, ZombieComponent component, ComponentStartup args)
|
|
|
|
|
{
|
|
|
|
|
if (HasComp<HumanoidAppearanceComponent>(uid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!TryComp<SpriteComponent>(uid, out var sprite))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < sprite.AllLayers.Count(); i++)
|
|
|
|
|
{
|
|
|
|
|
sprite.LayerSetColor(i, component.SkinColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnGetStatusIcon(EntityUid uid, ZombieComponent component, ref GetStatusIconsEvent args)
|
|
|
|
|
{
|
2023-10-04 21:47:33 -04:00
|
|
|
GetStatusIcon(component.ZombieStatusIcon, ref args);
|
2023-07-25 17:31:35 -04:00
|
|
|
}
|
2022-09-06 21:59:27 -04:00
|
|
|
}
|