Skip to content

Commit

Permalink
+ Lathes
Browse files Browse the repository at this point in the history
  • Loading branch information
ScarKy0 committed Jan 28, 2025
1 parent 91f7179 commit a08b02a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Content.Server/Lathe/LatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Content.Shared.UserInterface;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.Examine;
using Content.Shared.Lathe;
using Content.Shared.Materials;
Expand All @@ -42,6 +43,7 @@ public sealed class LatheSystem : SharedLatheSystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly UserInterfaceSystem _uiSys = default!;
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
[Dependency] private readonly PopupSystem _popup = default!;
Expand Down Expand Up @@ -292,7 +294,7 @@ private void GetEmagLatheRecipes(EntityUid uid, EmagLatheRecipesComponent compon
{
if (uid != args.Lathe || !TryComp<TechnologyDatabaseComponent>(uid, out var technologyDatabase))
return;
if (!args.getUnavailable && !HasComp<EmaggedComponent>(uid))
if (!args.getUnavailable && !_emag.CheckFlag(uid, EmagType.Interaction))
return;
foreach (var recipe in component.EmagDynamicRecipes)
{
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Lathe/SharedLatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public abstract class SharedLatheSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly SharedMaterialStorageSystem _materialStorage = default!;
[Dependency] private readonly EmagSystem _emag = default!;

public readonly Dictionary<string, List<LatheRecipePrototype>> InverseRecipes = new();

Expand Down Expand Up @@ -66,6 +67,12 @@ public bool CanProduce(EntityUid uid, LatheRecipePrototype recipe, int amount =

private void OnEmagged(EntityUid uid, EmagLatheRecipesComponent component, ref GotEmaggedEvent args)
{
if (!_emag.CompareFlag(args.Type, EmagType.Interaction))
return;

if (_emag.CheckFlag(uid, EmagType.Interaction))
return;

args.Handled = true;
}

Expand Down

0 comments on commit a08b02a

Please sign in to comment.