mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-23 22:28:08 +07:00
Updated version, teleporter tweaks
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Sun Feb 18 12:25:44 EST 2018
|
#Sun Feb 18 12:38:19 EST 2018
|
||||||
version=beta
|
version=beta
|
||||||
androidBuildCode=236
|
androidBuildCode=238
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.3
|
code=3.3
|
||||||
build=custom build
|
build=24
|
||||||
|
@ -89,6 +89,10 @@ public class Teleporter extends PowerBlock{
|
|||||||
TeleporterEntity entity = tile.entity();
|
TeleporterEntity entity = tile.entity();
|
||||||
|
|
||||||
teleporters[entity.color].add(tile);
|
teleporters[entity.color].add(tile);
|
||||||
|
|
||||||
|
if(entity.totalItems() > 0){
|
||||||
|
tryDump(tile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -130,12 +134,12 @@ public class Teleporter extends PowerBlock{
|
|||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
PowerEntity entity = tile.entity();
|
PowerEntity entity = tile.entity();
|
||||||
|
|
||||||
Array<Tile> links = findLinks(tile, item);
|
Array<Tile> links = findLinks(tile);
|
||||||
|
|
||||||
if(links.size > 0){
|
if(links.size > 0){
|
||||||
if(!syncBlockState || Net.server() || !Net.active()){
|
if(!syncBlockState || Net.server() || !Net.active()){
|
||||||
Tile target = links.random();
|
Tile target = links.random();
|
||||||
target.block().offloadNear(target, item);
|
target.entity.addItem(item, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +149,7 @@ public class Teleporter extends PowerBlock{
|
|||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
PowerEntity entity = tile.entity();
|
PowerEntity entity = tile.entity();
|
||||||
return !(source.block() instanceof Teleporter) && entity.power >= powerPerItem && findLinks(tile, item).size > 0;
|
return !(source.block() instanceof Teleporter) && entity.power >= powerPerItem && findLinks(tile).size > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -153,17 +157,7 @@ public class Teleporter extends PowerBlock{
|
|||||||
return new TeleporterEntity();
|
return new TeleporterEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean available(Tile tile, Item item){
|
private Array<Tile> findLinks(Tile tile){
|
||||||
for(int i = 0; i < 4; i ++){
|
|
||||||
Tile next = tile.getNearby(i);
|
|
||||||
if(next != null && !(next.block().instantTransfer) && next.block().acceptItem(item, next, tile)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Array<Tile> findLinks(Tile tile, Item output){
|
|
||||||
TeleporterEntity entity = tile.entity();
|
TeleporterEntity entity = tile.entity();
|
||||||
|
|
||||||
removal.clear();
|
removal.clear();
|
||||||
@ -174,7 +168,7 @@ public class Teleporter extends PowerBlock{
|
|||||||
if(other.block() instanceof Teleporter){
|
if(other.block() instanceof Teleporter){
|
||||||
if(other.<TeleporterEntity>entity().color != entity.color){
|
if(other.<TeleporterEntity>entity().color != entity.color){
|
||||||
removal.add(other);
|
removal.add(other);
|
||||||
}else if(((Teleporter)other.block()).available(other, output)){
|
}else if(other.entity.totalItems() == 0){
|
||||||
returns.add(other);
|
returns.add(other);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
Reference in New Issue
Block a user