Imagine if artifacts fucking killed you (#17746)

This commit is contained in:
Nemanja
2023-06-30 15:25:33 -04:00
committed by GitHub
parent 9b711d4344
commit b4fb089e00
12 changed files with 234 additions and 121 deletions

View File

@@ -10,6 +10,12 @@ public sealed class RandomTeleportArtifactComponent : Component
/// <summary>
/// The max distance that the artifact will teleport.
/// </summary>
[DataField("range")]
public float Range = 7.5f;
[DataField("maxRange")]
public float MaxRange = 15f;
/// <summary>
/// The min distance that the artifact will teleport.
/// </summary>
[DataField("minRange")]
public float MinRange = 6f;
}

View File

@@ -14,9 +14,6 @@ public sealed class TemperatureArtifactComponent : Component
[DataField("spawnTemp")]
public float SpawnTemperature = 100;
[DataField("maxTempDif")]
public float MaxTemperatureDifference = 1;
/// <summary>
/// If true, artifact will heat/cool not only its current tile, but surrounding tiles too.
/// This will change room temperature much faster.

View File

@@ -0,0 +1,10 @@
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
/// <summary>
/// This is used for an artifact that triggers when activated.
/// </summary>
[RegisterComponent]
public sealed class TriggerArtifactComponent : Component
{
}

View File

@@ -22,17 +22,7 @@ public sealed class IgniteArtifactSystem : EntitySystem
private void OnActivate(EntityUid uid, IgniteArtifactComponent component, ArtifactActivatedEvent args)
{
var flammable = GetEntityQuery<FlammableComponent>();
var targets = new HashSet<EntityUid>();
if (args.Activator != null)
{
targets.Add(args.Activator.Value);
}
else
{
targets = _lookup.GetEntitiesInRange(uid, component.Range);
}
foreach (var target in targets)
foreach (var target in _lookup.GetEntitiesInRange(uid, component.Range))
{
if (!flammable.TryGetComponent(target, out var fl))
continue;

View File

@@ -23,6 +23,6 @@ public sealed class RandomTeleportArtifactSystem : EntitySystem
var xform = Transform(uid);
_popup.PopupCoordinates(Loc.GetString("blink-artifact-popup"), xform.Coordinates, PopupType.Medium);
_xform.SetCoordinates(uid, xform, xform.Coordinates.Offset(_random.NextVector2(component.Range)));
_xform.SetCoordinates(uid, xform, xform.Coordinates.Offset(_random.NextVector2(component.MinRange, component.MaxRange)));
}
}

View File

@@ -42,9 +42,6 @@ public sealed class TemperatureArtifactSystem : EntitySystem
{
var dif = component.TargetTemperature - environment.Temperature;
var absDif = Math.Abs(dif);
if (absDif < component.MaxTemperatureDifference)
return;
var step = Math.Min(absDif, component.SpawnTemperature);
environment.Temperature += dif > 0 ? step : -step;
}

View File

@@ -0,0 +1,24 @@
using Content.Server.Explosion.EntitySystems;
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
/// <summary>
/// This handles <see cref="TriggerArtifactComponent"/>
/// </summary>
public sealed class TriggerArtifactSystem : EntitySystem
{
[Dependency] private readonly TriggerSystem _trigger = default!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<TriggerArtifactComponent, ArtifactActivatedEvent>(OnArtifactActivated);
}
private void OnArtifactActivated(EntityUid uid, TriggerArtifactComponent component, ArtifactActivatedEvent args)
{
_trigger.Trigger(uid, args.Activator);
}
}