Core overfill bugfix

This commit is contained in:
Anuken 2020-11-28 21:51:26 -05:00
parent 810238d0f9
commit b63501b1c7

View File

@ -19,6 +19,7 @@ import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.storage.CoreBlock.*;
import mindustry.world.modules.*;
import static mindustry.Vars.*;
@ -275,7 +276,7 @@ public class ConstructBlock extends Block{
if(clampedAmount > 0 && accumulated > 0){ //if it's positive, add it to the core
if(core != null && requirements[i].item.unlockedNow()){ //only accept items that are unlocked
int accepting = core.acceptStack(requirements[i].item, accumulated, builder);
int accepting = Math.min(accumulated, ((CoreBuild)core).storageCapacity - core.items.get(requirements[i].item));
//transfer items directly, as this is not production.
core.items.add(requirements[i].item, accepting);
accumulator[i] -= accepting;