Bandaid pullcontroller (#7176)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.Pulling;
|
using Content.Shared.Pulling;
|
||||||
|
using Content.Shared.Pulling.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -23,7 +24,7 @@ namespace Content.Server.Physics.Controllers
|
|||||||
private const float AccelModifierLowMass = 5.0f; // roundstart saltern emergency crowbar
|
private const float AccelModifierLowMass = 5.0f; // roundstart saltern emergency crowbar
|
||||||
// Used to control settling (turns off pulling).
|
// Used to control settling (turns off pulling).
|
||||||
private const float MaximumSettleVelocity = 0.1f;
|
private const float MaximumSettleVelocity = 0.1f;
|
||||||
private const float MaximumSettleDistance = 0.01f;
|
private const float MaximumSettleDistance = 0.1f;
|
||||||
// Settle shutdown control.
|
// Settle shutdown control.
|
||||||
// Mustn't be too massive, as that causes severe mispredicts *and can prevent it ever resolving*.
|
// Mustn't be too massive, as that causes severe mispredicts *and can prevent it ever resolving*.
|
||||||
// Exists to bleed off "I pulled my crowbar" overshoots.
|
// Exists to bleed off "I pulled my crowbar" overshoots.
|
||||||
@@ -39,10 +40,19 @@ namespace Content.Server.Physics.Controllers
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
UpdatesAfter.Add(typeof(MoverController));
|
UpdatesAfter.Add(typeof(MoverController));
|
||||||
|
SubscribeLocalEvent<SharedPullerComponent, MoveEvent>(OnPullerMove);
|
||||||
|
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPullerMove(EntityUid uid, SharedPullerComponent component, ref MoveEvent args)
|
||||||
|
{
|
||||||
|
if (component.Pulling == null ||
|
||||||
|
!TryComp<SharedPullableComponent>(component.Pulling.Value, out var pullable)) return;
|
||||||
|
|
||||||
|
_pullableSystem.StopMoveTo(pullable);
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateBeforeSolve(bool prediction, float frameTime)
|
public override void UpdateBeforeSolve(bool prediction, float frameTime)
|
||||||
{
|
{
|
||||||
base.UpdateBeforeSolve(prediction, frameTime);
|
base.UpdateBeforeSolve(prediction, frameTime);
|
||||||
|
|||||||
@@ -135,8 +135,8 @@ namespace Content.Shared.Pulling
|
|||||||
RaiseLocalEvent(pullable.Owner, message);
|
RaiseLocalEvent(pullable.Owner, message);
|
||||||
|
|
||||||
// Networking
|
// Networking
|
||||||
puller.Dirty();
|
Dirty(puller);
|
||||||
pullable.Dirty();
|
Dirty(pullable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Physics.Pull;
|
using Content.Shared.Physics.Pull;
|
||||||
using Content.Shared.Pulling.Components;
|
using Content.Shared.Pulling.Components;
|
||||||
using Content.Shared.Rotatable;
|
using Content.Shared.Rotatable;
|
||||||
@@ -217,6 +218,10 @@ namespace Content.Shared.Pulling
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_containerSystem.IsEntityInContainer(player) ||
|
||||||
|
player.IsWeightless(entityManager: EntityManager))
|
||||||
|
return false;
|
||||||
|
|
||||||
TryMoveTo(pullable, coords);
|
TryMoveTo(pullable, coords);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user