Revert "- add: Crawl"

This reverts commit b63a46e032.
This commit is contained in:
Aviu00
2024-03-22 12:05:32 +03:00
parent 5c8304eb5c
commit 83a614fa13
7 changed files with 0 additions and 152 deletions

View File

@@ -1,10 +0,0 @@
using Robust.Shared.GameStates;
namespace Content.Shared._Amour.Crawl;
[RegisterComponent, NetworkedComponent]
public sealed partial class CrawlComponent : Component
{
public float SprintSpeedModifier { get; set; } = 0.4f;
public float WalkSpeedModifier { get; set; } = 0.4f;
}

View File

@@ -1,7 +0,0 @@
namespace Content.Shared._Amour.Crawl;
[RegisterComponent]
public sealed partial class CrawlableComponent : Component
{
}

View File

@@ -1,70 +0,0 @@
using Content.Shared.Buckle;
using Content.Shared.Movement.Systems;
using Content.Shared.Standing;
using Content.Shared.StatusEffect;
namespace Content.Shared._Amour.Crawl;
public abstract class SharedCrawlSystem : EntitySystem
{
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly MovementSpeedModifierSystem _speed = default!;
[Dependency] private readonly StandingStateSystem _standingStateSystem = default!;
[Dependency] private readonly SharedBuckleSystem _buckle = default!;
public override void Initialize()
{
SubscribeLocalEvent<CrawlComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<CrawlComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<CrawlableComponent, ComponentShutdown>(OnCrawlShutdown);
SubscribeLocalEvent<CrawlComponent, StoodEvent>(OnStood);
SubscribeLocalEvent<CrawlComponent, RefreshMovementSpeedModifiersEvent>(OnRefresh);
}
private void OnRefresh(EntityUid uid, CrawlComponent component, RefreshMovementSpeedModifiersEvent args)
{
args.ModifySpeed(component.WalkSpeedModifier, component.SprintSpeedModifier);
}
private void OnInit(EntityUid uid, CrawlComponent component, ComponentInit args)
{
if (_buckle.TryUnbuckle(uid, uid) || !_standingStateSystem.Down(uid, true, false))
{
DisableCrawl(uid);
return;
}
_speed.RefreshMovementSpeedModifiers(uid);
}
private void OnCrawlShutdown(EntityUid uid, CrawlableComponent component, ComponentShutdown args)
{
DisableCrawl(uid);
}
private void OnStood(EntityUid uid, CrawlComponent component, StoodEvent args)
{
if (component.LifeStage == ComponentLifeStage.Stopping)
return;
DisableCrawl(uid);
}
private void OnShutdown(EntityUid uid, CrawlComponent component, ComponentShutdown args)
{
_standingStateSystem.Stand(uid);
component.SprintSpeedModifier = 1f;
component.WalkSpeedModifier = 1f;
_speed.RefreshMovementSpeedModifiers(uid);
}
public void EnableCrawl(EntityUid uid)
{
EnsureComp<CrawlComponent>(uid);
}
public void DisableCrawl(EntityUid uid)
{
RemComp<CrawlComponent>(uid);
}
}