2021-02-27 04:12:09 +01:00
|
|
|
using System;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Movement.Components;
|
2021-11-07 22:17:35 -07:00
|
|
|
using Content.Shared.Movement.EntitySystems;
|
|
|
|
|
using Robust.Shared.Containers;
|
2021-01-11 19:24:09 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2021-01-11 19:24:09 +01:00
|
|
|
using Robust.Shared.Serialization;
|
2022-01-28 13:28:05 -05:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
2021-01-11 19:24:09 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Clothing
|
2021-01-11 19:24:09 +01:00
|
|
|
{
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2021-11-07 22:17:35 -07:00
|
|
|
public abstract class SharedMagbootsComponent : Component
|
2021-01-11 19:24:09 +01:00
|
|
|
{
|
|
|
|
|
public abstract bool On { get; set; }
|
|
|
|
|
|
|
|
|
|
protected void OnChanged()
|
|
|
|
|
{
|
2021-11-07 22:17:35 -07:00
|
|
|
// inventory system will automatically hook into the event raised by this and update accordingly
|
|
|
|
|
if (Owner.TryGetContainer(out var container))
|
|
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(container.Owner);
|
2021-11-07 22:17:35 -07:00
|
|
|
}
|
2021-01-11 19:24:09 +01:00
|
|
|
}
|
2022-01-28 13:28:05 -05:00
|
|
|
[DataField("walkMoveCoeffecient", required: true)]
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public float WalkMoveCoeffecient = 0.85f;
|
2021-01-11 19:24:09 +01:00
|
|
|
|
2022-01-28 13:28:05 -05:00
|
|
|
[DataField("sprintMoveCoeffecient", required: true)]
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public float SprintMoveCoeffecient = 0.65f;
|
|
|
|
|
public float WalkSpeedModifier => On ? WalkMoveCoeffecient : 1;
|
|
|
|
|
public float SprintSpeedModifier => On ? SprintMoveCoeffecient : 1;
|
2021-01-11 19:24:09 +01:00
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class MagbootsComponentState : ComponentState
|
|
|
|
|
{
|
|
|
|
|
public bool On { get; }
|
|
|
|
|
|
2021-07-12 01:32:10 -07:00
|
|
|
public MagbootsComponentState(bool @on)
|
2021-01-11 19:24:09 +01:00
|
|
|
{
|
|
|
|
|
On = on;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|