diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs index a572fd507e0..509647ff08d 100644 --- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs +++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs @@ -90,6 +90,16 @@ public void SetEntity(EntityUid uid) MaterialsList.SetOwner(Entity); } + protected override void Opened() + { + base.Opened(); + + if (_entityManager.TryGetComponent(Entity, out var latheComp)) + { + AmountLineEdit.SetText(latheComp.DefaultProductionAmount.ToString()); + } + } + /// /// DeltaV: Updates the UI elements for mining points. /// diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 74eed70d040..dd5910cb0d0 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -198,11 +198,11 @@ public bool TryStartProducing(EntityUid uid, LatheComponent? component = null) var recipe = component.Queue.First(); component.Queue.RemoveAt(0); - var time = _reagentSpeed.ApplySpeed(uid, recipe.CompleteTime); + var time = _reagentSpeed.ApplySpeed(uid, recipe.CompleteTime) * component.TimeMultiplier; var lathe = EnsureComp(uid); lathe.StartTime = _timing.CurTime; - lathe.ProductionLength = time * component.TimeMultiplier; + lathe.ProductionLength = time; component.CurrentRecipe = recipe; var ev = new LatheStartPrintingEvent(recipe); @@ -211,6 +211,11 @@ public bool TryStartProducing(EntityUid uid, LatheComponent? component = null) _audio.PlayPvs(component.ProducingSound, uid); UpdateRunningAppearance(uid, true); UpdateUserInterfaceState(uid, component); + + if (time == TimeSpan.Zero) + { + FinishProducing(uid, component, lathe); + } return true; } diff --git a/Content.Shared/Lathe/LatheComponent.cs b/Content.Shared/Lathe/LatheComponent.cs index 505ceb69569..ab3d59b6423 100644 --- a/Content.Shared/Lathe/LatheComponent.cs +++ b/Content.Shared/Lathe/LatheComponent.cs @@ -36,6 +36,12 @@ public sealed partial class LatheComponent : Component [DataField] public string? ReagentOutputSlotId; + /// + /// The default amount that's displayed in the UI for selecting the print amount. + /// + [DataField, AutoNetworkedField] + public int DefaultProductionAmount = 1; + #region Visualizer info [DataField] public string? IdleState; diff --git a/Content.Shared/Stacks/SharedStackSystem.cs b/Content.Shared/Stacks/SharedStackSystem.cs index e12edd323c7..7fe058afbaa 100644 --- a/Content.Shared/Stacks/SharedStackSystem.cs +++ b/Content.Shared/Stacks/SharedStackSystem.cs @@ -223,6 +223,9 @@ public bool TryMergeToContacts(EntityUid uid, StackComponent? stack = null, Tran foreach (var otherStack in intersecting) { var otherEnt = otherStack.Owner; + // if you merge a ton of stacks together, you will end up deleting a few by accident. + if (TerminatingOrDeleted(otherEnt) || EntityManager.IsQueuedForDeletion(otherEnt)) + continue; if (!TryMergeStacks(uid, otherEnt, out _, stack, otherStack)) continue; diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 31d5bf28fad..114f0412656 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -1304,19 +1304,20 @@ - type: Lathe idleState: icon runningState: building + defaultProductionAmount: 10 staticRecipes: - BluespaceCrystal - NormalityCrystal - - SheetSteel30 - - SheetGlass30 - - SheetRGlass30 - - SheetPlasma30 - - SheetPGlass30 - - SheetRPGlass30 - - SheetUranium30 - - IngotGold30 - - IngotSilver30 - - MaterialBananium10 + - SheetSteel + - SheetGlass1 + - SheetRGlass + - SheetPlasma1 + - SheetPGlass1 + - SheetRPGlass1 + - SheetUranium1 + - IngotGold1 + - IngotSilver1 + - MaterialBananium1 - type: MaterialStorageMagnetPickup # Delta V - Summary: Adds magnet pull from Frontier magnetEnabled: True range: 0.30 # Delta V - End Magnet Pull @@ -1341,19 +1342,19 @@ staticRecipes: - BluespaceCrystal - NormalityCrystal - - SheetSteel30 - - SheetGlass30 - - SheetRGlass30 - - SheetPlasma30 - - SheetPGlass30 - - SheetRPGlass30 - - SheetPlasteel30 - - SheetUranium30 - - SheetUGlass30 - - SheetRUGlass30 - - IngotGold30 - - IngotSilver30 - - MaterialBananium10 + - SheetSteel + - SheetGlass1 + - SheetRGlass + - SheetPlasma1 + - SheetPGlass1 + - SheetRPGlass1 + - SheetPlasteel1 + - SheetUranium1 + - SheetUGlass1 + - SheetRUGlass1 + - IngotGold1 + - IngotSilver1 + - MaterialBananium1 - MaterialDiamond - type: entity diff --git a/Resources/Prototypes/Recipes/Lathes/sheet.yml b/Resources/Prototypes/Recipes/Lathes/sheet.yml index 79e490d062e..4af5d0c6db7 100644 --- a/Resources/Prototypes/Recipes/Lathes/sheet.yml +++ b/Resources/Prototypes/Recipes/Lathes/sheet.yml @@ -4,8 +4,10 @@ applyMaterialDiscount: false completetime: 2 miningPoints: 1 + completetime: 0 materials: RawIron: 100 + Coal: 30 - type: latheRecipe id: SheetSteel30 @@ -21,6 +23,7 @@ applyMaterialDiscount: false completetime: 2 miningPoints: 1 + completetime: 0 materials: RawQuartz: 100 @@ -37,9 +40,11 @@ applyMaterialDiscount: false completetime: 2 miningPoints: 1 + completetime: 0 materials: Glass: 100 Steel: 50 + Coal: 15 - type: latheRecipe id: SheetRGlass30 @@ -53,7 +58,7 @@ - type: latheRecipe id: SheetPGlass1 result: SheetPGlass1 - completetime: 2 + completetime: 0 miningPoints: 16 materials: RawQuartz: 100 @@ -70,7 +75,7 @@ - type: latheRecipe id: SheetRPGlass1 result: SheetRPGlass1 - completetime: 2 + completetime: 0 miningPoints: 16 materials: RawQuartz: 100 @@ -91,7 +96,7 @@ - type: latheRecipe id: SheetPlasma1 result: SheetPlasma1 - completetime: 2 + completetime: 0 miningPoints: 15 materials: RawPlasma: 100 @@ -106,7 +111,7 @@ - type: latheRecipe id: SheetPlasteel1 result: SheetPlasteel1 - completetime: 2 + completetime: 0 miningPoints: 17 materials: RawPlasma: 100 @@ -132,7 +137,7 @@ - type: latheRecipe id: SheetUGlass1 result: SheetUGlass1 - completetime: 2 + completetime: 0 miningPoints: 31 materials: RawUranium: 100 @@ -149,7 +154,7 @@ - type: latheRecipe id: SheetRUGlass1 result: SheetRUGlass1 - completetime: 2 + completetime: 0 miningPoints: 31 materials: RawUranium: 100 @@ -191,50 +196,50 @@ - type: latheRecipe id: MaterialDiamond result: MaterialDiamond1 - completetime: 3 + completetime: 0 miningPoints: 50 materials: - RawDiamond: 1000 + RawDiamond: 100 - type: latheRecipe id: SheetUranium1 result: SheetUranium1 - completetime: 2 + completetime: 0 miningPoints: 30 materials: - RawUranium: 500 + RawUranium: 100 - type: latheRecipe id: IngotGold1 result: IngotGold1 - completetime: 2 + completetime: 0 miningPoints: 18 materials: - RawGold: 500 + RawGold: 100 - type: latheRecipe id: IngotSilver1 result: IngotSilver1 - completetime: 2 - miningPoints: 16 # DeltaV + completetime: 0 + miningPoints: 16 materials: - RawSilver: 500 + RawSilver: 100 - type: latheRecipe id: SheetPlastic result: SheetPlastic1 applyMaterialDiscount: false - completetime: 2 + completetime: 0 materials: Plastic: 100 - type: latheRecipe id: MaterialBananium1 result: MaterialBananium1 - completetime: 2 + completetime: 0 miningPoints: 60 materials: - RawBananium: 500 + RawBananium: 100 - type: latheRecipe id: MaterialSheetMeat