Anomaly fixes (#13558)
Closes https://github.com/space-wizards/space-station-14/issues/13545 Closes https://github.com/space-wizards/space-station-14/issues/13544 Closes https://github.com/space-wizards/space-station-14/issues/13543 Closes https://github.com/space-wizards/space-station-14/issues/13536
This commit is contained in:
@@ -25,7 +25,7 @@ public sealed class AnomalySystem : SharedAnomalySystem
|
||||
if (!Appearance.TryGetData(uid, AnomalyVisuals.IsPulsing, out bool pulsing, args.Component))
|
||||
pulsing = false;
|
||||
|
||||
if (Appearance.TryGetData(uid, AnomalyVisuals.IsPulsing, out bool super, args.Component) && super)
|
||||
if (Appearance.TryGetData(uid, AnomalyVisuals.Supercritical, out bool super, args.Component) && super)
|
||||
pulsing = super;
|
||||
|
||||
if (HasComp<AnomalySupercriticalComponent>(uid))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Anomaly;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Materials;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
@@ -14,15 +15,6 @@ namespace Content.Server.Anomaly;
|
||||
/// </summary>
|
||||
public sealed partial class AnomalySystem
|
||||
{
|
||||
/// <summary>
|
||||
/// A multiplier applied to the grid bounds
|
||||
/// to make the likelihood of it spawning outside
|
||||
/// of the main station less likely.
|
||||
///
|
||||
/// tl;dr anomalies only generate on the inner __% of the station.
|
||||
/// </summary>
|
||||
public const float GridBoundsMultiplier = 0.6f;
|
||||
|
||||
private void InitializeGenerator()
|
||||
{
|
||||
SubscribeLocalEvent<AnomalyGeneratorComponent, BoundUIOpenedEvent>(OnGeneratorBUIOpened);
|
||||
@@ -90,16 +82,16 @@ public sealed partial class AnomalySystem
|
||||
var xform = Transform(grid);
|
||||
|
||||
var targetCoords = xform.Coordinates;
|
||||
var (gridPos, _, gridMatrix) = _transform.GetWorldPositionRotationMatrix(xform);
|
||||
var gridBounds = gridMatrix.TransformBox(gridComp.LocalAABB);
|
||||
var gridBounds = gridComp.LocalAABB;
|
||||
gridBounds.Scale(_configuration.GetCVar(CCVars.AnomalyGenerationGridBoundsScale));
|
||||
|
||||
for (var i = 0; i < 25; i++)
|
||||
{
|
||||
var randomX = Random.Next((int) (gridBounds.Left * GridBoundsMultiplier), (int) (gridBounds.Right * GridBoundsMultiplier));
|
||||
var randomY = Random.Next((int) (gridBounds.Bottom * GridBoundsMultiplier), (int) (gridBounds.Top * GridBoundsMultiplier));
|
||||
var randomX = Random.Next((int) gridBounds.Left, (int) gridBounds.Right);
|
||||
var randomY = Random.Next((int) gridBounds.Bottom, (int)gridBounds.Top);
|
||||
|
||||
var tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
||||
if (_atmosphere.IsTileSpace(grid, Transform(grid).MapUid, tile,
|
||||
var tile = new Vector2i(randomX, randomY);
|
||||
if (_atmosphere.IsTileSpace(grid, xform.MapUid, tile,
|
||||
mapGridComp: gridComp) || _atmosphere.IsTileAirBlocked(grid, tile, mapGridComp: gridComp))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -63,7 +63,7 @@ public sealed partial class AnomalySystem
|
||||
{
|
||||
if (component.Anomaly != null ||
|
||||
!TryComp<AnomalyScannerComponent>(args.Used, out var scanner) ||
|
||||
scanner.ScannedAnomaly is not {} anomaly)
|
||||
scanner.ScannedAnomaly is not { } anomaly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Server.Popups;
|
||||
using Content.Shared.Anomaly;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Random;
|
||||
namespace Content.Server.Anomaly;
|
||||
@@ -17,6 +18,7 @@ namespace Content.Server.Anomaly;
|
||||
/// </summary>
|
||||
public sealed partial class AnomalySystem : SharedAnomalySystem
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _configuration = default!;
|
||||
[Dependency] private readonly AmbientSoundSystem _ambient = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Content.Server.Singularity.EntitySystems
|
||||
if (component.SelectableTypes.Count < 2)
|
||||
return;
|
||||
var proto = _prototype.Index<EntityPrototype>(component.BoltType);
|
||||
args.Message.AddText(Loc.GetString("emitter-component-current-type", ("type", proto.Name)));
|
||||
args.PushMarkup(Loc.GetString("emitter-component-current-type", ("type", proto.Name)));
|
||||
}
|
||||
|
||||
private void ReceivedChanged(
|
||||
|
||||
@@ -179,7 +179,7 @@ public sealed class AnomalyComponent : Component
|
||||
/// of an anomalous particle of <seealso cref="DestabilizingParticleType"/>.
|
||||
/// </summary>
|
||||
[DataField("stabilityPerWeakeningeHit")]
|
||||
public float StabilityPerWeakeningeHit = -0.02f;
|
||||
public float StabilityPerWeakeningeHit = -0.1f;
|
||||
|
||||
#region Points and Vessels
|
||||
/// <summary>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
using Content.Shared.Anomaly.Effects.Components;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.Construction.EntitySystems;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -12,7 +10,6 @@ public abstract class SharedGravityAnomalySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedAnchorableSystem _anchorable = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xform = default!;
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
DebugTools.Assert(component.MinPulseLength > TimeSpan.FromSeconds(3)); // this is just to prevent lagspikes mispredicting pulses
|
||||
var variation = Random.NextFloat(-component.PulseVariation, component.PulseVariation) + 1;
|
||||
component.NextPulseTime = Timing.CurTime + GetPulseLength(component) * variation;
|
||||
|
||||
@@ -107,6 +108,7 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
}
|
||||
|
||||
Log.Add(LogType.Anomaly, LogImpact.Medium, $"Anomaly {ToPrettyString(uid)} pulsed with severity {component.Severity}.");
|
||||
if (_net.IsServer)
|
||||
Audio.PlayPvs(component.PulseSound, uid);
|
||||
|
||||
var pulse = EnsureComp<AnomalyPulsingComponent>(uid);
|
||||
|
||||
@@ -1135,6 +1135,16 @@ namespace Content.Shared.CCVar
|
||||
public static readonly CVarDef<bool> BiomassEasyMode =
|
||||
CVarDef.Create("biomass.easy_mode", true, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* Anomaly
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// A scale factor applied to a grid's bounds when trying to find a spot to randomly generate an anomaly.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<float> AnomalyGenerationGridBoundsScale =
|
||||
CVarDef.Create("anomaly.generation_grid_bounds_scale", 0.6f, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* VIEWPORT
|
||||
*/
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
id: MachineAnomalyGenerator
|
||||
parent: BaseMachinePowered
|
||||
name: anomaly generator
|
||||
description: The peak of psuedoscientific technology.
|
||||
description: The peak of pseudoscientific technology.
|
||||
placement:
|
||||
mode: AlignTileAny
|
||||
components:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
abstract: true
|
||||
id: BaseAnomaly
|
||||
name: anomaly
|
||||
description: A impossible object in space. Should you be standing this close to it?
|
||||
description: An impossible object. Should you be standing this close to it?
|
||||
components:
|
||||
- type: Anomaly
|
||||
pulseSound:
|
||||
|
||||
Reference in New Issue
Block a user