From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Sun, 1 Jun 2025 04:39:45 +0000 (+0200) Subject: Fix center of mass mispredict when placing tiles (#37969) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=e0ce82e1c79e68c136bd490e28e43390d5737495;p=space-station-14.git Fix center of mass mispredict when placing tiles (#37969) fix COM mispredict --- diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index a9d0318a52..721fda82f8 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -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 _physicsQuery; private EntityQuery _xformQuery; - public const float TileDensityMultiplier = 0.5f; - public override void Initialize() { base.Initialize(); @@ -97,7 +90,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem SubscribeLocalEvent(OnFTLCompleted); SubscribeLocalEvent(OnGridInit); - SubscribeLocalEvent(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(ev.EntityUid)) diff --git a/Content.Shared/Shuttles/Systems/SharedShuttleSystem.cs b/Content.Shared/Shuttles/Systems/SharedShuttleSystem.cs index adea551d2e..891a5c9e12 100644 --- a/Content.Shared/Shuttles/Systems/SharedShuttleSystem.cs +++ b/Content.Shared/Shuttles/Systems/SharedShuttleSystem.cs @@ -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 _gridQuery; private EntityQuery _physicsQuery; @@ -31,11 +35,23 @@ public abstract partial class SharedShuttleSystem : EntitySystem public override void Initialize() { base.Initialize(); + + SubscribeLocalEvent(OnGridFixtureChange); + _gridQuery = GetEntityQuery(); _physicsQuery = GetEntityQuery(); _xformQuery = GetEntityQuery(); } + 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); + } + } + /// /// Returns whether an entity can FTL to the specified map. ///