* Remove the unnecessary NetID property from ComponentState. * Remove Component.NetworkSynchronizeExistence. * Removed Component.NetID. * Adds component netID automatic generation. * Removed NetIdAttribute from serverside components with no corresponding clientside registration. * Completely remove static NetIds. * Renamed NetIDAttribute to NetworkedComponentAttribute. * Add GenerateNetIds calls to client and server entry points. Add test to make sure auto generated NetIds are identical. * Component changes when rebasing that I am too lazy to rewrite into the branch. Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Content.Shared.Singularity.Components
|
|
{
|
|
[NetworkedComponent]
|
|
public abstract class SharedSingularityComponent : Component
|
|
{
|
|
public override string Name => "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)
|
|
{
|
|
Level = level;
|
|
}
|
|
}
|
|
}
|