Files
tbd-station-14/Content.Shared/Standing/StandingStateComponent.cs
mirrorcult c0ecdb09af Slipping tweaks + remove EffectBlocker (#4955)
* Slipping tweaks + remove EffectBlocker

* mfw failed merge conflict resolution

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2021-10-25 17:43:49 +11:00

53 lines
1.6 KiB
C#

using System;
using Content.Shared.Sound;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Standing
{
[Friend(typeof(StandingStateSystem))]
[RegisterComponent, NetworkedComponent]
public sealed class StandingStateComponent : Component
{
public override string Name => "StandingState";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("downSoundCollection")]
public SoundSpecifier DownSoundCollection { get; } = new SoundCollectionSpecifier("BodyFall");
[ViewVariables]
[DataField("standing")]
public bool Standing { get; set; } = true;
public override ComponentState GetComponentState(ICommonSession player)
{
return new StandingComponentState(Standing);
}
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
base.HandleComponentState(curState, nextState);
if (curState is not StandingComponentState state) return;
Standing = state.Standing;
}
// I'm not calling it StandingStateComponentState
[Serializable, NetSerializable]
private sealed class StandingComponentState : ComponentState
{
public bool Standing { get; }
public StandingComponentState(bool standing)
{
Standing = standing;
}
}
}
}