1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 13:57:46 +03:00

Added a long list of content

This commit is contained in:
Anuken 2017-09-17 23:19:54 -04:00
parent 0e8204b243
commit 1b870da997
107 changed files with 833 additions and 544 deletions

View File

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

View File

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

View File

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

View File

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View File

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View File

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

View File

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 197 B

View File

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

View File

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

View File

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 240 B

View File

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

View File

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

View File

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

View File

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 252 B

View File

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

View File

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View File

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 341 B

View File

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View File

Before

Width:  |  Height:  |  Size: 343 B

After

Width:  |  Height:  |  Size: 343 B

View File

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

View File

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

View File

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 236 B

View File

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 235 B

View File

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 226 B

View File

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

View File

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 325 B

View File

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View File

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 374 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View File

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

View File

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

View File

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View File

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 243 B

View File

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 317 B

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View File

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View File

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 346 B

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 368 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -126,7 +126,7 @@ public class Control extends ControlModule{
Renderer.clearTiles();
player.x = World.core.worldx();
player.y = World.core.worldy()-8;
player.y = World.core.worldy() - 8f - ((int)(Gdx.graphics.getWidth() / (float)Core.cameraScale * 2) % 2 == 0 ? 0.5f : 0);
control.camera.position.set(player.x, player.y, 0);

View File

@ -16,10 +16,11 @@ public class Inventory{
items.put(Item.stone, 40);
if(debug){
items.put(Item.stone, 2000);
items.put(Item.iron, 2000);
items.put(Item.steel, 2000);
items.put(Item.coal, 2000);
items.put(Item.stone, 2000000);
items.put(Item.iron, 2000000);
items.put(Item.steel, 2000000);
items.put(Item.coal, 2000000);
items.put(Item.titanium, 2000000);
}
}

View File

@ -3,6 +3,8 @@ package io.anuke.mindustry;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.ucore.scene.actions.Actions.*;
import java.text.NumberFormat;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
@ -62,6 +64,7 @@ public class UI extends SceneModule{
Colors.put("description", Color.WHITE);
Colors.put("turretinfo", Color.ORANGE);
Colors.put("missingitems", Color.SCARLET);
Colors.put("health", Color.YELLOW);
}
void drawBackground(){
@ -187,7 +190,7 @@ public class UI extends SceneModule{
new table("button"){{
int rows = 3;
int rows = 4;
int maxcol = 0;
float size = 46;
@ -218,6 +221,7 @@ public class UI extends SceneModule{
group.add(button);
table.pad(4);
table.top();
int i = 0;
@ -231,7 +235,7 @@ public class UI extends SceneModule{
}
});
table.add(image).size(size+8).pad(4).units(Unit.dp);
table.add(image).size(size+8).pad(2).units(Unit.dp);
image.getImageCell().size(size).units(Unit.dp);
image.update(()->{
@ -286,30 +290,32 @@ public class UI extends SceneModule{
atop();
aleft();
defaults().size(66).units(Unit.dp);
//TODO menu buttons!
new imagebutton("icon-menu", 40, ()->{
showMenu();
});
new imagebutton("icon-settings", 40, ()->{
prefs.show();
});
new table(){{
left();
defaults().size(66).units(Unit.dp).left();
new imagebutton("icon-menu", 40, ()->{
showMenu();
});
new imagebutton("icon-settings", 40, ()->{
prefs.show();
});
new imagebutton("icon-pause", 40, ()->{
//TODO pause
});
new imagebutton("icon-pause", 40, ()->{
//TODO pause
});
}}.end();
row();
itemtable = new table("button").end().top().left().colspan(3).fillX().size(-1).get();
itemtable = new table("button").end().top().left().fillX().size(-1).get();
get().setVisible(play);
Label fps = new Label(()->(Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") : ""));
row();
add(fps).colspan(3).size(-1);
add(fps).size(-1);
}}.end();
@ -484,11 +490,16 @@ public class UI extends SceneModule{
desctable.left();
desctable.pad(12);
desctable.add(recipe.result.formalName);
desctable.row();
desctable.addImage(Draw.region(recipe.result.name)).size(8*5).padTop(4);
Table header = new Table();
desctable.add(header).left();
desctable.row();
header.addImage(Draw.region(recipe.result.name)).size(8*5).padTop(4);
header.add(recipe.result.formalName).padLeft(4);
desctable.add().pad(2);
Table requirements = new Table();
@ -518,11 +529,11 @@ public class UI extends SceneModule{
desctable.row();
if(recipe.result.description() != null){
Label label = new Label(recipe.result.description());
label.setWrap(true);
desctable.add(label).width(170).padTop(4);
}
Label label = new Label("[health]health: " + recipe.result.health + (recipe.result.description() == null ?
"" : ("\n[]" + recipe.result.description())));
label.setWrap(true);
desctable.add(label).width(200).padTop(4);
}
public void updateWeapons(){
@ -611,9 +622,9 @@ public class UI extends SceneModule{
for(Item stack : Inventory.getItemTypes()){
Image image = new Image(Draw.region("icon-" + stack.name()));
Label label = new Label("" + Inventory.getAmount(stack));
label.setFontScale(fontscale*2f);
itemtable.add(image).size(32).units(Unit.dp);
Label label = new Label("" + NumberFormat.getIntegerInstance().format(Inventory.getAmount(stack)));
label.setFontScale(fontscale*1.5f);
itemtable.add(image).size(8*3).units(Unit.dp);
itemtable.add(label).left();
itemtable.row();
}

View File

@ -169,7 +169,7 @@ public class World{
static void set(int x, int y, Block type, int rot){
tiles[x][y].setBlock(type);
tiles[x][y].rotation = rot;
tiles[x][y].rotation = (byte)rot;
}
public static int getSeed(){
@ -195,10 +195,10 @@ public class World{
return false;
}
}
Tile tile = tile(x, y);
if(tile.block() != type && ((tile.block().name.contains("wall") && type.name.contains("wall")) ||
(tile.block().name.contains("conveyor") && type.name.contains("conveyor")))){
if(tile.block() != type && type.canReplace(tile.block())){
return true;
}

View File

@ -78,7 +78,7 @@ public class AndroidInput extends InputAdapter{
return; //just in case
tile.setBlock(player.recipe.result);
tile.rotation = player.rotation;
tile.rotation = (byte)player.rotation;
Effects.effect("place", tilex*tilesize, tiley*tilesize);
Effects.shake(2f, 2f);

View File

@ -53,7 +53,7 @@ public class Input{
return; //just in case
tile.setBlock(player.recipe.result);
tile.rotation = player.rotation;
tile.rotation = (byte)player.rotation;
Effects.effect("place", World.roundx(), World.roundy());
Effects.shake(2f, 2f);

View File

@ -356,7 +356,7 @@ public class SaveIO{
tile.setBlock(Block.getByID(blockid));
if(hasEntity){
int rotation = stream.readByte();
byte rotation = stream.readByte();
int health = stream.readInt();
int items = stream.readByte();

View File

@ -0,0 +1,13 @@
package io.anuke.mindustry.resource;
import com.badlogic.gdx.graphics.Color;
public enum Liquid{
water(Color.ROYAL);
public final Color color;
private Liquid(Color color){
this.color = new Color(color);
}
}

View File

@ -13,25 +13,34 @@ public enum Recipe{
stonewall(distribution, Blocks.stonewall, stack(Item.stone, 5)),
ironwall(distribution, Blocks.ironwall, stack(Item.iron, 5)),
steelwall(distribution, Blocks.steelwall, stack(Item.steel, 5)),
titaniumwall(distribution, Blocks.titaniumwall, stack(Item.titanium, 5)),
conveyor(distribution, ProductionBlocks.conveyor, stack(Item.stone, 1)),
fastconveyor(distribution, ProductionBlocks.steelconveyor, stack(Item.steel, 1)),
router(distribution, ProductionBlocks.router, stack(Item.stone, 3)),
junction(distribution, ProductionBlocks.junction, stack(Item.iron, 5)),
conduit(distribution, ProductionBlocks.conduit, stack(Item.steel, 1)),
pump(distribution, ProductionBlocks.pump, stack(Item.steel, 20)),
turret(defense, WeaponBlocks.turret, stack(Item.stone, 6)),
dturret(defense, WeaponBlocks.doubleturret, stack(Item.stone, 12)),
machineturret(defense, WeaponBlocks.machineturret, stack(Item.iron, 15), stack(Item.stone, 20)),
shotgunturret(defense, WeaponBlocks.shotgunturret, stack(Item.iron, 18), stack(Item.stone, 20)),
flameturret(defense, WeaponBlocks.flameturret, stack(Item.iron, 25), stack(Item.steel, 18)),
sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 30), stack(Item.steel, 20)),
laserturret(defense, WeaponBlocks.laserturret, stack(Item.steel, 20), stack(Item.titanium, 20)),
mortarturret(defense, WeaponBlocks.mortarturret, stack(Item.steel, 25), stack(Item.titanium, 25)),
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 40)),
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 45)),
megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 30), stack(Item.steel, 40)),
drill(production, ProductionBlocks.stonedrill, stack(Item.stone, 6)),
irondrill(production, ProductionBlocks.irondrill, stack(Item.stone, 40)),
coaldrill(production, ProductionBlocks.coaldrill, stack(Item.stone, 40), stack(Item.iron, 40)),
smelter(production, ProductionBlocks.smelter, stack(Item.stone, 80), stack(Item.iron, 80));
titaniumdrill(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)),
omnidrill(production, ProductionBlocks.omnidrill, stack(Item.steel, 50), stack(Item.titanium, 50)),
smelter(production, ProductionBlocks.smelter, stack(Item.stone, 80), stack(Item.iron, 80)),
crucible(production, ProductionBlocks.crucible, stack(Item.titanium, 80), stack(Item.steel, 80));
public Block result;
public ItemStack[] requirements;

View File

@ -59,6 +59,10 @@ public class Block{
public String errorMessage(Tile tile){
return null;
}
public boolean canReplace(Block other){
return false;
}
public void handleItem(Tile tile, Item item, Tile source){
tile.entity.addItem(item, 1);
@ -91,13 +95,13 @@ public class Block{
&& !(other.block().rotate && (other.rotation + 2) % 4 == i)){
other.block().handleItem(other, item, tile);
tile.dump = (i+1)%4;
tile.dump = (byte)((i+1)%4);
return;
}
i++;
i %= 4;
}
tile.dump = pdump;
tile.dump = (byte)pdump;
handleItem(tile, item, tile);
}
@ -127,7 +131,7 @@ public class Block{
!(other.block().rotate && (other.rotation + 2) % 4 == i)){
other.block().handleItem(other, item, tile);
tile.entity.removeItem(item, 1);
tile.dump = (i+1)%4;
tile.dump = (byte)((i+1)%4);
return true;
}
}

View File

@ -11,7 +11,8 @@ public class Tile{
private Block floor = Blocks.air;
private Block block = Blocks.air;
public TileEntity entity;
public int x, y, rotation, dump;
public int x, y;
public byte rotation, dump;
public Tile(int x, int y){
this.x = x;

View File

@ -4,6 +4,7 @@ import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.Wall;
public class Blocks{
public static final Block
@ -91,30 +92,22 @@ public class Blocks{
solid = true;
}},
stonewall = new Block("stonewall"){{
solid = true;
update = true;
stonewall = new Wall("stonewall"){{
health = 50;
formalName = "stone wall";
}},
ironwall = new Block("ironwall"){{
solid = true;
update = true;
ironwall = new Wall("ironwall"){{
health = 80;
formalName = "iron wall";
}},
steelwall = new Block("steelwall"){{
solid = true;
update = true;
steelwall = new Wall("steelwall"){{
health = 110;
formalName = "steel wall";
}},
titaniumwall = new Block("titaniumwall"){{
solid = true;
update = true;
titaniumwall = new Wall("titaniumwall"){{
health = 140;
formalName = "titanium wall";
}};

View File

@ -9,6 +9,7 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.*;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
@ -33,12 +34,20 @@ public class ProductionBlocks{
}
},
conduit = new Conduit("conduit"){{
}},
pump = new Pump("pump"){{
}},
conveyor = new Conveyor("conveyor"){{
update = true;
}},
steelconveyor = new Conveyor("steelconveyor"){{
update = true;
health = 55;
speed = 0.04f;
formalName = "steel conveyor";
}},

View File

@ -4,6 +4,8 @@ import io.anuke.mindustry.entities.BulletType;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.RepairTurret;
import io.anuke.mindustry.world.blocks.types.Turret;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
@ -14,7 +16,7 @@ public class WeaponBlocks{
{
formalName = "turret";
range = 50;
reload = 10f;
reload = 15f;
bullet = BulletType.stone;
ammo = Item.stone;
}
@ -97,6 +99,30 @@ public class WeaponBlocks{
}
},
//TODO
mortarturret = new Turret("mortarturret"){
{
formalName = "flak turret";
range = 120;
reload = 120f;
bullet = BulletType.sniper;
ammo = Item.coal;
health = 110;
}
},
//TODO
laserturret = new Turret("laserturret"){
{
formalName = "laser turret";
range = 60;
reload = 40f;
bullet = BulletType.sniper;
ammo = Item.coal;
health = 110;
}
},
repairturret = new RepairTurret("repairturret"){
{
formalName = "heal turret";

View File

@ -0,0 +1,99 @@
package io.anuke.mindustry.world.blocks.types;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Timers;
public class Conduit extends Block{
protected float capacity = 10f;
protected float flowfactor = 4f;
public Conduit(String name) {
super(name);
rotate = true;
update = true;
}
@Override
public void draw(Tile tile){
ConduitEntity entity = tile.entity();
Draw.rect(name() + "bottom", tile.worldx(), tile.worldy(), tile.rotation * 90);
if(entity.liquid != null && entity.amount > 0.01f){
Draw.color(entity.liquid.color);
Draw.alpha(entity.amount / capacity);
Draw.rect("conduitliquid", tile.worldx(), tile.worldy(), tile.rotation * 90);
Draw.color();
}
Draw.rect(name() + "top", tile.worldx(), tile.worldy(), tile.rotation * 90);
}
@Override
public TileEntity getEntity(){
return new ConduitEntity();
}
@Override
public void update(Tile tile){
ConduitEntity entity = tile.entity();
if(entity.amount > 0.01f && Timers.get(entity, "flow", 3)){
tryMoveLiquid(tile, tile.getNearby()[tile.rotation]);
entity.flowtime = 0f;
}
}
public void tryDumpLiquid(Tile tile){
ConduitEntity entity = tile.entity();
if(entity.amount > 0.01f){
tryMoveLiquid(tile, tile.getNearby()[tile.dump]);
tile.dump ++;
tile.dump %= 4;
}
}
public void tryMoveLiquid(Tile tile, Tile next){
ConduitEntity entity = tile.entity();
Liquid liquid = entity.liquid;
if(next != null && next.block() instanceof Conduit && entity.amount > 0.01f){
Conduit other = (Conduit)next.block();
ConduitEntity otherentity = next.entity();
float flow = Math.min(other.capacity - otherentity.amount - 0.001f, Math.min(entity.amount/flowfactor, entity.amount));
if(flow <= 0f || entity.amount < flow) return;
if(other.accept(next, tile, liquid, flow)){
other.addLiquid(next, tile, liquid, flow);
entity.amount -= flow;
}
}
}
public boolean accept(Tile tile, Tile source, Liquid liquid, float amount){
ConduitEntity entity = tile.entity();
return entity.amount + amount < capacity && (entity.liquid == liquid || entity.amount <= 0.01f);
}
public void addLiquid(Tile tile, Tile source, Liquid liquid, float amount){
ConduitEntity entity = tile.entity();
entity.liquid = liquid;
entity.amount += amount;
}
static class ConduitEntity extends TileEntity{
Liquid liquid;
float amount;
float flowtime;
}
}

View File

@ -1,4 +1,4 @@
package io.anuke.mindustry.world.blocks;
package io.anuke.mindustry.world.blocks.types;
import static io.anuke.mindustry.Vars.tilesize;
@ -18,7 +18,7 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
public class Conveyor extends Block{
float speed = 0.02f;
protected float speed = 0.02f;
protected Conveyor(String name) {
super(name);
@ -26,6 +26,10 @@ public class Conveyor extends Block{
update = true;
}
public boolean canReplace(Block other){
return other instanceof Conveyor;
}
@Override
public void draw(Tile tile){
ConveyorEntity entity = tile.entity();

Some files were not shown because too many files have changed in this diff Show More