mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-02-15 00:54:51 +01:00
Delete MetabolismMovespeedModifierSystem (#42134)
* delete metabolismmovespeedmodifiersystem * Revert "delete metabolismmovespeedmodifiersystem" This reverts commit 19572fa0858bfb9385f4717fc77c8956bdbc56c0. * delete metabolismmovespeedmodifiersystem and component --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0dcb2756c7
commit
077dceeb2d
@@ -1,22 +0,0 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
{
|
||||
//TODO: refactor movement modifier component because this is a pretty poor solution
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class MovespeedModifierMetabolismComponent : Component
|
||||
{
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public float WalkSpeedModifier { get; set; }
|
||||
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public float SprintSpeedModifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When the current modifier is expected to end.
|
||||
/// </summary>
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public TimeSpan ModifierTimer { get; set; } = TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Chemistry
|
||||
{
|
||||
// TODO CONVERT THIS TO A STATUS EFFECT!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
public sealed class MetabolismMovespeedModifierSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movespeed = default!;
|
||||
|
||||
private readonly List<Entity<MovespeedModifierMetabolismComponent>> _components = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
UpdatesOutsidePrediction = true;
|
||||
|
||||
SubscribeLocalEvent<MovespeedModifierMetabolismComponent, ComponentStartup>(AddComponent);
|
||||
SubscribeLocalEvent<MovespeedModifierMetabolismComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||
}
|
||||
|
||||
private void OnRefreshMovespeed(EntityUid uid, MovespeedModifierMetabolismComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
args.ModifySpeed(component.WalkSpeedModifier, component.SprintSpeedModifier);
|
||||
}
|
||||
|
||||
private void AddComponent(Entity<MovespeedModifierMetabolismComponent> metabolism, ref ComponentStartup args)
|
||||
{
|
||||
_components.Add(metabolism);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var currentTime = _gameTiming.CurTime;
|
||||
|
||||
for (var i = _components.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var metabolism = _components[i];
|
||||
|
||||
if (metabolism.Comp.Deleted)
|
||||
{
|
||||
_components.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (metabolism.Comp.ModifierTimer > currentTime)
|
||||
continue;
|
||||
|
||||
_components.RemoveAt(i);
|
||||
RemComp<MovespeedModifierMetabolismComponent>(metabolism);
|
||||
|
||||
_movespeed.RefreshMovementSpeedModifiers(metabolism);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user