Fix #10, tweak tunnel range, change tunnel sprite
This commit is contained in:
@@ -154,9 +154,9 @@ public class Renderer extends RendererModule{
|
||||
|
||||
camera.position.set(lastx - deltax, lasty - deltay, 0);
|
||||
|
||||
if(Vars.debug){
|
||||
record();
|
||||
}
|
||||
//if(Vars.debug){
|
||||
record();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ public class WaveCreator{
|
||||
after = 4;
|
||||
amount = 3;
|
||||
spacing = 5;
|
||||
scaling = 1;
|
||||
scaling = 2;
|
||||
tierscaleback = 0;
|
||||
}},
|
||||
|
||||
new EnemySpawn(TankEnemy.class){{
|
||||
after = 5;
|
||||
spacing = 5;
|
||||
scaling = 1;
|
||||
scaling = 2;
|
||||
amount = 2;
|
||||
}},
|
||||
|
||||
@@ -64,7 +64,7 @@ public class WaveCreator{
|
||||
after = 6;
|
||||
amount = 2;
|
||||
spacing = 5;
|
||||
scaling = 2;
|
||||
scaling = 3;
|
||||
}},
|
||||
|
||||
new EnemySpawn(FlamerEnemy.class){{
|
||||
@@ -78,14 +78,14 @@ public class WaveCreator{
|
||||
after = 15;
|
||||
amount = 1;
|
||||
spacing = 5;
|
||||
scaling = 1;
|
||||
scaling = 2;
|
||||
}},
|
||||
|
||||
new EnemySpawn(BlastEnemy.class){{
|
||||
after = 4 + 5 + 5;
|
||||
amount = 3;
|
||||
spacing = 5;
|
||||
scaling = 1;
|
||||
scaling = 2;
|
||||
tierscaleback = 0;
|
||||
}},
|
||||
//boss wave
|
||||
@@ -117,14 +117,14 @@ public class WaveCreator{
|
||||
after = 16 + 5;
|
||||
amount = 1;
|
||||
spacing = 5;
|
||||
scaling = 2;
|
||||
scaling = 3;
|
||||
}},
|
||||
|
||||
new EnemySpawn(EmpEnemy.class){{
|
||||
after = 16 + 5;
|
||||
amount = 1;
|
||||
spacing = 5;
|
||||
scaling = 2;
|
||||
scaling = 3;
|
||||
}}
|
||||
//end enchanced boss wave
|
||||
);
|
||||
|
||||
@@ -174,7 +174,7 @@ public class Block{
|
||||
* Try dumping any item near the tile. -1 = any direction
|
||||
*/
|
||||
protected boolean tryDump(Tile tile, int direction, Item todump){
|
||||
int i = tile.getDump();
|
||||
int i = tile.getDump()%4;
|
||||
|
||||
Tile[] tiles = tile.getNearby();
|
||||
|
||||
@@ -186,9 +186,9 @@ public class Block{
|
||||
|
||||
if(todump != null && item != todump) continue;
|
||||
|
||||
if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, tile) &&
|
||||
if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, tile)
|
||||
//don't output to things facing this thing
|
||||
!(other.block().rotate && (other.getRotation() + 2) % 4 == i)){
|
||||
/*!(other.block().rotate && (other.getRotation() + 2) % 4 == i)*/){
|
||||
other.block().handleItem(item, other, tile);
|
||||
tile.entity.removeItem(item, 1);
|
||||
tile.setDump((byte)((i+1)%4));
|
||||
|
||||
@@ -17,7 +17,7 @@ public class Tile{
|
||||
|
||||
/**Packed block data. Left is floor, right is block.*/
|
||||
private short blocks;
|
||||
/**Packed data. Left is rotation, right is dump.*/
|
||||
/**Packed data. Left is rotation, right is extra data, packed into two half-bytes: left is dump, right is extra.*/
|
||||
private short data;
|
||||
/**The coordinates of the core tile this is linked to, in the form of two bytes packed into one.
|
||||
* This is relative to the block it is linked to; negate coords to find the link.*/
|
||||
|
||||
@@ -119,8 +119,8 @@ public class Conveyor extends Block{
|
||||
public boolean acceptItem(Item item, Tile dest, Tile source){
|
||||
int direction = source == null ? 0 : Math.abs(source.relativeTo(dest.x, dest.y) - dest.getRotation());
|
||||
float minitem = dest.<ConveyorEntity>entity().minitem;
|
||||
return ((direction == 0) && minitem > 0.05f) ||
|
||||
((direction %2 == 1) && minitem > 0.52f);
|
||||
return (((direction == 0) && minitem > 0.05f) ||
|
||||
((direction %2 == 1) && minitem > 0.52f)) && (source == null || !((source.getRotation() + 2) % 4 == dest.getRotation()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ public class PowerLaser extends Generator{
|
||||
solid = true;
|
||||
explosive = false;
|
||||
laserDirections = 1;
|
||||
health = 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,9 +33,12 @@ public class Router extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
//TODO fix, check issue
|
||||
tile.setRotation((byte)Mathf.mod(tile.getRotation(), 4));
|
||||
|
||||
if(tile.entity.timer.get(timerDump, 2) && tile.entity.totalItems() > 0){
|
||||
if(tile.getExtra() != tile.getRotation()
|
||||
|| Mathf.chance(0.3)){ //sometimes dump backwards at a 1/4 chance... this somehow works?
|
||||
|| Mathf.chance(0.35)){ //sometimes dump backwards at a 1/4 chance... this somehow works?
|
||||
tryDump(tile, tile.getRotation(), null);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class TunnelConveyor extends Block{
|
||||
protected int maxdist = 3;
|
||||
|
||||
protected TunnelConveyor(String name) {
|
||||
super(name);
|
||||
@@ -21,25 +22,37 @@ public class TunnelConveyor extends Block{
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
Tile to = getOther(tile, dir, 3);
|
||||
Tile inter = getOther(tile, dir, 2);
|
||||
Tile tunnel = getDestTunnel(tile);
|
||||
Tile to = tunnel.getNearby()[tunnel.getRotation()];
|
||||
|
||||
Timers.run(25, ()->{
|
||||
if(to == null || to.entity == null) return;
|
||||
to.block().handleItem(item, to, inter);
|
||||
to.block().handleItem(item, to, tunnel);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile dest, Tile source){
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
Tile to = getOther(dest, dir, 3);
|
||||
Tile inter = getOther(dest, dir, 2);
|
||||
return to != null && inter != null && source.getRotation() == (dest.getRotation() + 2)%4 && inter.block() instanceof TunnelConveyor
|
||||
&& (inter.getRotation() + 2) % 4 == dest.getRotation() &&
|
||||
to.block().acceptItem(item, to, inter);
|
||||
Tile tunnel = getDestTunnel(dest);
|
||||
if(tunnel != null){
|
||||
Tile to = tunnel.getNearby()[tunnel.getRotation()];
|
||||
return to != null && to.block().acceptItem(item, to, tunnel);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Tile getDestTunnel(Tile tile){
|
||||
Tile dest = tile;
|
||||
int rel = (tile.getRotation() + 2)%4;
|
||||
for(int i = 0; i < maxdist; i ++){
|
||||
dest = dest.getNearby()[rel];
|
||||
if(dest != null && dest.block() instanceof TunnelConveyor && dest.getRotation() == rel){
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Tile getOther(Tile tile, int dir, int amount){
|
||||
|
||||
Reference in New Issue
Block a user