From 24810ddbf5b99c222ec4c3710b12a5d61182bbef Mon Sep 17 00:00:00 2001 From: Zelaux <58040045+Zelaux@users.noreply.github.com> Date: Sun, 31 Oct 2021 18:35:16 +0500 Subject: [PATCH] Block classes are now responsible for flipping of blocks in schematics. (#6254) --- core/src/mindustry/input/InputHandler.java | 4 +--- core/src/mindustry/world/Block.java | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 3ce9851aaf..0bcc17727e 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -696,9 +696,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ }); //flip rotation - if(x == (req.rotation % 2 == 0)){ - req.rotation = Mathf.mod(req.rotation + 2, 4); - } + req.block.flipRotation(req, x); }); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 0327c36ab0..167f7e8b4b 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -468,7 +468,7 @@ public class Block extends UnlockableContent{ if(hasItems && configurable){ bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity)); } - + if(unitCapModifier != 0){ stats.add(Stat.maxUnits, (unitCapModifier < 0 ? "-" : "+") + Math.abs(unitCapModifier)); } @@ -824,7 +824,7 @@ public class Block extends UnlockableContent{ } clipSize = Math.max(clipSize, size * tilesize); - + //only kept to ensure compatibility with v6 mods. if(expanded){ clipSize += tilesize * 10f; @@ -989,4 +989,9 @@ public class Block extends UnlockableContent{ packer.add(PageType.editor, name + "-icon-editor", editorBase); } + public void flipRotation(BuildPlan req, boolean x){ + if(x == (req.rotation % 2 == 0)){ + req.rotation = Mathf.mod(req.rotation + 2, 4); + } + } }