Files
OldThink/Content.Shared/Pulling/Components/SharedPullerComponent.cs

37 lines
1.2 KiB
C#
Raw Normal View History

2021-12-05 18:09:01 +01:00
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
2021-12-05 18:09:01 +01:00
using Robust.Shared.ViewVariables;
2021-06-09 22:19:39 +02:00
namespace Content.Shared.Pulling.Components
{
[RegisterComponent]
[Friend(typeof(SharedPullingStateManagementSystem))]
public sealed class SharedPullerComponent : Component
{
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
2021-12-05 18:09:01 +01:00
public float WalkSpeedModifier => Pulling == default ? 1.0f : 0.75f;
2021-12-05 18:09:01 +01:00
public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.75f;
[ViewVariables]
2021-12-05 21:02:04 +01:00
public EntityUid? Pulling { get; set; }
protected override void Shutdown()
{
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPuller(this);
base.Shutdown();
}
protected override void OnRemove()
{
2021-12-05 18:09:01 +01:00
if (Pulling != default)
{
// 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();
}
}
}