Files
tbd-station-14/Content.Shared/Singularity/Components/SharedSingularityComponent.cs
DrSmugleaf 716bee0746 Remove IClientSingularityInstance, move visual effects to SingularityDistortionComponent (#4194)
* Remove IClientSingularityInstance

* In and out 5 minute refactor

* Component states for singularity distortion

* Fix distortion states

* Address reviews
2021-06-24 12:48:11 +10:00

45 lines
1.3 KiB
C#

using System;
using Content.Shared.NetIDs;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Singularity.Components
{
public abstract class SharedSingularityComponent : Component
{
public override string Name => "Singularity";
public override uint? NetID => ContentNetIDs.SINGULARITY;
[DataField("deleteFixture")] public string? DeleteFixtureId { get; } = default;
/// <summary>
/// Changed by <see cref="SharedSingularitySystem.ChangeSingularityLevel"/>
/// </summary>
[ViewVariables]
public int Level { get; set; }
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
if (curState is not SingularityComponentState state)
{
return;
}
EntitySystem.Get<SharedSingularitySystem>().ChangeSingularityLevel(this, state.Level);
}
}
[Serializable, NetSerializable]
public sealed class SingularityComponentState : ComponentState
{
public int Level { get; }
public SingularityComponentState(int level) : base(ContentNetIDs.SINGULARITY)
{
Level = level;
}
}
}