Emaggable protolathe (#18456)
This commit is contained in:
25
Content.Shared/Lathe/EmagLatheComponent.cs
Normal file
25
Content.Shared/Lathe/EmagLatheComponent.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Shared.Lathe
|
||||
{
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState]
|
||||
public sealed partial class EmagLatheRecipesComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// All of the dynamic recipes that the lathe is capable to get using EMAG
|
||||
/// </summary>
|
||||
[DataField("emagDynamicRecipes", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
|
||||
[AutoNetworkedField]
|
||||
public List<string> EmagDynamicRecipes = new();
|
||||
|
||||
/// <summary>
|
||||
/// All of the static recipes that the lathe is capable to get using EMAG
|
||||
/// </summary>
|
||||
[DataField("emagStaticRecipes", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
|
||||
[AutoNetworkedField]
|
||||
public List<string> EmagStaticRecipes = new();
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ namespace Content.Shared.Lathe
|
||||
/// </summary>
|
||||
[DataField("producingSound")]
|
||||
public SoundSpecifier? ProducingSound;
|
||||
|
||||
#region Visualizer info
|
||||
[DataField("idleState", required: true)]
|
||||
public string IdleState = default!;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameStates;
|
||||
@@ -22,6 +23,7 @@ public abstract class SharedLatheSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<LatheComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<LatheComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<EmagLatheRecipesComponent, GotEmaggedEvent>(OnEmagged);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, LatheComponent component, ref ComponentGetState args)
|
||||
@@ -59,6 +61,11 @@ public abstract class SharedLatheSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnEmagged(EntityUid uid, EmagLatheRecipesComponent component, ref GotEmaggedEvent args)
|
||||
{
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
public static int AdjustMaterial(int original, bool reduce, float multiplier)
|
||||
=> reduce ? (int) MathF.Ceiling(original * multiplier) : original;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user