Files
tbd-station-14/Content.Shared/Pulling/Components/SharedPullerComponent.cs
20kdc 2a8486a384 Pullability partial ECS refactor, monkey-gibbing error fix (#4695)
* Migrate lots of pulling logic out of the components and clean it up

* It's buggy, but move more code out of the pullable component

* Pulling system now throws less errors than it did before the refactor

* Finally finish the big parts of refactoring pullability

* Pulling: Handle disconnect properly if the pull joint has been removed by physics shutdown

* Port 2b68449328 to this branch

* Changes as per PR reviews

* Port e801ffac45 (SharedJointSystem) and fix issues encountered during testing

SharedJointSystem.

Also, MinLength and Stiffness appear to have suddenly gained enough meaning that pulling is broken unless they're set.
2021-10-04 17:10:54 +02:00

42 lines
1.4 KiB
C#

using Content.Shared.Pulling;
using Content.Shared.Movement.Components;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
using Robust.Shared.Log;
using Component = Robust.Shared.GameObjects.Component;
namespace Content.Shared.Pulling.Components
{
[RegisterComponent]
[Friend(typeof(SharedPullingStateManagementSystem))]
public class SharedPullerComponent : Component, IMoveSpeedModifier
{
public override string Name => "Puller";
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
public float WalkSpeedModifier => Pulling == null ? 1.0f : 0.75f;
public float SprintSpeedModifier => Pulling == null ? 1.0f : 0.75f;
[ViewVariables]
public IEntity? Pulling { get; set; }
protected override void Shutdown()
{
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPuller(this);
base.Shutdown();
}
protected override void OnRemove()
{
if (Pulling != null)
{
// This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLER {0} - OnRemove called when Pulling is set!", Owner);
}
base.OnRemove();
}
}
}