Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anomalous infections #31876

Merged
merged 57 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9b24816
inner anomaly
TheShuEd Sep 4, 2024
b387f7a
anomaly pulse action
TheShuEd Sep 4, 2024
137c222
test anom mine
TheShuEd Sep 4, 2024
5864987
Update anomalies.yml
TheShuEd Sep 4, 2024
7c61022
fix action cooldown
TheShuEd Sep 4, 2024
d51216a
pyro_eyes
TheShuEd Sep 4, 2024
2f24f54
clientsystem
TheShuEd Sep 4, 2024
c860bed
experiments
TheShuEd Sep 4, 2024
db01be8
blya
TheShuEd Sep 4, 2024
6dfb4c2
some telegraphy
TheShuEd Sep 4, 2024
35154bf
shock eyes!
TheShuEd Sep 4, 2024
675de40
shadow eyes
TheShuEd Sep 5, 2024
103ab04
separate files
TheShuEd Sep 5, 2024
67ddbab
frosty eyes
TheShuEd Sep 5, 2024
4940c9b
fix
TheShuEd Sep 5, 2024
6c54365
flora eyes
TheShuEd Sep 5, 2024
5c523a1
bluespace eyes
TheShuEd Sep 5, 2024
8785cdb
flesh eyes
TheShuEd Sep 5, 2024
cba8cac
redoing injction
TheShuEd Sep 5, 2024
e1e9982
auto add layers
TheShuEd Sep 5, 2024
a78396b
пипяу
TheShuEd Sep 5, 2024
c2d64d1
new injector component
TheShuEd Sep 5, 2024
cf97f59
stupid me
TheShuEd Sep 5, 2024
bf1b02a
nice marker injectors
TheShuEd Sep 5, 2024
28e5826
anomaly spawn on shutdown
TheShuEd Sep 5, 2024
8166cd6
gravity anom
TheShuEd Sep 5, 2024
39b0536
dead anomaly spawning
TheShuEd Sep 5, 2024
e2abada
add VOX states
TheShuEd Sep 6, 2024
1856553
sprite specific layers support
TheShuEd Sep 6, 2024
aa7ac9c
Merge branch 'master' into ed-04-09-2024-blood-anom
TheShuEd Sep 6, 2024
7e3cfb2
technology anom infection
TheShuEd Sep 6, 2024
a275d11
auto detach anomalies that have moved away
TheShuEd Sep 6, 2024
0e20537
Update anomaly_injections.yml
TheShuEd Sep 6, 2024
2aa7539
anomalyspawner integration
TheShuEd Sep 6, 2024
5d995ff
rock anomaly!
TheShuEd Sep 6, 2024
7f31a34
Update anomaly_injections.yml
TheShuEd Sep 6, 2024
6e7f5ee
fix crash bug
TheShuEd Sep 6, 2024
235048a
tag filter
TheShuEd Sep 6, 2024
d426811
fix anom dublication spawns
TheShuEd Sep 6, 2024
9a77c7d
Update anomaly.yml
TheShuEd Sep 6, 2024
ca70b11
Update InnerBodyAnomalyComponent.cs
TheShuEd Sep 6, 2024
d6a77c3
Update anomaly_injections.yml
TheShuEd Sep 6, 2024
10dde52
dont spawn anomalies after decay
TheShuEd Sep 7, 2024
c1a4a5e
fix morb sprite, add end message
TheShuEd Sep 7, 2024
933c92f
gravity resprite
TheShuEd Sep 8, 2024
3fee0d6
admin logging, double injection fix
TheShuEd Sep 8, 2024
b7b873b
make flesh and living light mobs friendly to anomaly hosts
TheShuEd Sep 8, 2024
a1427d3
Merge branch 'master' into ed-04-09-2024-blood-anom
TheShuEd Sep 9, 2024
d083089
popups
TheShuEd Sep 10, 2024
584024d
severity feedback
TheShuEd Sep 10, 2024
47fb38e
sloth review
TheShuEd Sep 12, 2024
ea1a059
A
TheShuEd Sep 12, 2024
7e74eae
keep organs after gib
TheShuEd Sep 12, 2024
910844d
punpun host
TheShuEd Sep 12, 2024
45f1f8e
sloth synchronization
TheShuEd Sep 15, 2024
e071eb0
Update arachnid.yml
TheShuEd Sep 16, 2024
b6dd24a
increase infections spawnrate
TheShuEd Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Content.Client/Anomaly/Effects/ClientInnerBodySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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);
}
}
53 changes: 48 additions & 5 deletions Content.Server/Anomaly/AnomalySynchronizerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using System.Numerics;
using Content.Server.Anomaly.Components;
using Content.Server.DeviceLinking.Systems;
using Content.Server.Power.Components;
Expand All @@ -10,6 +11,7 @@
using Content.Shared.Power;
using Robust.Shared.Audio.Systems;
using Content.Shared.Verbs;
using Robust.Shared.Timing;

namespace Content.Server.Anomaly;

Expand All @@ -25,6 +27,7 @@ public sealed partial class AnomalySynchronizerSystem : EntitySystem
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly PowerReceiverSystem _power = default!;
[Dependency] private readonly IGameTiming _timing = default!;

public override void Initialize()
{
Expand All @@ -40,6 +43,43 @@ public override void Initialize()
SubscribeLocalEvent<AnomalyStabilityChangedEvent>(OnAnomalyStabilityChanged);
}

public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<AnomalySynchronizerComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var sync, out var xform))
{
if (sync.ConnectedAnomaly is null)
continue;

if (_timing.CurTime < sync.NextCheckTime)
continue;
sync.NextCheckTime = _timing.CurTime + sync.CheckFrequency;
TheShuEd marked this conversation as resolved.
Show resolved Hide resolved

if (!EntityManager.EntityExists(sync.ConnectedAnomaly))
{
DisconnectFromAnomaly((uid, sync), sync.ConnectedAnomaly.Value);
continue;
}
TheShuEd marked this conversation as resolved.
Show resolved Hide resolved

if (Transform(sync.ConnectedAnomaly.Value).MapUid != Transform(uid).MapUid)
{
DisconnectFromAnomaly((uid, sync), sync.ConnectedAnomaly.Value);
continue;
}
TheShuEd marked this conversation as resolved.
Show resolved Hide resolved

var pos1 = _transform.GetWorldPosition(uid);
var pos2 = _transform.GetWorldPosition(sync.ConnectedAnomaly.Value);
var distance = Vector2.Distance(pos1, pos2);
if (distance > sync.AttachRange)
TheShuEd marked this conversation as resolved.
Show resolved Hide resolved
{
DisconnectFromAnomaly((uid, sync), sync.ConnectedAnomaly.Value);
continue;
}
}
}

/// <summary>
/// If powered, try to attach a nearby anomaly.
/// </summary>
Expand Down Expand Up @@ -73,10 +113,10 @@ private void OnPowerChanged(Entity<AnomalySynchronizerComponent> ent, ref PowerC
if (args.Powered)
return;

if (!TryComp<AnomalyComponent>(ent.Comp.ConnectedAnomaly, out var anomaly))
if (ent.Comp.ConnectedAnomaly is null)
return;

DisconnectFromAnomaly(ent, anomaly);
DisconnectFromAnomaly(ent, ent.Comp.ConnectedAnomaly.Value);
}

private void OnExamined(Entity<AnomalySynchronizerComponent> ent, ref ExaminedEvent args)
Expand Down Expand Up @@ -125,13 +165,16 @@ private void ConnectToAnomaly(Entity<AnomalySynchronizerComponent> ent, Entity<A

//TODO: disconnection from the anomaly should also be triggered if the anomaly is far away from the synchronizer.
//Currently only bluespace anomaly can do this, but for some reason it is the only one that cannot be connected to the synchronizer.
private void DisconnectFromAnomaly(Entity<AnomalySynchronizerComponent> ent, AnomalyComponent anomaly)
private void DisconnectFromAnomaly(Entity<AnomalySynchronizerComponent> ent, EntityUid other)
{
if (ent.Comp.ConnectedAnomaly == null)
return;

if (ent.Comp.PulseOnDisconnect)
_anomaly.DoAnomalyPulse(ent.Comp.ConnectedAnomaly.Value, anomaly);
if (TryComp<AnomalyComponent>(other, out var anomaly))
{
if (ent.Comp.PulseOnDisconnect)
_anomaly.DoAnomalyPulse(ent.Comp.ConnectedAnomaly.Value, anomaly);
}

_popup.PopupEntity(Loc.GetString("anomaly-sync-disconnected"), ent, PopupType.Large);
_audio.PlayPvs(ent.Comp.ConnectedSound, ent);
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Anomaly/AnomalySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public override void Initialize()
SubscribeLocalEvent<AnomalyComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<AnomalyComponent, StartCollideEvent>(OnStartCollide);


InitializeGenerator();
InitializeScanner();
InitializeVessel();
Expand Down Expand Up @@ -86,7 +87,10 @@ public void ShuffleParticlesEffect(Entity<AnomalyComponent> anomaly)

private void OnShutdown(Entity<AnomalyComponent> anomaly, ref ComponentShutdown args)
{
EndAnomaly(anomaly);
if (anomaly.Comp.CurrentBehavior is not null)
RemoveBehavior(anomaly, anomaly.Comp.CurrentBehavior.Value);

EndAnomaly(anomaly, spawnCore: false);
}

private void OnStartCollide(Entity<AnomalyComponent> anomaly, ref StartCollideEvent args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Content.Server.Anomaly.Components;
/// <summary>
/// a device that allows you to translate anomaly activity into multitool signals.
/// </summary>
[RegisterComponent, Access(typeof(AnomalySynchronizerSystem))]
[RegisterComponent, AutoGenerateComponentPause, Access(typeof(AnomalySynchronizerSystem))]
public sealed partial class AnomalySynchronizerComponent : Component
{
/// <summary>
Expand All @@ -34,6 +34,15 @@ public sealed partial class AnomalySynchronizerComponent : Component
[DataField]
public float AttachRange = 0.4f;

/// <summary>
/// Periodicheski checks to see if the anomaly has moved to disconnect it.
/// </summary>
[DataField]
public TimeSpan CheckFrequency = TimeSpan.FromSeconds(1f);

[DataField, AutoPausedField]
public TimeSpan NextCheckTime = TimeSpan.Zero;

[DataField]
public ProtoId<SourcePortPrototype> DecayingPort = "Decaying";

Expand Down
Loading
Loading