Fix #10, tweak tunnel range, change tunnel sprite

This commit is contained in:
Anuken
2017-12-11 18:53:28 -05:00
parent a5f3ddcb2b
commit 2d9710c708
13 changed files with 46 additions and 29 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.anuke.mindustry" package="io.anuke.mindustry"
android:versionCode="22" android:versionCode="23"
android:versionName="3.06b" > android:versionName="3.07b" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" /> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -154,9 +154,9 @@ public class Renderer extends RendererModule{
camera.position.set(lastx - deltax, lasty - deltay, 0); camera.position.set(lastx - deltax, lasty - deltay, 0);
if(Vars.debug){ //if(Vars.debug){
record(); record();
} //}
} }
} }

View File

@@ -28,14 +28,14 @@ public class WaveCreator{
after = 4; after = 4;
amount = 3; amount = 3;
spacing = 5; spacing = 5;
scaling = 1; scaling = 2;
tierscaleback = 0; tierscaleback = 0;
}}, }},
new EnemySpawn(TankEnemy.class){{ new EnemySpawn(TankEnemy.class){{
after = 5; after = 5;
spacing = 5; spacing = 5;
scaling = 1; scaling = 2;
amount = 2; amount = 2;
}}, }},
@@ -64,7 +64,7 @@ public class WaveCreator{
after = 6; after = 6;
amount = 2; amount = 2;
spacing = 5; spacing = 5;
scaling = 2; scaling = 3;
}}, }},
new EnemySpawn(FlamerEnemy.class){{ new EnemySpawn(FlamerEnemy.class){{
@@ -78,14 +78,14 @@ public class WaveCreator{
after = 15; after = 15;
amount = 1; amount = 1;
spacing = 5; spacing = 5;
scaling = 1; scaling = 2;
}}, }},
new EnemySpawn(BlastEnemy.class){{ new EnemySpawn(BlastEnemy.class){{
after = 4 + 5 + 5; after = 4 + 5 + 5;
amount = 3; amount = 3;
spacing = 5; spacing = 5;
scaling = 1; scaling = 2;
tierscaleback = 0; tierscaleback = 0;
}}, }},
//boss wave //boss wave
@@ -117,14 +117,14 @@ public class WaveCreator{
after = 16 + 5; after = 16 + 5;
amount = 1; amount = 1;
spacing = 5; spacing = 5;
scaling = 2; scaling = 3;
}}, }},
new EnemySpawn(EmpEnemy.class){{ new EnemySpawn(EmpEnemy.class){{
after = 16 + 5; after = 16 + 5;
amount = 1; amount = 1;
spacing = 5; spacing = 5;
scaling = 2; scaling = 3;
}} }}
//end enchanced boss wave //end enchanced boss wave
); );

View File

@@ -174,7 +174,7 @@ public class Block{
* Try dumping any item near the tile. -1 = any direction * Try dumping any item near the tile. -1 = any direction
*/ */
protected boolean tryDump(Tile tile, int direction, Item todump){ protected boolean tryDump(Tile tile, int direction, Item todump){
int i = tile.getDump(); int i = tile.getDump()%4;
Tile[] tiles = tile.getNearby(); Tile[] tiles = tile.getNearby();
@@ -186,9 +186,9 @@ public class Block{
if(todump != null && item != todump) continue; 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 //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); other.block().handleItem(item, other, tile);
tile.entity.removeItem(item, 1); tile.entity.removeItem(item, 1);
tile.setDump((byte)((i+1)%4)); tile.setDump((byte)((i+1)%4));

View File

@@ -17,7 +17,7 @@ public class Tile{
/**Packed block data. Left is floor, right is block.*/ /**Packed block data. Left is floor, right is block.*/
private short blocks; 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; private short data;
/**The coordinates of the core tile this is linked to, in the form of two bytes packed into one. /**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.*/ * This is relative to the block it is linked to; negate coords to find the link.*/

View File

@@ -119,8 +119,8 @@ public class Conveyor extends Block{
public boolean acceptItem(Item item, Tile dest, Tile source){ public boolean acceptItem(Item item, Tile dest, Tile source){
int direction = source == null ? 0 : Math.abs(source.relativeTo(dest.x, dest.y) - dest.getRotation()); int direction = source == null ? 0 : Math.abs(source.relativeTo(dest.x, dest.y) - dest.getRotation());
float minitem = dest.<ConveyorEntity>entity().minitem; float minitem = dest.<ConveyorEntity>entity().minitem;
return ((direction == 0) && minitem > 0.05f) || return (((direction == 0) && minitem > 0.05f) ||
((direction %2 == 1) && minitem > 0.52f); ((direction %2 == 1) && minitem > 0.52f)) && (source == null || !((source.getRotation() + 2) % 4 == dest.getRotation()));
} }
@Override @Override

View File

@@ -16,6 +16,7 @@ public class PowerLaser extends Generator{
solid = true; solid = true;
explosive = false; explosive = false;
laserDirections = 1; laserDirections = 1;
health = 50;
} }
@Override @Override

View File

@@ -33,9 +33,12 @@ public class Router extends Block{
@Override @Override
public void update(Tile tile){ 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.entity.timer.get(timerDump, 2) && tile.entity.totalItems() > 0){
if(tile.getExtra() != tile.getRotation() 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); tryDump(tile, tile.getRotation(), null);
} }

View File

@@ -6,6 +6,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
public class TunnelConveyor extends Block{ public class TunnelConveyor extends Block{
protected int maxdist = 3;
protected TunnelConveyor(String name) { protected TunnelConveyor(String name) {
super(name); super(name);
@@ -21,25 +22,37 @@ public class TunnelConveyor extends Block{
@Override @Override
public void handleItem(Item item, Tile tile, Tile source){ public void handleItem(Item item, Tile tile, Tile source){
int dir = source.relativeTo(tile.x, tile.y); Tile tunnel = getDestTunnel(tile);
Tile to = getOther(tile, dir, 3); Tile to = tunnel.getNearby()[tunnel.getRotation()];
Tile inter = getOther(tile, dir, 2);
Timers.run(25, ()->{ Timers.run(25, ()->{
if(to == null || to.entity == null) return; if(to == null || to.entity == null) return;
to.block().handleItem(item, to, inter); to.block().handleItem(item, to, tunnel);
}); });
} }
@Override @Override
public boolean acceptItem(Item item, Tile dest, Tile source){ public boolean acceptItem(Item item, Tile dest, Tile source){
int dir = source.relativeTo(dest.x, dest.y); Tile tunnel = getDestTunnel(dest);
Tile to = getOther(dest, dir, 3); if(tunnel != null){
Tile inter = getOther(dest, dir, 2); Tile to = tunnel.getNearby()[tunnel.getRotation()];
return to != null && inter != null && source.getRotation() == (dest.getRotation() + 2)%4 && inter.block() instanceof TunnelConveyor return to != null && to.block().acceptItem(item, to, tunnel);
&& (inter.getRotation() + 2) % 4 == dest.getRotation() && }else{
to.block().acceptItem(item, to, inter); 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){ Tile getOther(Tile tile, int dir, int amount){