]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make printing from ore procecssors slightly more bearable (#31074)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sat, 17 Aug 2024 05:12:55 +0000 (01:12 -0400)
committerGitHub <noreply@github.com>
Sat, 17 Aug 2024 05:12:55 +0000 (15:12 +1000)
* Make printing from ore procecssors slightly more bearable

* Update sheet.yml

Content.Client/Lathe/UI/LatheMenu.xaml.cs
Content.Server/Lathe/LatheSystem.cs
Content.Shared/Lathe/LatheComponent.cs
Content.Shared/Stacks/SharedStackSystem.cs
Resources/Prototypes/Entities/Structures/Machines/lathe.yml
Resources/Prototypes/Recipes/Lathes/sheet.yml

index 630ef41e9fb0b6ed13c74fc417990f008bf7a08b..02464d22e124c534b80fa67302410bf750ffb30c 100644 (file)
@@ -73,6 +73,16 @@ public sealed partial class LatheMenu : DefaultWindow
         MaterialsList.SetOwner(Entity);
     }
 
+    protected override void Opened()
+    {
+        base.Opened();
+
+        if (_entityManager.TryGetComponent<LatheComponent>(Entity, out var latheComp))
+        {
+            AmountLineEdit.SetText(latheComp.DefaultProductionAmount.ToString());
+        }
+    }
+
     /// <summary>
     /// Populates the list of all the recipes
     /// </summary>
index f6e5903bbe2b59c68dc40cb6f83fad676b6a917a..5ece533a628fc3edfc61fbc57eb4518b6fa4955f 100644 (file)
@@ -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<LatheProducingComponent>(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;
         }
 
index d776a65e2330fe93a26059c87a00a122b13f6a79..7924a0ec94425cde72ecc73d7ac0778ef3f865c7 100644 (file)
@@ -36,6 +36,12 @@ namespace Content.Shared.Lathe
         [DataField]
         public string? ReagentOutputSlotId;
 
+        /// <summary>
+        /// The default amount that's displayed in the UI for selecting the print amount.
+        /// </summary>
+        [DataField, AutoNetworkedField]
+        public int DefaultProductionAmount = 1;
+
         #region Visualizer info
         [DataField]
         public string? IdleState;
index e12edd323c72afaa4a0c25d5d3b5c0088355438d..7fe058afbaab4598e46b254611f9c49c1bb12a13 100644 (file)
@@ -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;
index e795a5836e1351e35815c4b3c4605fc708041dda..b5218545ac8bae5c8e054c271f57de867104b3ab 100644 (file)
     - 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
     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
index 3efaac95a729fa3c112a486b750b473afb181b30..52ea14ece5ffc21db77bd388d10a10844c6d9759 100644 (file)
@@ -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
 
 - type: latheRecipe
   id: SheetRGlass
   result: SheetRGlass1
-  applyMaterialDiscount: false
-  completetime: 2
+  completetime: 0
   materials:
     Glass: 100
     Steel: 50
+    Coal: 15
 
 - type: latheRecipe
   id: SheetRGlass30
     RawIron: 1500
     Coal: 500
 
+- type: latheRecipe
+  id: SheetPGlass1
+  result: SheetPGlass1
+  completetime: 0
+  materials:
+    RawQuartz: 100
+    RawPlasma: 100
+
 - type: latheRecipe
   id: SheetPGlass30
   result: SheetPGlass
     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
     RawIron: 1500
     Coal: 500
 
+- type: latheRecipe
+  id: SheetPlasma1
+  result: SheetPlasma1
+  completetime: 0
+  materials:
+    RawPlasma: 100
+
 - type: latheRecipe
   id: SheetPlasma30
   result: SheetPlasma
   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
   materials:
     RawUranium: 3000
 
+- type: latheRecipe
+  id: SheetUGlass1
+  result: SheetUGlass1
+  completetime: 0
+  materials:
+    RawUranium: 100
+    RawQuartz: 100
+
 - type: latheRecipe
   id: SheetUGlass30
   result: SheetUGlass
     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
 - 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