From 3e078ab3e0aff0d022bac2bb869090934e7f10e2 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 10 Oct 2024 03:29:26 +0200 Subject: [PATCH] Fix error log when recycling something with small material counts. (#32723) * 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Content.Server/Materials/MaterialStorageSystem.cs b/Content.Server/Materials/MaterialStorageSystem.cs index 25e409fd01..9f43a22049 100644 --- a/Content.Server/Materials/MaterialStorageSystem.cs +++ b/Content.Server/Materials/MaterialStorageSystem.cs @@ -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(); + return _stackSystem.SpawnMultiple(materialProto.StackEntity, amountToSpawn, coordinates); } -- 2.51.2