]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix error log when recycling something with small material counts. (#32723)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Thu, 10 Oct 2024 01:29:26 +0000 (03:29 +0200)
committerGitHub <noreply@github.com>
Thu, 10 Oct 2024 01:29:26 +0000 (03:29 +0200)
* Fix error log when recycling something with small material counts.

MaterialStorageSystem.SpawnMultipleFromMaterial now doesn't call StackSystem.SpawnMultiple if it tries to spawn zero. This happens because the recycler calls SpawnMultipleFromMaterial for everything recycled, even if the amount it has stored is < the amount for one sheet.

* Update Content.Server/Materials/MaterialStorageSystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Server/Materials/MaterialStorageSystem.cs

index 25e409fd01021dda67be1e086e0dfb084463b9a7..9f43a220493a4faf6e4bcf772be3552c8db47ad9 100644 (file)
@@ -175,6 +175,10 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
         var materialPerStack = composition.MaterialComposition[materialProto.ID];
         var amountToSpawn = amount / materialPerStack;
         overflowMaterial = amount - amountToSpawn * materialPerStack;
+
+        if (amountToSpawn == 0)
+            return new List<EntityUid>();
+
         return _stackSystem.SpawnMultiple(materialProto.StackEntity, amountToSpawn, coordinates);
     }