Restricted range cleanup (#22402)
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Numerics;
|
||||
using Content.Server.Gateway.Components;
|
||||
using Content.Server.Parallax;
|
||||
using Content.Server.Procedural;
|
||||
using Content.Server.Salvage;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Movement.Components;
|
||||
@@ -36,11 +37,10 @@ public sealed class GatewayGeneratorSystem : EntitySystem
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
|
||||
[Dependency] private readonly BiomeSystem _biome = default!;
|
||||
[Dependency] private readonly DungeonSystem _dungeon = default!;
|
||||
[Dependency] private readonly FixtureSystem _fixtures = default!;
|
||||
[Dependency] private readonly GatewaySystem _gateway = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metadata = default!;
|
||||
[Dependency] private readonly RestrictedRangeSystem _restricted = default!;
|
||||
[Dependency] private readonly SharedMapSystem _maps = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
|
||||
[ValidatePrototypeId<DatasetPrototype>]
|
||||
private const string PlanetNames = "names_borer";
|
||||
@@ -120,8 +120,12 @@ public sealed class GatewayGeneratorSystem : EntitySystem
|
||||
_metadata.SetEntityName(mapUid, gatewayName);
|
||||
|
||||
var origin = new Vector2i(random.Next(-MaxOffset, MaxOffset), random.Next(-MaxOffset, MaxOffset));
|
||||
var restriction = AddComp<RestrictedRangeComponent>(mapUid);
|
||||
restriction.Origin = origin;
|
||||
var restricted = new RestrictedRangeComponent
|
||||
{
|
||||
Origin = origin
|
||||
};
|
||||
AddComp(mapUid, restricted);
|
||||
|
||||
_biome.EnsurePlanet(mapUid, _protoManager.Index<BiomeTemplatePrototype>("Continental"), seed);
|
||||
|
||||
var grid = Comp<MapGridComponent>(mapUid);
|
||||
@@ -145,21 +149,6 @@ public sealed class GatewayGeneratorSystem : EntitySystem
|
||||
genDest.Seed = seed;
|
||||
genDest.Generator = uid;
|
||||
|
||||
// Enclose the area
|
||||
var boundaryUid = Spawn(null, originCoords);
|
||||
var boundaryPhysics = AddComp<PhysicsComponent>(boundaryUid);
|
||||
var cShape = new ChainShape();
|
||||
// Don't need it to be a perfect circle, just need it to be loosely accurate.
|
||||
cShape.CreateLoop(Vector2.Zero, restriction.Range + 1f, false, count: 4);
|
||||
_fixtures.TryCreateFixture(
|
||||
boundaryUid,
|
||||
cShape,
|
||||
"boundary",
|
||||
collisionLayer: (int) (CollisionGroup.HighImpassable | CollisionGroup.Impassable | CollisionGroup.LowImpassable),
|
||||
body: boundaryPhysics);
|
||||
_physics.WakeBody(boundaryUid, body: boundaryPhysics);
|
||||
AddComp<BoundaryComponent>(boundaryUid);
|
||||
|
||||
// Create the gateway.
|
||||
var gatewayUid = SpawnAtPosition(generator.Proto, originCoords);
|
||||
var gatewayComp = Comp<GatewayComponent>(gatewayUid);
|
||||
|
||||
Reference in New Issue
Block a user