перенос общих файлов из папки White в _White

This commit is contained in:
Remuchi
2024-01-28 18:37:24 +07:00
parent 1e4ad59270
commit 3a08b81d53
370 changed files with 805 additions and 812 deletions

View File

@@ -0,0 +1,10 @@
using Robust.Shared.Serialization;
using Content.Shared.DoAfter;
namespace Content.Shared.Carrying
{
[Serializable, NetSerializable]
public sealed partial class CarryDoAfterEvent : SimpleDoAfterEvent
{
}
}

View File

@@ -0,0 +1,28 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Carrying
{
[RegisterComponent, NetworkedComponent, Access(typeof(CarryingSlowdownSystem))]
public sealed partial class CarryingSlowdownComponent : Component
{
[DataField("walkModifier", required: true)] [ViewVariables(VVAccess.ReadWrite)]
public float WalkModifier = 1.0f;
[DataField("sprintModifier", required: true)] [ViewVariables(VVAccess.ReadWrite)]
public float SprintModifier = 1.0f;
}
[Serializable, NetSerializable]
public sealed class CarryingSlowdownComponentState : ComponentState
{
public float WalkModifier;
public float SprintModifier;
public CarryingSlowdownComponentState(float walkModifier, float sprintModifier)
{
WalkModifier = walkModifier;
SprintModifier = sprintModifier;
}
}
}

View File

@@ -0,0 +1,47 @@
using Content.Shared.Movement.Systems;
using Robust.Shared.GameStates;
namespace Content.Shared.Carrying
{
public sealed class CarryingSlowdownSystem : EntitySystem
{
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CarryingSlowdownComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<CarryingSlowdownComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<CarryingSlowdownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMoveSpeed);
}
public void SetModifier(EntityUid uid, float walkSpeedModifier, float sprintSpeedModifier, CarryingSlowdownComponent? component = null)
{
if (!Resolve(uid, ref component))
return;
component.WalkModifier = walkSpeedModifier;
component.SprintModifier = sprintSpeedModifier;
_movementSpeed.RefreshMovementSpeedModifiers(uid);
}
private void OnGetState(EntityUid uid, CarryingSlowdownComponent component, ref ComponentGetState args)
{
args.State = new CarryingSlowdownComponentState(component.WalkModifier, component.SprintModifier);
}
private void OnHandleState(EntityUid uid, CarryingSlowdownComponent component, ref ComponentHandleState args)
{
if (args.Current is CarryingSlowdownComponentState state)
{
component.WalkModifier = state.WalkModifier;
component.SprintModifier = state.SprintModifier;
_movementSpeed.RefreshMovementSpeedModifiers(uid);
}
}
private void OnRefreshMoveSpeed(EntityUid uid, CarryingSlowdownComponent component, RefreshMovementSpeedModifiersEvent args)
{
args.ModifySpeed(component.WalkModifier, component.SprintModifier);
}
}
}