Separate jetpack movement speed modifier (#9363)

This commit is contained in:
TekuNut
2022-07-07 19:29:25 +01:00
committed by GitHub
parent abaf850ea5
commit 6eba481657
8 changed files with 51 additions and 28 deletions

View File

@@ -1,10 +1,12 @@
using Content.Shared.Movement.Systems;
using Content.Shared.Movement.Systems;
using Content.Shared.Nutrition.Components;
namespace Content.Shared.Nutrition.EntitySystems
{
public sealed class SharedHungerSystem : EntitySystem
{
[Dependency] private readonly SharedJetpackSystem _jetpack = default!;
public override void Initialize()
{
base.Initialize();
@@ -14,6 +16,9 @@ namespace Content.Shared.Nutrition.EntitySystems
private void OnRefreshMovespeed(EntityUid uid, SharedHungerComponent component, RefreshMovementSpeedModifiersEvent args)
{
if (_jetpack.IsUserFlying(component.Owner))
return;
float mod = component.CurrentHungerThreshold <= HungerThreshold.Starving ? 0.75f : 1.0f;
args.ModifySpeed(mod, mod);
}