Files
tbd-station-14/Content.Client/Anomaly/Effects/ClientInnerBodySystem.cs
Ed 92be69a5ab Anomalous infections (#31876)
* inner anomaly

* anomaly pulse action

* test anom mine

* Update anomalies.yml

* fix action cooldown

* pyro_eyes

* clientsystem

* experiments

* blya

* some telegraphy

* shock eyes!

* shadow eyes

* separate files

* frosty eyes

* fix

* flora eyes

* bluespace eyes

* flesh eyes

* redoing injction

* auto add layers

* пипяу

* new injector component

* stupid me

* nice marker injectors

* anomaly spawn on shutdown

* gravity anom

* dead anomaly spawning

* add VOX states

* sprite specific layers support

* technology anom infection

* auto detach anomalies that have moved away

* Update anomaly_injections.yml

* anomalyspawner integration

* rock anomaly!

* Update anomaly_injections.yml

* fix crash bug

* tag filter

* fix anom dublication spawns

* Update anomaly.yml

* Update InnerBodyAnomalyComponent.cs

* Update anomaly_injections.yml

* dont spawn anomalies after decay

* fix morb sprite, add end message

* gravity resprite

* admin logging, double injection fix

* make flesh and living light mobs friendly to anomaly hosts

* popups

* severity feedback

* sloth review

* A

* keep organs after gib

* punpun host

* sloth synchronization

* Update arachnid.yml

* increase infections spawnrate
2024-09-17 12:49:19 +03:00

51 lines
1.7 KiB
C#

using Content.Shared.Anomaly.Components;
using Content.Shared.Anomaly.Effects;
using Content.Shared.Body.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Anomaly.Effects;
public sealed class ClientInnerBodyAnomalySystem : SharedInnerBodyAnomalySystem
{
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;
if (!sprite.LayerMapTryGet(ent.Comp.LayerMap, out var index))
index = sprite.LayerMapReserveBlank(ent.Comp.LayerMap);
if (TryComp<BodyComponent>(ent, out var body) &&
body.Prototype is not null &&
ent.Comp.SpeciesSprites.TryGetValue(body.Prototype.Value, out var speciesSprite))
{
sprite.LayerSetSprite(index, speciesSprite);
}
else
{
sprite.LayerSetSprite(index, ent.Comp.FallbackSprite);
}
sprite.LayerSetVisible(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.Comp.LayerMap);
sprite.LayerSetVisible(index, false);
}
}