From 9674ca5e87b1bc30f51ca2674f3375c78dc067a9 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 11 Mar 2018 10:07:12 -0400 Subject: [PATCH] Fixed some problems with Generators --- core/assets/version.properties | 2 +- core/src/io/anuke/mindustry/core/UI.java | 5 ++--- core/src/io/anuke/mindustry/world/Tile.java | 8 ++++++++ .../world/blocks/types/generation/Generator.java | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/assets/version.properties b/core/assets/version.properties index 71309464d5..5ec49a4f3a 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,5 +1,5 @@ #Autogenerated file. Do not modify. -#Sun Mar 11 09:45:55 EDT 2018 +#Sun Mar 11 10:06:17 EDT 2018 version=release androidBuildCode=441 name=Mindustry diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 0f57ad3fd4..45e936c3f2 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -127,9 +127,8 @@ public class UI extends SceneModule{ if(Vars.debug && !Vars.showUI) return; if(Graphics.drawing()) Graphics.end(); - - scene.act(); - scene.draw(); + + act(); if(control.showCursor()) { Draw.color(); diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index acdc1a201c..b5d0e96f01 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -71,6 +71,14 @@ public class Tile{ if(x == cx + 1 && y == cy) return 2; return -1; } + + public byte sizedRelativeTo(int cx, int cy){ + if(x == cx && y == cy - 1 - block().size/2) return 1; + if(x == cx && y == cy + 1 + block().size/2) return 3; + if(x == cx - 1 - block().size/2 && y == cy) return 0; + if(x == cx + 1 + block().size/2 && y == cy) return 2; + return -1; + } public T entity(){ return (T)entity; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java index ecbbb5bf73..b3245963ac 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java @@ -214,7 +214,7 @@ public class Generator extends PowerBlock{ float r = interfering ? 0f : 0f; - int relative = tile.relativeTo(target.x, target.y); + int relative = tile.sizedRelativeTo(target.x, target.y); if(relative == -1){ Shapes.laser("laser", "laserend", tile.worldx() + t2.x, tile.worldy() + t2.y,