Update trivial components to use auto comp states (#20539)

This commit is contained in:
DrSmugleaf
2023-09-28 16:20:29 -07:00
committed by GitHub
parent 14cfe44ece
commit a44fa86b68
158 changed files with 806 additions and 2866 deletions

View File

@@ -2,10 +2,7 @@ using Content.Shared.Emag.Systems;
using Content.Shared.Materials;
using Content.Shared.Research.Prototypes;
using JetBrains.Annotations;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using System.Net.Mail;
namespace Content.Shared.Lathe;
@@ -21,23 +18,9 @@ public abstract class SharedLatheSystem : EntitySystem
{
base.Initialize();
SubscribeLocalEvent<LatheComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<LatheComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<EmagLatheRecipesComponent, GotEmaggedEvent>(OnEmagged);
}
private void OnGetState(EntityUid uid, LatheComponent component, ref ComponentGetState args)
{
args.State = new LatheComponentState(component.MaterialUseMultiplier);
}
private void OnHandleState(EntityUid uid, LatheComponent component, ref ComponentHandleState args)
{
if (args.Current is not LatheComponentState state)
return;
component.MaterialUseMultiplier = state.MaterialUseMultiplier;
}
[PublicAPI]
public bool CanProduce(EntityUid uid, string recipe, int amount = 1, LatheComponent? component = null)
{
@@ -71,14 +54,3 @@ public abstract class SharedLatheSystem : EntitySystem
protected abstract bool HasRecipe(EntityUid uid, LatheRecipePrototype recipe, LatheComponent component);
}
[Serializable, NetSerializable]
public sealed class LatheComponentState : ComponentState
{
public float MaterialUseMultiplier;
public LatheComponentState(float materialUseMultiplier)
{
MaterialUseMultiplier = materialUseMultiplier;
}
}