ECS standingstate (#8322)

This commit is contained in:
metalgearsloth
2022-05-21 17:30:38 +10:00
committed by GitHub
parent b5615b2564
commit 82693b4926
2 changed files with 37 additions and 31 deletions

View File

@@ -1,6 +1,5 @@
using Content.Shared.Sound;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Standing
{
@@ -9,8 +8,8 @@ namespace Content.Shared.Standing
public sealed class StandingStateComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("downSoundCollection")]
public SoundSpecifier DownSoundCollection { get; } = new SoundCollectionSpecifier("BodyFall");
[DataField("downSound")]
public SoundSpecifier DownSound { get; } = new SoundCollectionSpecifier("BodyFall");
[DataField("standing")]
public bool Standing { get; set; } = true;
@@ -21,30 +20,5 @@ namespace Content.Shared.Standing
/// </summary>
[DataField("changedFixtures")]
public List<string> ChangedFixtures = new();
public override ComponentState GetComponentState()
{
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;
}
}
}
}