From ada6455b17349c803005126089393fcfb08e117f Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sat, 17 Aug 2024 01:12:55 -0400 Subject: [PATCH] Make printing from ore procecssors slightly more bearable (#31074) * Make printing from ore procecssors slightly more bearable * Update sheet.yml --- Content.Client/Lathe/UI/LatheMenu.xaml.cs | 10 +++ Content.Server/Lathe/LatheSystem.cs | 9 +- Content.Shared/Lathe/LatheComponent.cs | 6 ++ Content.Shared/Stacks/SharedStackSystem.cs | 3 + .../Entities/Structures/Machines/lathe.yml | 47 +++++----- Resources/Prototypes/Recipes/Lathes/sheet.yml | 85 +++++++++++++++---- 6 files changed, 118 insertions(+), 42 deletions(-) diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs index 630ef41e9f..02464d22e1 100644 --- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs +++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs @@ -73,6 +73,16 @@ public sealed partial class LatheMenu : DefaultWindow MaterialsList.SetOwner(Entity); } + protected override void Opened() + { + base.Opened(); + + if (_entityManager.TryGetComponent(Entity, out var latheComp)) + { + AmountLineEdit.SetText(latheComp.DefaultProductionAmount.ToString()); + } + } + /// /// Populates the list of all the recipes /// diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index f6e5903bbe..5ece533a62 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -197,11 +197,11 @@ namespace Content.Server.Lathe 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); @@ -210,6 +210,11 @@ namespace Content.Server.Lathe _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 d776a65e23..7924a0ec94 100644 --- a/Content.Shared/Lathe/LatheComponent.cs +++ b/Content.Shared/Lathe/LatheComponent.cs @@ -36,6 +36,12 @@ namespace Content.Shared.Lathe [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 e12edd323c..7fe058afba 100644 --- a/Content.Shared/Stacks/SharedStackSystem.cs +++ b/Content.Shared/Stacks/SharedStackSystem.cs @@ -223,6 +223,9 @@ namespace Content.Shared.Stacks 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 e795a5836e..b5218545ac 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -1168,17 +1168,18 @@ - type: Lathe idleState: icon runningState: building + defaultProductionAmount: 10 staticRecipes: - - SheetSteel30 - - SheetGlass30 - - SheetRGlass30 - - SheetPlasma30 - - SheetPGlass30 - - SheetRPGlass30 - - SheetUranium30 - - IngotGold30 - - IngotSilver30 - - MaterialBananium10 + - SheetSteel + - SheetGlass1 + - SheetRGlass + - SheetPlasma1 + - SheetPGlass1 + - SheetRPGlass1 + - SheetUranium1 + - IngotGold1 + - IngotSilver1 + - MaterialBananium1 - MaterialDiamond - type: entity @@ -1195,19 +1196,19 @@ materialUseMultiplier: 0.75 timeMultiplier: 0.5 staticRecipes: - - 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 3efaac95a7..52ea14ece5 100644 --- a/Resources/Prototypes/Recipes/Lathes/sheet.yml +++ b/Resources/Prototypes/Recipes/Lathes/sheet.yml @@ -1,10 +1,10 @@ - type: latheRecipe id: SheetSteel result: SheetSteel1 - applyMaterialDiscount: false - completetime: 2 + completetime: 0 materials: RawIron: 100 + Coal: 30 - type: latheRecipe id: SheetSteel30 @@ -17,8 +17,7 @@ - type: latheRecipe id: SheetGlass1 result: SheetGlass1 - applyMaterialDiscount: false - completetime: 2 + completetime: 0 materials: RawQuartz: 100 @@ -32,11 +31,11 @@ - type: latheRecipe id: SheetRGlass result: SheetRGlass1 - applyMaterialDiscount: false - completetime: 2 + completetime: 0 materials: Glass: 100 Steel: 50 + Coal: 15 - type: latheRecipe id: SheetRGlass30 @@ -47,6 +46,14 @@ RawIron: 1500 Coal: 500 +- type: latheRecipe + id: SheetPGlass1 + result: SheetPGlass1 + completetime: 0 + materials: + RawQuartz: 100 + RawPlasma: 100 + - type: latheRecipe id: SheetPGlass30 result: SheetPGlass @@ -55,6 +62,16 @@ RawQuartz: 3000 RawPlasma: 3000 +- type: latheRecipe + id: SheetRPGlass1 + result: SheetRPGlass1 + completetime: 0 + materials: + RawQuartz: 100 + RawPlasma: 100 + RawIron: 50 + Coal: 15 + - type: latheRecipe id: SheetRPGlass30 result: SheetRPGlass @@ -65,6 +82,13 @@ RawIron: 1500 Coal: 500 +- type: latheRecipe + id: SheetPlasma1 + result: SheetPlasma1 + completetime: 0 + materials: + RawPlasma: 100 + - type: latheRecipe id: SheetPlasma30 result: SheetPlasma @@ -72,6 +96,15 @@ materials: RawPlasma: 3000 +- type: latheRecipe + id: SheetPlasteel1 + result: SheetPlasteel1 + completetime: 0 + materials: + RawPlasma: 100 + RawIron: 200 #Twice as durable as steel, Twice the material cost + Coal: 30 + - type: latheRecipe id: SheetPlasteel30 result: SheetPlasteel @@ -88,6 +121,14 @@ materials: RawUranium: 3000 +- type: latheRecipe + id: SheetUGlass1 + result: SheetUGlass1 + completetime: 0 + materials: + RawUranium: 100 + RawQuartz: 100 + - type: latheRecipe id: SheetUGlass30 result: SheetUGlass @@ -96,6 +137,16 @@ RawUranium: 3000 RawQuartz: 3000 +- type: latheRecipe + id: SheetRUGlass1 + result: SheetRUGlass1 + completetime: 0 + materials: + RawUranium: 100 + RawQuartz: 100 + RawIron: 50 + Coal: 15 + - type: latheRecipe id: SheetRUGlass30 result: SheetRUGlass @@ -130,45 +181,45 @@ - type: latheRecipe id: MaterialDiamond result: MaterialDiamond1 - completetime: 3 + completetime: 0 materials: - RawDiamond: 1000 + RawDiamond: 100 - type: latheRecipe id: SheetUranium1 result: SheetUranium1 - completetime: 2 + completetime: 0 materials: - RawUranium: 500 + RawUranium: 100 - type: latheRecipe id: IngotGold1 result: IngotGold1 - completetime: 2 + completetime: 0 materials: - RawGold: 500 + RawGold: 100 - type: latheRecipe id: IngotSilver1 result: IngotSilver1 - completetime: 2 + completetime: 0 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 materials: - RawBananium: 500 + RawBananium: 100 - type: latheRecipe id: MaterialSheetMeat