mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-06-09 10:06:46 +02:00
8cf744ec55
* initial visual nubody * oops overlay * im so pheeming rn * conversion... * tests * comeback of the underwear * oops eyes * blabbl * zeds * yaml linted * search and visible count constraints * reordering * preserve previously selected markings colors * fix test * some ui niceties * ordering * make DB changes backwards-compatible/downgrade-friendly * fix things again * fix migration * vulpkanin markings limit increase * wrapping * code cleanup and more code cleanup and more code cleanup and more code cleanup and * fix slop ports * better sampling API * make filter work + use the method i made for its intended purpose * fix test fails real quick * magic mirror cleanup, remove TODO * don't 0-init the organ profile data * remove deltastates --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using Content.Shared.Anomaly.Components;
|
|
using Content.Shared.Anomaly.Effects;
|
|
using Content.Shared.Humanoid;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Anomaly.Effects;
|
|
|
|
public sealed class ClientInnerBodyAnomalySystem : SharedInnerBodyAnomalySystem
|
|
{
|
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<InnerBodyAnomalyComponent, AfterAutoHandleStateEvent>(OnAfterHandleState);
|
|
SubscribeLocalEvent<InnerBodyAnomalyComponent, ComponentShutdown>(OnCompShutdown);
|
|
}
|
|
|
|
private void OnAfterHandleState(Entity<InnerBodyAnomalyComponent> ent, ref AfterAutoHandleStateEvent args)
|
|
{
|
|
if (!TryComp<SpriteComponent>(ent, out var sprite))
|
|
return;
|
|
|
|
if (ent.Comp.FallbackSprite is null)
|
|
return;
|
|
|
|
var index = _sprite.LayerMapReserve((ent.Owner, sprite), ent.Comp.LayerMap);
|
|
|
|
if (TryComp<HumanoidProfileComponent>(ent, out var humanoid) &&
|
|
ent.Comp.SpeciesSprites.TryGetValue(humanoid.Species, out var speciesSprite))
|
|
{
|
|
_sprite.LayerSetSprite((ent.Owner, sprite), index, speciesSprite);
|
|
}
|
|
else
|
|
{
|
|
_sprite.LayerSetSprite((ent.Owner, sprite), index, ent.Comp.FallbackSprite);
|
|
}
|
|
|
|
_sprite.LayerSetVisible((ent.Owner, sprite), index, true);
|
|
sprite.LayerSetShader(index, "unshaded");
|
|
}
|
|
|
|
private void OnCompShutdown(Entity<InnerBodyAnomalyComponent> ent, ref ComponentShutdown args)
|
|
{
|
|
if (!TryComp<SpriteComponent>(ent, out var sprite))
|
|
return;
|
|
|
|
var index = _sprite.LayerMapGet((ent.Owner, sprite), ent.Comp.LayerMap);
|
|
_sprite.LayerSetVisible((ent.Owner, sprite), index, false);
|
|
}
|
|
}
|