Skip to content

Commit

Permalink
Fix #10, tweak tunnel range, change tunnel sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Dec 11, 2017
1 parent a5f3ddc commit 2d9710c
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 29 deletions.
4 changes: 2 additions & 2 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.anuke.mindustry"
android:versionCode="22"
android:versionName="3.06b" >
android:versionCode="23"
android:versionName="3.07b" >

<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />

Expand Down
Binary file modified core/assets-raw/sprites/blocks/conveyortunnel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed core/assets/maps/out-1512096271461.png
Binary file not shown.
Binary file modified core/assets/maps/scorch.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified core/assets/sprites/sprites.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions core/src/io/anuke/mindustry/core/Renderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ public void update(){

camera.position.set(lastx - deltax, lasty - deltay, 0);

if(Vars.debug){
record();
}
//if(Vars.debug){
record();
//}
}
}

Expand Down
14 changes: 7 additions & 7 deletions core/src/io/anuke/mindustry/entities/WaveCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public static Array<EnemySpawn> getSpawns(){
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;
}},

Expand Down Expand Up @@ -64,7 +64,7 @@ public static Array<EnemySpawn> getSpawns(){
after = 6;
amount = 2;
spacing = 5;
scaling = 2;
scaling = 3;
}},

new EnemySpawn(FlamerEnemy.class){{
Expand All @@ -78,14 +78,14 @@ public static Array<EnemySpawn> getSpawns(){
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
Expand Down Expand Up @@ -117,14 +117,14 @@ public static Array<EnemySpawn> getSpawns(){
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
);
Expand Down
6 changes: 3 additions & 3 deletions core/src/io/anuke/mindustry/world/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected boolean tryDump(Tile tile){
* 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();

Expand All @@ -186,9 +186,9 @@ protected boolean tryDump(Tile tile, int direction, Item todump){

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));
Expand Down
2 changes: 1 addition & 1 deletion core/src/io/anuke/mindustry/world/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public TileEntity getEntity(){
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public PowerLaser(String name) {
solid = true;
explosive = false;
laserDirections = 1;
health = 50;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ public boolean canReplace(Block other){

@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.anuke.ucore.core.Timers;

public class TunnelConveyor extends Block{
protected int maxdist = 3;

protected TunnelConveyor(String name) {
super(name);
Expand All @@ -21,25 +22,37 @@ public boolean canReplace(Block other){

@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){
Expand Down

0 comments on commit 2d9710c

Please sign in to comment.