Fixed some problems with Generators

This commit is contained in:
Anuken
2018-03-11 10:07:12 -04:00
parent 5834dc9b2e
commit 9674ca5e87
4 changed files with 12 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Sun Mar 11 09:45:55 EDT 2018 #Sun Mar 11 10:06:17 EDT 2018
version=release version=release
androidBuildCode=441 androidBuildCode=441
name=Mindustry name=Mindustry

View File

@@ -127,9 +127,8 @@ public class UI extends SceneModule{
if(Vars.debug && !Vars.showUI) return; if(Vars.debug && !Vars.showUI) return;
if(Graphics.drawing()) Graphics.end(); if(Graphics.drawing()) Graphics.end();
scene.act(); act();
scene.draw();
if(control.showCursor()) { if(control.showCursor()) {
Draw.color(); Draw.color();

View File

@@ -71,6 +71,14 @@ public class Tile{
if(x == cx + 1 && y == cy) return 2; if(x == cx + 1 && y == cy) return 2;
return -1; 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 extends TileEntity> T entity(){ public <T extends TileEntity> T entity(){
return (T)entity; return (T)entity;

View File

@@ -214,7 +214,7 @@ public class Generator extends PowerBlock{
float r = interfering ? 0f : 0f; float r = interfering ? 0f : 0f;
int relative = tile.relativeTo(target.x, target.y); int relative = tile.sizedRelativeTo(target.x, target.y);
if(relative == -1){ if(relative == -1){
Shapes.laser("laser", "laserend", tile.worldx() + t2.x, tile.worldy() + t2.y, Shapes.laser("laser", "laserend", tile.worldx() + t2.x, tile.worldy() + t2.y,