* 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>
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
#nullable enable
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Content.Shared.Research.Prototypes;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
namespace Content.Shared.Lathe
|
|
{
|
|
[ComponentReference(typeof(SharedLatheDatabaseComponent))]
|
|
[NetworkedComponent()]
|
|
public class SharedProtolatheDatabaseComponent : SharedLatheDatabaseComponent, ISerializationHooks
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
|
|
public override string Name => "ProtolatheDatabase";
|
|
|
|
[DataField("protolatherecipes")] private List<string> _recipeIds = new();
|
|
|
|
/// <summary>
|
|
/// A full list of recipes this protolathe can print.
|
|
/// </summary>
|
|
public IEnumerable<LatheRecipePrototype> ProtolatheRecipes
|
|
{
|
|
get
|
|
{
|
|
foreach (var id in _recipeIds)
|
|
{
|
|
yield return _prototypeManager.Index<LatheRecipePrototype>(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[NetSerializable, Serializable]
|
|
public class ProtolatheDatabaseState : ComponentState
|
|
{
|
|
public readonly List<string> Recipes;
|
|
public ProtolatheDatabaseState(List<string> recipes)
|
|
{
|
|
Recipes = recipes;
|
|
}
|
|
}
|
|
}
|