Fix planet command being ran on existing maps (#21775)
This commit is contained in:
@@ -274,7 +274,7 @@ public sealed partial class ShuttleSystem
|
||||
if (TryComp(uid, out body))
|
||||
{
|
||||
if (shuttle != null)
|
||||
Enable(uid, body, shuttle);
|
||||
Enable(uid, component: body, shuttle: shuttle);
|
||||
_physics.SetLinearVelocity(uid, new Vector2(0f, 20f), body: body);
|
||||
_physics.SetAngularVelocity(uid, 0f, body: body);
|
||||
_physics.SetLinearDamping(body, 0f);
|
||||
@@ -365,11 +365,11 @@ public sealed partial class ShuttleSystem
|
||||
// to event ordering and awake body shenanigans (at least for now).
|
||||
if (HasComp<MapGridComponent>(xform.MapUid))
|
||||
{
|
||||
Disable(uid, body);
|
||||
Disable(uid, component: body);
|
||||
}
|
||||
else if (shuttle != null)
|
||||
{
|
||||
Enable(uid, body, shuttle);
|
||||
Enable(uid, component: body, shuttle: shuttle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -701,6 +701,7 @@ public sealed partial class ShuttleSystem
|
||||
var transform = _physics.GetPhysicsTransform(uid, xform, _xformQuery);
|
||||
var aabbs = new List<Box2>(manager.Fixtures.Count);
|
||||
var immune = new HashSet<EntityUid>();
|
||||
var tileSet = new List<(Vector2i, Tile)>();
|
||||
|
||||
foreach (var fixture in manager.Fixtures.Values)
|
||||
{
|
||||
@@ -712,6 +713,10 @@ public sealed partial class ShuttleSystem
|
||||
aabb = aabb.Enlarged(0.2f);
|
||||
aabbs.Add(aabb);
|
||||
|
||||
// Handle clearing biome stuff as relevant.
|
||||
tileSet.Clear();
|
||||
_biomes.ReserveTiles(xform.MapUid.Value, aabb, tileSet);
|
||||
|
||||
foreach (var ent in _lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, LookupFlags.Uncontained))
|
||||
{
|
||||
if (ent == uid || immune.Contains(ent))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Doors.Systems;
|
||||
using Content.Server.Parallax;
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.Stunnable;
|
||||
@@ -28,6 +29,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
|
||||
[Dependency] private readonly BiomeSystem _biomes = default!;
|
||||
[Dependency] private readonly BodySystem _bobby = default!;
|
||||
[Dependency] private readonly DockingSystem _dockSystem = default!;
|
||||
[Dependency] private readonly DoorSystem _doors = default!;
|
||||
@@ -37,6 +39,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
[Dependency] private readonly MapLoaderSystem _loader = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metadata = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedMapSystem _maps = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly ShuttleConsoleSystem _console = default!;
|
||||
@@ -115,7 +118,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
|
||||
if (component.Enabled)
|
||||
{
|
||||
Enable(uid, physicsComponent, component);
|
||||
Enable(uid, component: physicsComponent, shuttle: component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,17 +131,18 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
|
||||
if (component.Enabled)
|
||||
{
|
||||
Enable(uid, physicsComponent, component);
|
||||
Enable(uid, component: physicsComponent, shuttle: component);
|
||||
}
|
||||
else
|
||||
{
|
||||
Disable(uid, physicsComponent);
|
||||
Disable(uid, component: physicsComponent);
|
||||
}
|
||||
}
|
||||
|
||||
private void Enable(EntityUid uid, PhysicsComponent component, ShuttleComponent shuttle)
|
||||
public void Enable(EntityUid uid, FixturesComponent? manager = null, PhysicsComponent? component = null, ShuttleComponent? shuttle = null)
|
||||
{
|
||||
FixturesComponent? manager = null;
|
||||
if (!Resolve(uid, ref manager, ref component, ref shuttle, false))
|
||||
return;
|
||||
|
||||
_physics.SetBodyType(uid, BodyType.Dynamic, manager: manager, body: component);
|
||||
_physics.SetBodyStatus(component, BodyStatus.InAir);
|
||||
@@ -147,9 +151,10 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
_physics.SetAngularDamping(component, shuttle.AngularDamping);
|
||||
}
|
||||
|
||||
private void Disable(EntityUid uid, PhysicsComponent component)
|
||||
public void Disable(EntityUid uid, FixturesComponent? manager = null, PhysicsComponent? component = null)
|
||||
{
|
||||
FixturesComponent? manager = null;
|
||||
if (!Resolve(uid, ref manager, ref component, false))
|
||||
return;
|
||||
|
||||
_physics.SetBodyType(uid, BodyType.Static, manager: manager, body: component);
|
||||
_physics.SetBodyStatus(component, BodyStatus.OnGround);
|
||||
@@ -162,11 +167,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
if (EntityManager.GetComponent<MetaDataComponent>(uid).EntityLifeStage >= EntityLifeStage.Terminating)
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Disable(uid, physicsComponent);
|
||||
Disable(uid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user