using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
+using Robust.Shared.Map;
+using System.Numerics;
namespace Content.Server.Anomaly;
/// </summary>
public sealed partial class AnomalySystem
{
+
+ [Dependency] private readonly SharedTransformSystem _transform = default!;
+
private void InitializeGenerator()
{
SubscribeLocalEvent<AnomalyGeneratorComponent, BoundUIOpenedEvent>(OnGeneratorBUIOpened);
if (!valid)
continue;
+ // don't spawn in AntiAnomalyZones
+ var antiAnomalyZonesQueue = AllEntityQuery<AntiAnomalyZoneComponent>();
+ while (antiAnomalyZonesQueue.MoveNext(out var uid, out var zone))
+ {
+ var zoneTile = _transform.GetGridTilePositionOrDefault(uid, gridComp);
+
+ var delta = (zoneTile - tile);
+ if (delta.LengthSquared < zone.ZoneRadius * zone.ZoneRadius)
+ {
+ valid = false;
+ break;
+ }
+ }
+ if (!valid)
+ continue;
+
targetCoords = gridComp.GridTileToLocal(tile);
break;
}
--- /dev/null
+
+namespace Content.Server.Anomaly.Components;
+
+/// <summary>
+/// prohibits the possibility of anomalies appearing in the specified radius around the entity
+/// </summary>
+[RegisterComponent, Access(typeof(AnomalySystem))]
+public sealed partial class AntiAnomalyZoneComponent : Component
+{
+ /// <summary>
+ /// the radius in which anomalies cannot appear
+ /// </summary>
+ [DataField, ViewVariables(VVAccess.ReadWrite)]
+ public float ZoneRadius = 10;
+}
--- /dev/null
+- type: entity
+ name: anti anomaly zone
+ description: Anomalies will not be able to appear within a 10 block radius of this point.
+ id: AntiAnomalyZone
+ suffix: "range 10"
+ parent: MarkerBase
+ components:
+ - type: Sprite
+ sprite: Structures/Specific/Anomalies/ice_anom.rsi
+ layers:
+ - state: anom
+ - sprite: Markers/cross.rsi
+ state: pink
+ - type: AntiAnomalyZone
+ zoneRadius: 10
+
+- type: entity
+ parent: AntiAnomalyZone
+ id: AntiAnomalyZone20
+ suffix: "range 20"
+ description: Anomalies will not be able to appear within a 20 block radius of this point.
+ components:
+ - type: AntiAnomalyZone
+ zoneRadius: 20
+
+- type: entity
+ parent: AntiAnomalyZone
+ id: AntiAnomalyZone50
+ suffix: "range 50"
+ description: Anomalies will not be able to appear within a 50 block radius of this point.
+ components:
+ - type: AntiAnomalyZone
+ zoneRadius: 50
\ No newline at end of file