mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-21 15:38:52 +03:00
## Mirror of PR #24936: [Pulling rework v2](https://github.com/space-wizards/space-station-14/pull/24936) from <img src="https://avatars.githubusercontent.com/u/10567778?v=4" alt="space-wizards" width="22"/> [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `c584f6444a85cc53edb060230f7e7b2b76cc87bf` PR opened by <img src="https://avatars.githubusercontent.com/u/31366439?v=4" width="16"/><a href="https://github.com/metalgearsloth"> metalgearsloth</a> at 2024-02-04 01:43:17 UTC --- PR changed 53 files with 796 additions and 1356 deletions. The PR had the following labels: - Status: Needs Review --- <details open="true"><summary><h1>Original Body</h1></summary> > Health v2 moment > > Fixes https://github.com/space-wizards/space-station-14/issues/24900 > > - Fixes container changes. > - Fixes keybind. > - Fixes multi-pull. > - Fixes alerts cleanup for non-predicted pull stops. > > I'm awake now for any issues. </details> --------- Co-authored-by: SimpleStation14 <Unknown> Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com> Co-authored-by: VMSolidus <evilexecutive@gmail.com>
96 lines
3.6 KiB
C#
96 lines
3.6 KiB
C#
using Content.Shared.ActionBlocker;
|
|
using Content.Shared.Administration.Logs;
|
|
using Content.Shared.Alert;
|
|
using Content.Shared.Buckle.Components;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Pulling;
|
|
using Content.Shared.Standing;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Physics.Systems;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Timing;
|
|
using PullingSystem = Content.Shared.Movement.Pulling.Systems.PullingSystem;
|
|
|
|
namespace Content.Shared.Buckle;
|
|
|
|
public abstract partial class SharedBuckleSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly INetManager _netManager = default!;
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
|
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
|
|
|
[Dependency] protected readonly ActionBlockerSystem ActionBlocker = default!;
|
|
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
|
|
|
[Dependency] private readonly AlertsSystem _alerts = default!;
|
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
|
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
|
[Dependency] private readonly SharedJointSystem _joints = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
[Dependency] private readonly PullingSystem _pulling = default!;
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
|
[Dependency] private readonly StandingStateSystem _standing = default!;
|
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
UpdatesAfter.Add(typeof(SharedInteractionSystem));
|
|
UpdatesAfter.Add(typeof(SharedInputSystem));
|
|
|
|
InitializeBuckle();
|
|
InitializeStrap();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reattaches this entity to the strap, modifying its position and rotation.
|
|
/// </summary>
|
|
/// <param name="buckleUid">The entity to reattach.</param>
|
|
/// <param name="strapUid">The entity to reattach the buckleUid entity to.</param>
|
|
private void ReAttach(
|
|
EntityUid buckleUid,
|
|
EntityUid strapUid,
|
|
BuckleComponent? buckleComp = null,
|
|
StrapComponent? strapComp = null)
|
|
{
|
|
if (!Resolve(strapUid, ref strapComp, false)
|
|
|| !Resolve(buckleUid, ref buckleComp, false))
|
|
return;
|
|
|
|
_transform.SetCoordinates(buckleUid, new EntityCoordinates(strapUid, strapComp.BuckleOffsetClamped));
|
|
|
|
var buckleTransform = Transform(buckleUid);
|
|
|
|
// Buckle subscribes to move for <reasons> so this might fail.
|
|
// TODO: Make buckle not do that.
|
|
if (buckleTransform.ParentUid != strapUid)
|
|
return;
|
|
|
|
_transform.SetLocalRotation(buckleUid, Angle.Zero, buckleTransform);
|
|
_joints.SetRelay(buckleUid, strapUid);
|
|
|
|
switch (strapComp.Position)
|
|
{
|
|
case StrapPosition.None:
|
|
break;
|
|
case StrapPosition.Stand:
|
|
_standing.Stand(buckleUid);
|
|
break;
|
|
case StrapPosition.Down:
|
|
_standing.Down(buckleUid, false, false);
|
|
break;
|
|
}
|
|
}
|
|
}
|