diff --git a/Content.Client/Anomaly/AnomalySystem.cs b/Content.Client/Anomaly/AnomalySystem.cs index 3f42a3e5f7..1884c39628 100644 --- a/Content.Client/Anomaly/AnomalySystem.cs +++ b/Content.Client/Anomaly/AnomalySystem.cs @@ -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(uid)) diff --git a/Content.Server/Anomaly/AnomalySystem.Generator.cs b/Content.Server/Anomaly/AnomalySystem.Generator.cs index cd37280270..0af2dfe04d 100644 --- a/Content.Server/Anomaly/AnomalySystem.Generator.cs +++ b/Content.Server/Anomaly/AnomalySystem.Generator.cs @@ -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; /// public sealed partial class AnomalySystem { - /// - /// 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. - /// - public const float GridBoundsMultiplier = 0.6f; - private void InitializeGenerator() { SubscribeLocalEvent(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; diff --git a/Content.Server/Anomaly/AnomalySystem.Vessel.cs b/Content.Server/Anomaly/AnomalySystem.Vessel.cs index dabd2528fb..8b334ec923 100644 --- a/Content.Server/Anomaly/AnomalySystem.Vessel.cs +++ b/Content.Server/Anomaly/AnomalySystem.Vessel.cs @@ -63,7 +63,7 @@ public sealed partial class AnomalySystem { if (component.Anomaly != null || !TryComp(args.Used, out var scanner) || - scanner.ScannedAnomaly is not {} anomaly) + scanner.ScannedAnomaly is not { } anomaly) { return; } diff --git a/Content.Server/Anomaly/AnomalySystem.cs b/Content.Server/Anomaly/AnomalySystem.cs index ed31ab7510..530545b291 100644 --- a/Content.Server/Anomaly/AnomalySystem.cs +++ b/Content.Server/Anomaly/AnomalySystem.cs @@ -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; /// 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!; diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs index 6393df7ee6..eb8b0ef981 100644 --- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs @@ -136,7 +136,7 @@ namespace Content.Server.Singularity.EntitySystems if (component.SelectableTypes.Count < 2) return; var proto = _prototype.Index(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( diff --git a/Content.Shared/Anomaly/Components/AnomalyComponent.cs b/Content.Shared/Anomaly/Components/AnomalyComponent.cs index d19616323d..13dbf6f6a9 100644 --- a/Content.Shared/Anomaly/Components/AnomalyComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyComponent.cs @@ -179,7 +179,7 @@ public sealed class AnomalyComponent : Component /// of an anomalous particle of . /// [DataField("stabilityPerWeakeningeHit")] - public float StabilityPerWeakeningeHit = -0.02f; + public float StabilityPerWeakeningeHit = -0.1f; #region Points and Vessels /// diff --git a/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs b/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs index 8cb1714afb..d7cf92c17d 100644 --- a/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs +++ b/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs @@ -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!; diff --git a/Content.Shared/Anomaly/SharedAnomalySystem.cs b/Content.Shared/Anomaly/SharedAnomalySystem.cs index 6d954dcc82..3fe4b63f16 100644 --- a/Content.Shared/Anomaly/SharedAnomalySystem.cs +++ b/Content.Shared/Anomaly/SharedAnomalySystem.cs @@ -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,7 +108,8 @@ public abstract class SharedAnomalySystem : EntitySystem } Log.Add(LogType.Anomaly, LogImpact.Medium, $"Anomaly {ToPrettyString(uid)} pulsed with severity {component.Severity}."); - Audio.PlayPvs(component.PulseSound, uid); + if (_net.IsServer) + Audio.PlayPvs(component.PulseSound, uid); var pulse = EnsureComp(uid); pulse.EndTime = Timing.CurTime + pulse.PulseDuration; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index a6956c01d5..5992b4c233 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1135,6 +1135,16 @@ namespace Content.Shared.CCVar public static readonly CVarDef BiomassEasyMode = CVarDef.Create("biomass.easy_mode", true, CVar.SERVERONLY); + /* + * Anomaly + */ + + /// + /// A scale factor applied to a grid's bounds when trying to find a spot to randomly generate an anomaly. + /// + public static readonly CVarDef AnomalyGenerationGridBoundsScale = + CVarDef.Create("anomaly.generation_grid_bounds_scale", 0.6f, CVar.SERVERONLY); + /* * VIEWPORT */ diff --git a/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml b/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml index e1f5022d8f..75088f4ed5 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml @@ -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: diff --git a/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml b/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml index 01dd3dce8b..d842f86f0a 100644 --- a/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml +++ b/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml @@ -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: