Zombie Mode 𝓡𝓮𝓭𝓾𝔁 (#18199)
* zombie mode redux * the great zombie changes * fix this * 65 down to 50 * empty * Changes to address stalling * make zombie nukies no longer nukies * actually work
This commit is contained in:
@@ -1,8 +1,46 @@
|
||||
using Content.Shared.Zombies;
|
||||
using System.Linq;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Content.Shared.Zombies;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Zombies;
|
||||
|
||||
public sealed class ZombieSystem : SharedZombieSystem
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
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)
|
||||
{
|
||||
if (!HasComp<ZombieComponent>(_player.LocalPlayer?.ControlledEntity))
|
||||
return;
|
||||
|
||||
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.ZombieStatusIcon));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user