Fix center of mass mispredict when placing tiles (#37969)
fix COM mispredict
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Buckle.Systems;
|
||||
using Content.Server.Doors.Systems;
|
||||
using Content.Server.Parallax;
|
||||
using Content.Server.Procedural;
|
||||
using Content.Server.Shuttles.Components;
|
||||
@@ -10,10 +9,7 @@ using Content.Server.Station.Systems;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Light.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Salvage;
|
||||
using Content.Shared.Shuttles.Systems;
|
||||
@@ -21,7 +17,6 @@ using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameStates;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
@@ -74,8 +69,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
private EntityQuery<TransformComponent> _xformQuery;
|
||||
|
||||
public const float TileDensityMultiplier = 0.5f;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -97,7 +90,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
SubscribeLocalEvent<ShuttleComponent, FTLCompletedEvent>(OnFTLCompleted);
|
||||
|
||||
SubscribeLocalEvent<GridInitializeEvent>(OnGridInit);
|
||||
SubscribeLocalEvent<FixturesComponent, GridFixtureChangeEvent>(OnGridFixtureChange);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
@@ -106,15 +98,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
UpdateHyperspace();
|
||||
}
|
||||
|
||||
private void OnGridFixtureChange(EntityUid uid, FixturesComponent manager, GridFixtureChangeEvent args)
|
||||
{
|
||||
foreach (var fixture in args.NewFixtures)
|
||||
{
|
||||
_physics.SetDensity(uid, fixture.Key, fixture.Value, TileDensityMultiplier, false, manager);
|
||||
_fixtures.SetRestitution(uid, fixture.Key, fixture.Value, 0.1f, false, manager);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGridInit(GridInitializeEvent ev)
|
||||
{
|
||||
if (HasComp<MapComponent>(ev.EntityUid))
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
namespace Content.Shared.Shuttles.Systems;
|
||||
|
||||
@@ -15,12 +16,15 @@ public abstract partial class SharedShuttleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
||||
[Dependency] protected readonly FixtureSystem Fixtures = default!;
|
||||
[Dependency] protected readonly SharedMapSystem Maps = default!;
|
||||
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem XformSystem = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
|
||||
public const float FTLRange = 256f;
|
||||
public const float FTLBufferRange = 8f;
|
||||
public const float TileDensityMultiplier = 0.5f;
|
||||
|
||||
private EntityQuery<MapGridComponent> _gridQuery;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
@@ -31,11 +35,23 @@ public abstract partial class SharedShuttleSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FixturesComponent, GridFixtureChangeEvent>(OnGridFixtureChange);
|
||||
|
||||
_gridQuery = GetEntityQuery<MapGridComponent>();
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
_xformQuery = GetEntityQuery<TransformComponent>();
|
||||
}
|
||||
|
||||
private void OnGridFixtureChange(EntityUid uid, FixturesComponent manager, GridFixtureChangeEvent args)
|
||||
{
|
||||
foreach (var fixture in args.NewFixtures)
|
||||
{
|
||||
Physics.SetDensity(uid, fixture.Key, fixture.Value, TileDensityMultiplier, false, manager);
|
||||
Fixtures.SetRestitution(uid, fixture.Key, fixture.Value, 0.1f, false, manager);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether an entity can FTL to the specified map.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user