# Conflicts: # Content.Server/Actions/Actions/DisarmAction.cs # Content.Server/Actions/Actions/ScreamAction.cs # Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs # Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs # Content.Server/Explosion/Components/FlashExplosiveComponent.cs # Content.Server/Physics/Controllers/MoverController.cs # Content.Server/Portal/Components/PortalComponent.cs # Content.Server/Portal/Components/TeleporterComponent.cs # Content.Server/Projectiles/Components/ProjectileComponent.cs # Content.Server/Singularity/Components/EmitterComponent.cs # Content.Server/Sound/EmitSoundSystem.cs # Content.Server/Stunnable/Components/StunbatonComponent.cs # Content.Server/Tools/Components/MultitoolComponent.cs # Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs # Content.Shared/Gravity/GravityComponent.cs # Content.Shared/Light/Component/SharedExpendableLightComponent.cs # Content.Shared/Maps/ContentTileDefinition.cs # Content.Shared/Slippery/SlipperyComponent.cs # Content.Shared/Standing/StandingStateComponent.cs # Resources/Prototypes/Entities/Objects/Fun/bike_horn.yml
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using System;
|
|
using Content.Shared.EffectBlocker;
|
|
using Content.Shared.Sound;
|
|
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
|
|
{
|
|
[RegisterComponent]
|
|
[NetworkedComponent]
|
|
public sealed class StandingStateComponent : Component, IEffectBlocker
|
|
{
|
|
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 bool CanFall() => Standing;
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|