2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Lathe;
|
|
|
|
|
|
using Content.Shared.Research.Prototypes;
|
2019-04-26 15:51:05 +02:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-02-18 09:09:07 +01:00
|
|
|
|
using Robust.Shared.Players;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-09-08 13:30:22 +02:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2019-04-26 15:51:05 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.Lathe.Components
|
2019-04-26 15:51:05 +02:00
|
|
|
|
{
|
2019-07-31 15:02:36 +02:00
|
|
|
|
[RegisterComponent]
|
|
|
|
|
|
[ComponentReference(typeof(SharedLatheDatabaseComponent))]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class LatheDatabaseComponent : SharedLatheDatabaseComponent
|
2019-04-26 15:51:05 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Whether new recipes can be added to this database or not.
|
|
|
|
|
|
/// </summary>
|
2020-09-08 13:30:22 +02:00
|
|
|
|
[ViewVariables]
|
2021-05-04 15:37:16 +02:00
|
|
|
|
[DataField("static")]
|
2021-03-05 01:08:38 +01:00
|
|
|
|
public bool Static { get; private set; } = false;
|
2019-04-26 15:51:05 +02:00
|
|
|
|
|
2021-11-30 15:20:38 +01:00
|
|
|
|
public override ComponentState GetComponentState()
|
2019-04-26 15:51:05 +02:00
|
|
|
|
{
|
|
|
|
|
|
return new LatheDatabaseState(GetRecipeIdList());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Clear()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Static) return;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
base.Clear();
|
2019-04-26 15:51:05 +02:00
|
|
|
|
Dirty();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void AddRecipe(LatheRecipePrototype recipe)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Static) return;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
base.AddRecipe(recipe);
|
2019-04-26 15:51:05 +02:00
|
|
|
|
Dirty();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool RemoveRecipe(LatheRecipePrototype recipe)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Static || !base.RemoveRecipe(recipe)) return false;
|
|
|
|
|
|
Dirty();
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|