Fix major bug with dumping of blocks and conveyors

This commit is contained in:
Anuken
2017-12-12 15:43:02 -05:00
parent de6ccbbc88
commit 84c5938236
7 changed files with 14 additions and 18 deletions

View File

@ -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="26"
android:versionName="3.09b" >
android:versionCode="27"
android:versionName="3.0" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />
<uses-permission android:name="com.android.vending.BILLING" />

View File

@ -85,8 +85,8 @@ public class Vars{
"- Music made by [GREEN]RoccoW[] / found on [lime]FreeMusicArchive.org[]",
"",
"Special thanks to:",
"- MitchellFJN: extensive playtesting and feedback",
"- Luxray5474: wiki work, code contributions",
"- [coral]MitchellFJN[]: extensive playtesting and feedback",
"- [sky]Luxray5474[]: wiki work, code contributions",
"- All the beta testers on itch.io and Google Play"
};
}

View File

@ -112,7 +112,7 @@ public class UI extends SceneModule{
Draw.color();
TextureRegion back = Draw.region("background");
float backscl = 4.5f;
float backscl = 5f;
Draw.alpha(0.7f);
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,

View File

@ -157,7 +157,7 @@ public class BlocksFragment implements Fragment{
header.addImage(region).size(8*5).padTop(4).units(Unit.dp);
Label nameLabel = new Label(recipe.result.formalName);
nameLabel.setWrap(true);
header.add(nameLabel).padLeft(2).width(135f).units(Unit.dp);
header.add(nameLabel).padLeft(2).width(130f).units(Unit.dp);
//extra info
if(recipe.result.fullDescription != null){
@ -203,7 +203,7 @@ public class BlocksFragment implements Fragment{
}).size(110, 50).pad(10f).units(Unit.dp);
d.show();
}).expandX().padLeft(4).top().right().size(42f, 46f).padTop(-2).units(Unit.dp);
}).expandX().padLeft(3).top().right().size(40f, 44f).padTop(-2).units(Unit.dp);
}

View File

@ -144,16 +144,13 @@ public class Block{
* containers, it gets added to the block's inventory.*/
protected void offloadNear(Tile tile, Item item){
byte i = tile.getDump();
byte pdump = tile.getDump();
byte pdump = i;
Tile[] tiles = tile.getNearby();
for(int j = 0; j < 4; j ++){
Tile other = tiles[i];
if(other != null && other.block().acceptItem(item, other, tile)
//don't output to things facing this thing
&& !(other.block().rotate && (other.getRotation() + 2) % 4 == i)){
if(other != null && other.block().acceptItem(item, other, tile)){
other.block().handleItem(item, other, tile);
tile.setDump((byte)((i+1)%4));
return;
@ -181,20 +178,19 @@ public class Block{
for(int j = 0; j < 4; j ++){
Tile other = tiles[i];
if(i == direction || direction == -1)
if(i == direction || direction == -1){
for(Item item : Item.values()){
if(todump != null && item != todump) continue;
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)*/){
if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, tile)){
other.block().handleItem(item, other, tile);
tile.entity.removeItem(item, 1);
tile.setDump((byte)((i+1)%4));
return true;
}
}
}
i++;
i %= 4;
}

View File

@ -127,7 +127,7 @@ public class Tile{
}
public void setRotation(byte rotation){
data = Bits.packShort(rotation, getDump());
data = Bits.packShort(rotation, Bits.getRightByte(data));
}
public void setDump(byte dump){

View File

@ -120,7 +120,7 @@ public class Conveyor extends Block{
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)) && (source == null || !((source.getRotation() + 2) % 4 == dest.getRotation()));
((direction %2 == 1) && minitem > 0.52f)) && (source == null || !(source.block().rotate && (source.getRotation() + 2) % 4 == dest.getRotation()));
}
@Override