Added canDump for vaults, better vault icon

This commit is contained in:
Anuken 2018-03-02 09:04:44 -05:00
parent 5faff6260e
commit 827f72f595
6 changed files with 22 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

@ -1250,9 +1250,16 @@ blocks/vault
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/vault-icon
rotate: false
xy: 927, 424
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/water blocks/water
rotate: false rotate: false
xy: 947, 424 xy: 737, 302
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@ -1280,7 +1287,7 @@ blocks/weaponfactory
index: -1 index: -1
blocks/weaponfactory-icon blocks/weaponfactory-icon
rotate: false rotate: false
xy: 737, 302 xy: 737, 292
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@ -2637,14 +2644,14 @@ weapons/triblaster-equip
index: -1 index: -1
weapons/vulcan weapons/vulcan
rotate: false rotate: false
xy: 927, 424 xy: 937, 424
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
weapons/vulcan-equip weapons/vulcan-equip
rotate: false rotate: false
xy: 937, 424 xy: 947, 424
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Thu Mar 01 23:34:49 EST 2018 #Thu Mar 01 23:39:21 EST 2018
version=release version=release
androidBuildCode=317 androidBuildCode=318
name=Mindustry name=Mindustry
code=3.4 code=3.4
build=custom build build=custom build

View File

@ -188,7 +188,7 @@ public class Block{
for(int j = 0; j < nearby.length; j ++){ for(int j = 0; j < nearby.length; j ++){
Tile other = tile.getNearby(nearby[j]); Tile other = tile.getNearby(nearby[j]);
Tile in = tile.getNearby(Edges.getInsideEdges(width)[j]); Tile in = tile.getNearby(Edges.getInsideEdges(width)[j]);
if(other != null && other.block().acceptItem(item, other, in)){ if(other != null && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
other.block().handleItem(item, other, in); other.block().handleItem(item, other, in);
return; return;
} }
@ -217,7 +217,7 @@ 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, in)){ if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
other.block().handleItem(item, other, in); other.block().handleItem(item, other, in);
tile.entity.removeItem(item, 1); tile.entity.removeItem(item, 1);
i = (byte)((i + 1) % nearby.length); i = (byte)((i + 1) % nearby.length);
@ -234,6 +234,11 @@ public class Block{
return false; return false;
} }
/**Used for dumping items.*/
public boolean canDump(Tile tile, Tile to, Item item){
return true;
}
/** /**
* Try offloading an item to a nearby container in its facing direction. Returns true if success. * Try offloading an item to a nearby container in its facing direction. Returns true if success.
*/ */

View File

@ -46,7 +46,8 @@ public class Vault extends Block {
return tile.entity.totalItems() < capacity; return tile.entity.totalItems() < capacity;
} }
boolean canOutput(Tile tile, Tile to){ @Override
public boolean canDump(Tile tile, Tile to, Item item){
return to != null && (to.block() instanceof Vault || to.block() instanceof CoreBlock); return to != null && (to.block() instanceof Vault || to.block() instanceof CoreBlock);
} }
} }