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>
This commit is contained in:
parent
daa5fa194e
commit
e475512e7b
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue