- add: Crawl
This commit is contained in:
8
Content.Client/_Amour/Crawl/CrawlSystem.cs
Normal file
8
Content.Client/_Amour/Crawl/CrawlSystem.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Content.Shared._Amour.Crawl;
|
||||
|
||||
namespace Content.Client._Amour.Crawl;
|
||||
|
||||
public sealed class CrawlSystem : SharedCrawlSystem
|
||||
{
|
||||
|
||||
}
|
||||
26
Content.Server/_Amour/Crawl/CrawlSystem.cs
Normal file
26
Content.Server/_Amour/Crawl/CrawlSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Shared._Amour.Crawl;
|
||||
|
||||
namespace Content.Server._Amour.Crawl;
|
||||
|
||||
public sealed class CrawlSystem : SharedCrawlSystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<CrawlableComponent, EmoteEvent>(OnEmote);
|
||||
}
|
||||
|
||||
private void OnEmote(EntityUid uid, CrawlableComponent component,ref EmoteEvent args)
|
||||
{
|
||||
switch (args.Emote.ID)
|
||||
{
|
||||
case "EmoteCrawl":
|
||||
EnableCrawl(uid);
|
||||
break;
|
||||
case "EmoteCrawlUp":
|
||||
DisableCrawl(uid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Content.Shared/_Amour/Crawl/CrawlComponent.cs
Normal file
10
Content.Shared/_Amour/Crawl/CrawlComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
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;
|
||||
}
|
||||
7
Content.Shared/_Amour/Crawl/CrawlableComponent.cs
Normal file
7
Content.Shared/_Amour/Crawl/CrawlableComponent.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared._Amour.Crawl;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class CrawlableComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
70
Content.Shared/_Amour/Crawl/SharedCrawlSystem.cs
Normal file
70
Content.Shared/_Amour/Crawl/SharedCrawlSystem.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -265,6 +265,7 @@
|
||||
- type: Mood
|
||||
- type: HoleContainer
|
||||
- type: Arousal
|
||||
- type: Crawlable
|
||||
- type: InteractionPanel
|
||||
actionPrototypes:
|
||||
- SlapButt
|
||||
|
||||
30
Resources/Prototypes/_Amour/Actions/crawl_action.yml
Normal file
30
Resources/Prototypes/_Amour/Actions/crawl_action.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
- type: emote
|
||||
id: EmoteCrawl
|
||||
buttonText: Ползти
|
||||
chatMessages: [падает]
|
||||
chatTriggers:
|
||||
- падает
|
||||
- ползет
|
||||
- упала
|
||||
- упало
|
||||
- лежит
|
||||
- улегся
|
||||
- улеглась
|
||||
- улеглось
|
||||
- упал
|
||||
- лёг
|
||||
allowMenu: true
|
||||
|
||||
- type: emote
|
||||
id: EmoteCrawlUp
|
||||
buttonText: Встать
|
||||
chatMessages: [встает]
|
||||
chatTriggers:
|
||||
- встает
|
||||
- встал
|
||||
- встала
|
||||
- встало
|
||||
- поднялась
|
||||
- поднялось
|
||||
- поднялся
|
||||
allowMenu: true
|
||||
Reference in New Issue
Block a user