2019-09-03 22:51:19 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Research.Prototypes;
|
2019-09-03 22:51:19 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2019-09-03 22:51:19 +02:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Serialization;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-12-30 00:48:18 +11:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Lathe
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
|
|
|
|
[ComponentReference(typeof(SharedLatheDatabaseComponent))]
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2022-02-16 00:23:23 -07:00
|
|
|
public abstract class SharedProtolatheDatabaseComponent : SharedLatheDatabaseComponent, ISerializationHooks
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
|
|
|
|
2021-12-30 03:19:49 +13:00
|
|
|
[DataField("protolatherecipes", customTypeSerializer:typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
|
2021-12-30 00:48:18 +11:00
|
|
|
private List<string> _recipeIds = new();
|
2019-09-03 22:51:19 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A full list of recipes this protolathe can print.
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
public IEnumerable<LatheRecipePrototype> ProtolatheRecipes
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
get
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
foreach (var id in _recipeIds)
|
|
|
|
|
{
|
|
|
|
|
yield return _prototypeManager.Index<LatheRecipePrototype>(id);
|
|
|
|
|
}
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetSerializable, Serializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ProtolatheDatabaseState : ComponentState
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
|
|
|
|
public readonly List<string> Recipes;
|
2021-07-12 01:32:10 -07:00
|
|
|
public ProtolatheDatabaseState(List<string> recipes)
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
|
|
|
|
Recipes = recipes;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|