From 69d38103641ad6714a692ea65e0ca50e339ffb15 Mon Sep 17 00:00:00 2001 From: JojoFR1 Date: Tue, 26 Dec 2023 22:07:07 +0100 Subject: [PATCH] [Payloads] Output support (almost working) --- lib/src/multicraft/MultiCrafter.java | 15 +++++++++++++++ lib/test/TestParser.java | 1 + 2 files changed, 16 insertions(+) diff --git a/lib/src/multicraft/MultiCrafter.java b/lib/src/multicraft/MultiCrafter.java index 8fa6873..cec3258 100644 --- a/lib/src/multicraft/MultiCrafter.java +++ b/lib/src/multicraft/MultiCrafter.java @@ -19,6 +19,7 @@ import mindustry.logic.*; import mindustry.type.*; import mindustry.ui.*; +import mindustry.world.*; import mindustry.world.blocks.heat.*; import mindustry.world.blocks.payloads.*; import mindustry.world.consumers.*; @@ -376,6 +377,20 @@ public void dumpOutputs() { dumpLiquid(fluids[i].liquid, 2f, dir); } } + + //TODO fix infinite output + if (cur.isOutputPayload()) { + for (PayloadStack output : cur.output.payloads) { + Payload payloadOutput = null; + if (output.item instanceof Block) + payloadOutput = new BuildPayload((Block) output.item, this.team); + else if (output.item instanceof UnitType) + payloadOutput = new UnitPayload(((UnitType)output.item).constructor.get()); + + if (payloadOutput != null) + movePayload(payloadOutput); + } + } } /** diff --git a/lib/test/TestParser.java b/lib/test/TestParser.java index dac6970..ee719e8 100644 --- a/lib/test/TestParser.java +++ b/lib/test/TestParser.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; public class TestParser { + @SuppressWarnings("unused") @Test public void input(){ Vars.content = new ContentLoader();