2021-12-05 18:09:01 +01:00
|
|
|
|
using Robust.Shared.Analyzers;
|
2020-10-16 20:35:09 +02:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-10-04 16:10:54 +01:00
|
|
|
|
using Robust.Shared.Log;
|
2021-12-05 18:09:01 +01:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2020-10-16 20:35:09 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Pulling.Components
|
2020-10-16 20:35:09 +02:00
|
|
|
|
{
|
|
|
|
|
|
[RegisterComponent]
|
2021-10-04 16:10:54 +01:00
|
|
|
|
[Friend(typeof(SharedPullingStateManagementSystem))]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class SharedPullerComponent : Component
|
2020-10-16 20:35:09 +02:00
|
|
|
|
{
|
2021-10-04 16:10:54 +01:00
|
|
|
|
// 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;
|
2020-10-16 20:35:09 +02:00
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
|
public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.75f;
|
2020-10-16 20:35:09 +02:00
|
|
|
|
|
2021-09-17 07:16:11 -07:00
|
|
|
|
[ViewVariables]
|
2021-12-05 21:02:04 +01:00
|
|
|
|
public EntityUid? Pulling { get; set; }
|
2020-10-16 20:35:09 +02:00
|
|
|
|
|
2021-10-04 16:10:54 +01:00
|
|
|
|
protected override void Shutdown()
|
|
|
|
|
|
{
|
|
|
|
|
|
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPuller(this);
|
|
|
|
|
|
base.Shutdown();
|
2020-10-16 20:35:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-06-19 19:41:26 -07:00
|
|
|
|
protected override void OnRemove()
|
2020-10-16 20:35:09 +02:00
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
|
if (Pulling != default)
|
2020-10-16 20:35:09 +02:00
|
|
|
|
{
|
2021-10-04 16:10:54 +01:00
|
|
|
|
// 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);
|
2020-10-16 20:35:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
base.OnRemove();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|