2021-09-15 16:17:09 +02:00
|
|
|
using System;
|
2021-02-05 17:01:54 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-09-15 16:17:09 +02:00
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
using Robust.Shared.Players;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-09-15 16:17:09 +02:00
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
2021-02-05 17:01:54 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Emoting
|
2021-02-05 17:01:54 +01:00
|
|
|
{
|
2021-09-15 16:17:09 +02:00
|
|
|
[RegisterComponent, NetworkedComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class SharedEmotingComponent : Component
|
2021-02-05 17:01:54 +01:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("enabled")] private bool _enabled = true;
|
2021-02-05 17:01:54 +01:00
|
|
|
|
2021-09-15 16:17:09 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-02-05 17:01:54 +01:00
|
|
|
public bool Enabled
|
|
|
|
|
{
|
|
|
|
|
get => _enabled;
|
|
|
|
|
set
|
|
|
|
|
{
|
2021-09-15 16:17:09 +02:00
|
|
|
if (_enabled == value)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-02-05 17:01:54 +01:00
|
|
|
_enabled = value;
|
|
|
|
|
Dirty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 15:20:38 +01:00
|
|
|
public override ComponentState GetComponentState()
|
2021-09-15 16:17:09 +02:00
|
|
|
{
|
|
|
|
|
return new EmotingComponentState(Enabled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
|
|
|
|
{
|
|
|
|
|
if (curState is not EmotingComponentState emoting)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_enabled = emoting.Enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
private sealed class EmotingComponentState : ComponentState
|
|
|
|
|
{
|
|
|
|
|
public bool Enabled { get; }
|
|
|
|
|
|
|
|
|
|
public EmotingComponentState(bool enabled)
|
|
|
|
|
{
|
|
|
|
|
Enabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-05 17:01:54 +01:00
|
|
|
}
|
|
|
|
|
}
|