mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-13 01:07:30 +07:00
Changed tunnel buffer system (again)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sun Apr 01 12:07:12 EDT 2018
|
||||
#Mon Apr 02 14:23:38 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=492
|
||||
androidBuildCode=493
|
||||
name=Mindustry
|
||||
code=3.5
|
||||
build=custom build
|
||||
|
@ -1,10 +1,12 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.NumberUtils;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.BlockBar;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Bits;
|
||||
@ -21,6 +23,7 @@ public class TunnelConveyor extends Block{
|
||||
solid = true;
|
||||
health = 70;
|
||||
instantTransfer = true;
|
||||
bars.add(new BlockBar(Color.GREEN, true, tile -> (float)tile.<TunnelEntity>entity().index/capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,11 +37,6 @@ public class TunnelConveyor extends Block{
|
||||
|
||||
if(entity.index >= entity.buffer.length) return;
|
||||
|
||||
Tile tunnel = getDestTunnel(tile, item);
|
||||
if(tunnel == null) return;
|
||||
Tile to = tunnel.getNearby(tunnel.getRotation());
|
||||
if(to == null) return;
|
||||
|
||||
entity.buffer[entity.index ++] = Bits.packLong(NumberUtils.floatToIntBits(Timers.time()), item.id);
|
||||
}
|
||||
|
||||
@ -71,6 +69,8 @@ public class TunnelConveyor extends Block{
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
TunnelEntity entity = tile.entity();
|
||||
int rot = source.relativeTo(tile.x, tile.y);
|
||||
if(rot != (tile.getRotation() + 2)%4) return false;
|
||||
return entity.index < entity.buffer.length - 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user