Updated uCore / Made splitter distribute properly
This commit is contained in:
@@ -27,7 +27,7 @@ allprojects {
|
|||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = '2241e5402e'
|
uCoreVersion = 'f937c5cad6'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.async.AsyncExecutor;
|
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.io.BundleLoader;
|
import io.anuke.mindustry.io.BundleLoader;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
@@ -10,7 +9,6 @@ import io.anuke.ucore.util.Log;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Mindustry extends ModuleCore {
|
public class Mindustry extends ModuleCore {
|
||||||
private AsyncExecutor exec = new AsyncExecutor(1);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
|
|||||||
@@ -84,12 +84,12 @@ public class ProductionBlocks extends BlockList implements ContentList {
|
|||||||
updateEffect = BlockFx.pulverize;
|
updateEffect = BlockFx.pulverize;
|
||||||
liquidCapacity = 50f;
|
liquidCapacity = 50f;
|
||||||
updateEffectChance = 0.05f;
|
updateEffectChance = 0.05f;
|
||||||
pumpAmount = 0.06f;
|
pumpAmount = 0.08f;
|
||||||
size = 3;
|
size = 3;
|
||||||
liquidCapacity = 30f;
|
liquidCapacity = 30f;
|
||||||
|
|
||||||
consumes.item(Items.sand);
|
consumes.item(Items.sand);
|
||||||
consumes.power(0.6f);
|
consumes.power(0.5f);
|
||||||
consumes.liquid(Liquids.water, 0.3f);
|
consumes.liquid(Liquids.water, 0.3f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,13 @@ public class ItemBuffer {
|
|||||||
return index < buffer.length;
|
return index < buffer.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void accept(Item item){
|
public void accept(Item item, short data){
|
||||||
//if(!accepts()) return;
|
//if(!accepts()) return;
|
||||||
buffer[index ++] = Bits.packLong(NumberUtils.floatToIntBits(Timers.time()), item.id);
|
buffer[index ++] = Bits.packLong(NumberUtils.floatToIntBits(Timers.time()), Bits.packInt((short)item.id, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void accept(Item item){
|
||||||
|
accept(item, (short)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item poll(){
|
public Item poll(){
|
||||||
@@ -31,12 +35,24 @@ public class ItemBuffer {
|
|||||||
float time = NumberUtils.intBitsToFloat(Bits.getLeftInt(l));
|
float time = NumberUtils.intBitsToFloat(Bits.getLeftInt(l));
|
||||||
|
|
||||||
if(Timers.time() >= time + speed || Timers.time() < time){
|
if(Timers.time() >= time + speed || Timers.time() < time){
|
||||||
return Item.getByID(Bits.getRightInt(l));
|
return Item.getByID(Bits.getLeftShort(Bits.getRightInt(l)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public short pollData(){
|
||||||
|
if(index > 0){
|
||||||
|
long l = buffer[0];
|
||||||
|
float time = NumberUtils.intBitsToFloat(Bits.getLeftInt(l));
|
||||||
|
|
||||||
|
if(Timers.time() >= time + speed || Timers.time() < time){
|
||||||
|
return Bits.getRightShort(Bits.getRightInt(l));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public void remove(){
|
public void remove(){
|
||||||
System.arraycopy(buffer, 1, buffer, 0, index - 1);
|
System.arraycopy(buffer, 1, buffer, 0, index - 1);
|
||||||
index --;
|
index --;
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
package io.anuke.mindustry.world.blocks.distribution;
|
package io.anuke.mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import com.badlogic.gdx.math.GridPoint2;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Edges;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.meta.BlockGroup;
|
import io.anuke.mindustry.world.meta.BlockGroup;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
|
||||||
|
|
||||||
public class Splitter extends Block{
|
public class Splitter extends Block{
|
||||||
|
protected float speed = 30f;
|
||||||
|
|
||||||
public Splitter(String name){
|
public Splitter(String name){
|
||||||
super(name);
|
super(name);
|
||||||
solid = true;
|
solid = true;
|
||||||
instantTransfer = true;
|
instantTransfer = true;
|
||||||
destructible = true;
|
update = true;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,26 +21,24 @@ public class Splitter extends Block{
|
|||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
Tile to = getTileTarget(item, tile, source, false);
|
Tile to = getTileTarget(item, tile, source, false);
|
||||||
|
|
||||||
return to != null && to.block().acceptItem(item, to, tile);
|
return to != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
Tile to = getTileTarget(item, tile, source, true);
|
Tile to = getTileTarget(item, tile, source, true);
|
||||||
|
|
||||||
to.block().handleItem(item, to, tile);
|
to.block().handleItem(item, to, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){
|
Tile getTileTarget(Item item, Tile tile, Tile source, boolean flip){
|
||||||
GridPoint2[] points = Edges.getEdges(size);
|
Array<Tile> proximity = tile.entity.proximity();
|
||||||
int counter = source.getDump();
|
int counter = tile.getDump();
|
||||||
for (int i = 0; i < points.length; i++) {
|
for (int i = 0; i < proximity.size; i++) {
|
||||||
GridPoint2 point = points[(i + counter++) % points.length];
|
Tile other = proximity.get((i + counter) % proximity.size);
|
||||||
source.setDump((byte)(counter % points.length));
|
if(flip) tile.setDump((byte)((tile.getDump() + 1) % proximity.size));
|
||||||
Tile tile = world.tile(dest.x + point.x, dest.y + point.y);
|
if(other != source && !(source.block().instantTransfer && other.block().instantTransfer && !(other.block() instanceof Splitter)) &&
|
||||||
if(tile != source && !(tile.block().instantTransfer && source.block().instantTransfer) &&
|
other.block().acceptItem(item, other, tile)){
|
||||||
tile.block().acceptItem(item, tile, dest)){
|
return other;
|
||||||
return tile;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
super.setStats();
|
super.setStats();
|
||||||
|
|
||||||
stats.add(BlockStat.powerRange, laserRange, StatUnit.blocks);
|
stats.add(BlockStat.powerRange, laserRange, StatUnit.blocks);
|
||||||
stats.add(BlockStat.powerTransferSpeed, powerSpeed * 60, StatUnit.powerSecond);
|
stats.add(BlockStat.powerTransferSpeed, powerSpeed * 60 / 2f, StatUnit.powerSecond); //divided by 2 since passback exists
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user