From: Pieter-Jan Briers Date: Thu, 10 Oct 2024 01:29:26 +0000 (+0200) Subject: Fix error log when recycling something with small material counts. (#32723) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3e078ab3e0aff0d022bac2bb869090934e7f10e2;p=space-station-14.git 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> --- 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); }