Added oil block, power section, more block types
BIN
core/assets-raw/sprites/blocks/oil.png
Normal file
After Width: | Height: | Size: 156 B |
BIN
core/assets-raw/sprites/blocks/oiledge.png
Normal file
After Width: | Height: | Size: 239 B |
BIN
core/assets-raw/sprites/ui/icon-power.png
Normal file
After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
@ -50,6 +50,14 @@ public class EffectCreator{
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("oilbubble", 64f, e -> {
|
||||
Draw.color(Color.DARK_GRAY);
|
||||
float scl = 0.25f;
|
||||
Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
||||
Draw.circle(e.x, e.y, e.ifract()*3f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("shellexplosion", 15, e -> {
|
||||
Draw.thickness(1.3f - e.ifract());
|
||||
Draw.color(Hue.mix(Color.WHITE, Color.ORANGE, e.ifract()));
|
||||
|
@ -7,9 +7,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.GameState.State;
|
||||
import io.anuke.mindustry.io.Formatter;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.world.blocks.WeaponBlocks;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.modules.ModuleCore;
|
||||
@ -29,15 +27,17 @@ public class Mindustry extends ModuleCore {
|
||||
}
|
||||
|
||||
};
|
||||
//always initialize blocks in this order, otherwise there are ID errors
|
||||
public Class<?>[] blockClasses = new Class<?>[]{
|
||||
Blocks.class,
|
||||
DefenseBlocks.class,
|
||||
DistributionBlocks.class,
|
||||
ProductionBlocks.class,
|
||||
WeaponBlocks.class
|
||||
};
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
//always initialize blocks in this order, otherwise there are ID errors
|
||||
Blocks.dirt.getClass();
|
||||
ProductionBlocks.coaldrill.getClass();
|
||||
WeaponBlocks.turret.getClass();
|
||||
|
||||
|
||||
module(Vars.control = new Control());
|
||||
module(Vars.renderer = new Renderer());
|
||||
module(Vars.ui = new UI());
|
||||
|
@ -6,9 +6,7 @@ import io.anuke.mindustry.GameState.State;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.world.blocks.WeaponBlocks;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.builders.button;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
@ -198,7 +196,7 @@ public class Tutorial{
|
||||
blockRotation = 1;
|
||||
blockPlaceX = 0;
|
||||
blockPlaceY = -1;
|
||||
targetBlock = ProductionBlocks.conveyor;
|
||||
targetBlock = DistributionBlocks.conveyor;
|
||||
text = "Use [orange][[R][] to rotate the conveyor to face [orange]forwards[], then place it in the [yellow]marked location[] using the [orange][[left mouse button][].";
|
||||
}
|
||||
},
|
||||
@ -211,7 +209,7 @@ public class Tutorial{
|
||||
blockRotation = 1;
|
||||
blockPlaceX = 0;
|
||||
blockPlaceY = -1;
|
||||
targetBlock = ProductionBlocks.conveyor;
|
||||
targetBlock = DistributionBlocks.conveyor;
|
||||
text = "Use the [orange][[rotate button][] to rotate the conveyor to face [orange]forwards[], drag it into position with one finger, then place it in the [yellow]marked location[] using the [orange][[checkmark][].";
|
||||
}
|
||||
},
|
||||
@ -286,9 +284,9 @@ public class Tutorial{
|
||||
|
||||
void onSwitch(){
|
||||
for(int flip : new int[]{1, -1}){
|
||||
World.tile(World.core.x + flip, World.core.y - 1).setBlock(ProductionBlocks.conveyor, 2 * flip);
|
||||
World.tile(World.core.x + flip*2, World.core.y - 1).setBlock(ProductionBlocks.conveyor, 2 * flip);
|
||||
World.tile(World.core.x + flip*2, World.core.y - 2).setBlock(ProductionBlocks.conveyor, 1);
|
||||
World.tile(World.core.x + flip, World.core.y - 1).setBlock(DistributionBlocks.conveyor, 2 * flip);
|
||||
World.tile(World.core.x + flip*2, World.core.y - 1).setBlock(DistributionBlocks.conveyor, 2 * flip);
|
||||
World.tile(World.core.x + flip*2, World.core.y - 2).setBlock(DistributionBlocks.conveyor, 1);
|
||||
World.tile(World.core.x + flip*2, World.core.y - 3).setFloor(Blocks.stone);
|
||||
World.tile(World.core.x + flip*2, World.core.y - 3).setBlock(ProductionBlocks.stonedrill);
|
||||
|
||||
@ -452,7 +450,7 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = ProductionBlocks.conduit;
|
||||
targetBlock = DistributionBlocks.conduit;
|
||||
blockPlaceX = 5;
|
||||
blockPlaceY = -2;
|
||||
blockRotation = 2;
|
||||
@ -470,7 +468,7 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = ProductionBlocks.conduit;
|
||||
targetBlock = DistributionBlocks.conduit;
|
||||
blockPlaceX = 4;
|
||||
blockPlaceY = -2;
|
||||
blockRotation = 1;
|
||||
@ -487,7 +485,7 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = ProductionBlocks.conduit;
|
||||
targetBlock = DistributionBlocks.conduit;
|
||||
blockPlaceX = 4;
|
||||
blockPlaceY = -1;
|
||||
blockRotation = 1;
|
||||
@ -530,14 +528,14 @@ public class Tutorial{
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i ++){
|
||||
World.tile(World.core.x + 4 - 1 - i, World.core.y).setBlock(ProductionBlocks.conveyor, 2);
|
||||
World.tile(World.core.x + 4 - 1 - i, World.core.y).setBlock(DistributionBlocks.conveyor, 2);
|
||||
}
|
||||
|
||||
World.tile(World.core.x + 2, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 0);
|
||||
World.tile(World.core.x + 3, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 0);
|
||||
World.tile(World.core.x + 4, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 3);
|
||||
World.tile(World.core.x + 5, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 2);
|
||||
World.tile(World.core.x + 6, World.core.y + 1).setBlock(ProductionBlocks.conveyor, 2);
|
||||
World.tile(World.core.x + 2, World.core.y + 1).setBlock(DistributionBlocks.conveyor, 0);
|
||||
World.tile(World.core.x + 3, World.core.y + 1).setBlock(DistributionBlocks.conveyor, 0);
|
||||
World.tile(World.core.x + 4, World.core.y + 1).setBlock(DistributionBlocks.conveyor, 3);
|
||||
World.tile(World.core.x + 5, World.core.y + 1).setBlock(DistributionBlocks.conveyor, 2);
|
||||
World.tile(World.core.x + 6, World.core.y + 1).setBlock(DistributionBlocks.conveyor, 2);
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -53,7 +53,8 @@ public class Pathfind{
|
||||
}
|
||||
|
||||
static public void updatePath(){
|
||||
if(paths.size == 0){
|
||||
if(paths.size == 0 || paths.size != World.spawnpoints.size){
|
||||
paths.clear();
|
||||
pathSequences = new Tile[World.spawnpoints.size][0];
|
||||
for(int i = 0; i < World.spawnpoints.size; i ++){
|
||||
SmoothGraphPath path = new SmoothGraphPath();
|
||||
|
@ -5,7 +5,8 @@ import com.badlogic.gdx.graphics.Color;
|
||||
public enum Liquid{
|
||||
water(Color.ROYAL),
|
||||
plasma(Color.CORAL),
|
||||
lava(Color.valueOf("ed5334"));
|
||||
lava(Color.valueOf("ed5334")),
|
||||
oil(Color.valueOf("292929"));
|
||||
|
||||
public final Color color;
|
||||
|
||||
|
@ -5,22 +5,20 @@ import static io.anuke.mindustry.resource.Section.*;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.world.blocks.WeaponBlocks;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
|
||||
public enum Recipe{
|
||||
stonewall(distribution, Blocks.stonewall, stack(Item.stone, 2)),
|
||||
ironwall(distribution, Blocks.ironwall, stack(Item.iron, 2)),
|
||||
steelwall(distribution, Blocks.steelwall, stack(Item.steel, 2)),
|
||||
titaniumwall(distribution, Blocks.titaniumwall, stack(Item.titanium, 2)),
|
||||
duriumwall(distribution, Blocks.diriumwall, stack(Item.dirium, 2)),
|
||||
compositewall(distribution, Blocks.compositewall, stack(Item.dirium, 2), stack(Item.titanium, 2), stack(Item.steel, 2), stack(Item.iron, 2)),
|
||||
titaniumshieldwall(distribution, Blocks.titaniumshieldwall, stack(Item.titanium, 2)),
|
||||
conveyor(distribution, ProductionBlocks.conveyor, stack(Item.stone, 1)),
|
||||
fastconveyor(distribution, ProductionBlocks.steelconveyor, stack(Item.steel, 1)),
|
||||
router(distribution, ProductionBlocks.router, stack(Item.stone, 2)),
|
||||
junction(distribution, ProductionBlocks.junction, stack(Item.iron, 2)),
|
||||
stonewall(distribution, DefenseBlocks.stonewall, stack(Item.stone, 2)),
|
||||
ironwall(distribution, DefenseBlocks.ironwall, stack(Item.iron, 2)),
|
||||
steelwall(distribution, DefenseBlocks.steelwall, stack(Item.steel, 2)),
|
||||
titaniumwall(distribution, DefenseBlocks.titaniumwall, stack(Item.titanium, 2)),
|
||||
duriumwall(distribution, DefenseBlocks.diriumwall, stack(Item.dirium, 2)),
|
||||
compositewall(distribution, DefenseBlocks.compositewall, stack(Item.dirium, 2), stack(Item.titanium, 2), stack(Item.steel, 2), stack(Item.iron, 2)),
|
||||
titaniumshieldwall(distribution, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 2)),
|
||||
conveyor(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)),
|
||||
fastconveyor(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
|
||||
router(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
|
||||
junction(distribution, DistributionBlocks.junction, stack(Item.iron, 2)),
|
||||
|
||||
turret(defense, WeaponBlocks.turret, stack(Item.stone, 4)),
|
||||
dturret(defense, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
|
||||
@ -33,10 +31,10 @@ public enum Recipe{
|
||||
teslaturret(defense, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)),
|
||||
plasmaturret(defense, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)),
|
||||
|
||||
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 30)),
|
||||
megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)),
|
||||
healturret(defense, DefenseBlocks.repairturret, stack(Item.iron, 30)),
|
||||
megahealturret(defense, DefenseBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)),
|
||||
|
||||
drill(production, ProductionBlocks.stonedrill, stack(Item.stone, 16)),
|
||||
stonedrill(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||
irondrill(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),
|
||||
coaldrill(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)),
|
||||
titaniumdrill(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)),
|
||||
@ -45,11 +43,12 @@ public enum Recipe{
|
||||
coalpurifier(production, ProductionBlocks.coalpurifier, stack(Item.steel, 10), stack(Item.iron, 10)),
|
||||
titaniumpurifier(production, ProductionBlocks.titaniumpurifier, stack(Item.steel, 30), stack(Item.iron, 30)),
|
||||
omnidrill(production, ProductionBlocks.omnidrill, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
coalgenerator(production, ProductionBlocks.coalgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
shieldgenerator(production, WeaponBlocks.shieldgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
|
||||
conduit(distribution, ProductionBlocks.conduit, stack(Item.steel, 1)),
|
||||
liquidrouter(distribution, ProductionBlocks.liquidrouter, stack(Item.steel, 2)),
|
||||
coalgenerator(power, ProductionBlocks.coalgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
shieldgenerator(power, DefenseBlocks.shieldgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
|
||||
conduit(distribution, DistributionBlocks.conduit, stack(Item.steel, 1)),
|
||||
liquidrouter(distribution, DistributionBlocks.liquidrouter, stack(Item.steel, 2)),
|
||||
pump(production, ProductionBlocks.pump, stack(Item.steel, 10));
|
||||
|
||||
public Block result;
|
||||
|
@ -1,5 +1,5 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public enum Section{
|
||||
defense, production, distribution;
|
||||
defense, production, distribution, power;
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ public class Generator{
|
||||
Hue.rgb(110, 80, 30), Blocks.dirt,
|
||||
Hue.rgb(160, 120, 70), Blocks.dirtblock,
|
||||
Hue.rgb(100, 100, 100), Blocks.stoneblock,
|
||||
Color.valueOf("ed5334"), Blocks.lava
|
||||
Color.valueOf("ed5334"), Blocks.lava,
|
||||
Color.valueOf("292929"), Blocks.oil
|
||||
);
|
||||
|
||||
/**Returns world size.*/
|
||||
|
@ -11,9 +11,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.world.blocks.WeaponBlocks;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
@ -166,28 +164,36 @@ public class World{
|
||||
static void setDefaultBlocks(){
|
||||
int x = core.x, y = core.y;
|
||||
|
||||
set(x, y-1, ProductionBlocks.conveyor, 1);
|
||||
set(x, y-2, ProductionBlocks.conveyor, 1);
|
||||
set(x, y-3, ProductionBlocks.conveyor, 1);
|
||||
set(x, y-4, ProductionBlocks.stonedrill, 0);
|
||||
//just in case
|
||||
tiles[x][y-4].setFloor(Blocks.stone);
|
||||
set(x, y-1, DistributionBlocks.conveyor, 1);
|
||||
set(x, y-2, DistributionBlocks.conveyor, 1);
|
||||
set(x, y-3, DistributionBlocks.conveyor, 1);
|
||||
|
||||
|
||||
tiles[x+2][y-2].setFloor(Blocks.stone);
|
||||
set(x+2, y-2, ProductionBlocks.stonedrill, 0);
|
||||
set(x+2, y-1, ProductionBlocks.conveyor, 1);
|
||||
set(x+2, y, WeaponBlocks.turret, 0);
|
||||
|
||||
tiles[x-2][y-2].setFloor(Blocks.stone);
|
||||
set(x-2, y-2, ProductionBlocks.stonedrill, 0);
|
||||
set(x-2, y-1, ProductionBlocks.conveyor, 1);
|
||||
set(x-2, y, WeaponBlocks.turret, 0);
|
||||
for(int i = 0; i < 2; i ++){
|
||||
int d = Mathf.sign(i-0.5f);
|
||||
|
||||
set(x+2*d, y-2, ProductionBlocks.stonedrill, d);
|
||||
set(x+2*d, y-1, DistributionBlocks.conveyor, 1);
|
||||
set(x+2*d, y, DistributionBlocks.conveyor, 1);
|
||||
set(x+2*d, y+1, WeaponBlocks.doubleturret, 0);
|
||||
|
||||
set(x+1*d, y-3, DistributionBlocks.conveyor, 2*d);
|
||||
set(x+2*d, y-3, DistributionBlocks.conveyor, 2*d);
|
||||
set(x+2*d, y-4, DistributionBlocks.conveyor, 1);
|
||||
set(x+2*d, y-5, DistributionBlocks.conveyor, 1);
|
||||
//set(x+2*d, y-6, DistributionBlocks.conveyor, 1);
|
||||
|
||||
//set(x+3*d, y-6, ProductionBlocks.stonedrill, 0);
|
||||
set(x+3*d, y-5, ProductionBlocks.stonedrill, 0);
|
||||
set(x+3*d, y-4, ProductionBlocks.stonedrill, 0);
|
||||
set(x+3*d, y-3, ProductionBlocks.stonedrill, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void set(int x, int y, Block type, int rot){
|
||||
tiles[x][y].setBlock(type);
|
||||
tiles[x][y].rotation = (byte)rot;
|
||||
if(type == ProductionBlocks.stonedrill){
|
||||
tiles[x][y].setFloor(Blocks.stone);
|
||||
}
|
||||
tiles[x][y].setBlock(type, rot);
|
||||
}
|
||||
|
||||
public static int getSeed(){
|
||||
|
@ -1,13 +1,13 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.GameState;
|
||||
import io.anuke.mindustry.GameState.State;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.Floor;
|
||||
import io.anuke.mindustry.world.blocks.types.Wall;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldedWallBlock;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
@ -20,7 +20,8 @@ public class Blocks{
|
||||
|
||||
//update floor blocks for effects, if needed
|
||||
public void draw(Tile tile){
|
||||
tile.floor().update(tile);
|
||||
if(!GameState.is(State.paused))
|
||||
tile.floor().update(tile);
|
||||
}
|
||||
},
|
||||
|
||||
@ -49,12 +50,27 @@ public class Blocks{
|
||||
Effects.effect("lava", tile.worldx() + Mathf.range(5f), tile.worldy() + Mathf.range(5f));
|
||||
}
|
||||
|
||||
if(Mathf.chance(0.004)){
|
||||
if(Mathf.chance(0.003)){
|
||||
Effects.effect("lavabubble", tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
oil = new Floor("oil"){
|
||||
{
|
||||
vary = false;
|
||||
solid = true;
|
||||
liquidDrop = Liquid.oil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
if(Mathf.chance(0.0025)){
|
||||
Effects.effect("oilbubble", tile.worldx() + Mathf.range(2f), tile.worldy() + Mathf.range(2f));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
stone = new Floor("stone"){{
|
||||
drops = new ItemStack(Item.stone, 1);
|
||||
}},
|
||||
@ -121,37 +137,5 @@ public class Blocks{
|
||||
|
||||
dirtblock = new Block("dirtblock"){{
|
||||
solid = true;
|
||||
}},
|
||||
|
||||
stonewall = new Wall("stonewall"){{
|
||||
health = 50;
|
||||
formalName = "stone wall";
|
||||
}},
|
||||
|
||||
ironwall = new Wall("ironwall"){{
|
||||
health = 80;
|
||||
formalName = "iron wall";
|
||||
}},
|
||||
|
||||
steelwall = new Wall("steelwall"){{
|
||||
health = 110;
|
||||
formalName = "steel wall";
|
||||
}},
|
||||
|
||||
titaniumwall = new Wall("titaniumwall"){{
|
||||
health = 150;
|
||||
formalName = "titanium wall";
|
||||
}},
|
||||
diriumwall = new Wall("duriumwall"){{
|
||||
health = 190;
|
||||
formalName = "dirium wall";
|
||||
}},
|
||||
compositewall = new Wall("compositewall"){{
|
||||
health = 270;
|
||||
formalName = "composite wall";
|
||||
}},
|
||||
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
|
||||
health = 150;
|
||||
formalName = "shielded wall";
|
||||
}};
|
||||
}
|
||||
|
66
core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java
Normal file
@ -0,0 +1,66 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.Wall;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.RepairTurret;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldedWallBlock;
|
||||
|
||||
public class DefenseBlocks{
|
||||
|
||||
public static final Block
|
||||
|
||||
stonewall = new Wall("stonewall"){{
|
||||
health = 50;
|
||||
formalName = "stone wall";
|
||||
}},
|
||||
|
||||
ironwall = new Wall("ironwall"){{
|
||||
health = 80;
|
||||
formalName = "iron wall";
|
||||
}},
|
||||
|
||||
steelwall = new Wall("steelwall"){{
|
||||
health = 110;
|
||||
formalName = "steel wall";
|
||||
}},
|
||||
|
||||
titaniumwall = new Wall("titaniumwall"){{
|
||||
health = 150;
|
||||
formalName = "titanium wall";
|
||||
}},
|
||||
diriumwall = new Wall("duriumwall"){{
|
||||
health = 190;
|
||||
formalName = "dirium wall";
|
||||
}},
|
||||
compositewall = new Wall("compositewall"){{
|
||||
health = 270;
|
||||
formalName = "composite wall";
|
||||
}},
|
||||
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
|
||||
health = 150;
|
||||
formalName = "shielded wall";
|
||||
}},
|
||||
|
||||
repairturret = new RepairTurret("repairturret"){
|
||||
{
|
||||
formalName = "heal turret";
|
||||
range = 30;
|
||||
reload = 40f;
|
||||
health = 60;
|
||||
}
|
||||
},
|
||||
|
||||
megarepairturret = new RepairTurret("megarepairturret"){
|
||||
{
|
||||
formalName = "heal turret II";
|
||||
range = 44;
|
||||
reload = 20f;
|
||||
health = 90;
|
||||
}
|
||||
},
|
||||
|
||||
shieldgenerator = new ShieldBlock("shieldgenerator"){
|
||||
//TODO
|
||||
};
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
||||
|
||||
public class DistributionBlocks{
|
||||
|
||||
public static final Block
|
||||
|
||||
conduit = new LiquidBlock("conduit"){{
|
||||
|
||||
}},
|
||||
|
||||
liquidrouter = new LiquidRouter("liquidrouter"){{
|
||||
formalName = "liquid router";
|
||||
}},
|
||||
|
||||
conveyor = new Conveyor("conveyor"){{
|
||||
|
||||
}},
|
||||
|
||||
steelconveyor = new Conveyor("steelconveyor"){{
|
||||
health = 55;
|
||||
speed = 0.04f;
|
||||
formalName = "steel conveyor";
|
||||
}},
|
||||
|
||||
//TODO
|
||||
poweredconveyor = new Conveyor("poweredconveyor"){{
|
||||
health = 90;
|
||||
speed = 0.09f;
|
||||
formalName = "powered conveyor";
|
||||
}},
|
||||
|
||||
router = new Router("router"){
|
||||
},
|
||||
|
||||
junction = new Junction("junction"){
|
||||
|
||||
};
|
||||
}
|
@ -5,8 +5,6 @@ import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.*;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
||||
import io.anuke.mindustry.world.blocks.types.production.*;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@ -37,65 +35,10 @@ public class ProductionBlocks{
|
||||
}
|
||||
},
|
||||
|
||||
conduit = new LiquidBlock("conduit"){{
|
||||
|
||||
}},
|
||||
|
||||
pump = new Pump("pump"){{
|
||||
|
||||
}},
|
||||
|
||||
liquidrouter = new LiquidRouter("liquidrouter"){{
|
||||
formalName = "liquid router";
|
||||
}},
|
||||
|
||||
conveyor = new Conveyor("conveyor"){{
|
||||
|
||||
}},
|
||||
|
||||
steelconveyor = new Conveyor("steelconveyor"){{
|
||||
health = 55;
|
||||
speed = 0.04f;
|
||||
formalName = "steel conveyor";
|
||||
}},
|
||||
|
||||
router = new Router("router"){
|
||||
},
|
||||
|
||||
junction = new Block("junction"){
|
||||
{
|
||||
update = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Tile tile, Item item, Tile source){
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = tile.getNearby()[dir];
|
||||
|
||||
Timers.run(15, ()->{
|
||||
if(to == null || to.entity == null) return;
|
||||
to.block().handleItem(to, item, tile);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile dest, Tile source){
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = dest.getNearby()[dir];
|
||||
//uncomment the junction bit to disable giving items to other junctions
|
||||
return to != null /*&& to.block() != junction*/ && to.block().acceptItem(item, to, dest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description(){
|
||||
return "Serves as a conveyor junction.";
|
||||
}
|
||||
},
|
||||
|
||||
smelter = new Crafter("smelter"){
|
||||
{
|
||||
health = 70;
|
||||
@ -214,7 +157,6 @@ public class ProductionBlocks{
|
||||
generateAmount = 4f;
|
||||
powerCapacity = 40f;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
;
|
||||
}
|
||||
|
@ -8,7 +8,8 @@ import io.anuke.mindustry.entities.effect.TeslaOrb;
|
||||
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.defense.*;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.Turret;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
@ -162,27 +163,5 @@ public class WeaponBlocks{
|
||||
health = 180;
|
||||
ammoMultiplier = 40;
|
||||
}
|
||||
},
|
||||
|
||||
repairturret = new RepairTurret("repairturret"){
|
||||
{
|
||||
formalName = "heal turret";
|
||||
range = 30;
|
||||
reload = 40f;
|
||||
health = 60;
|
||||
}
|
||||
},
|
||||
|
||||
megarepairturret = new RepairTurret("megarepairturret"){
|
||||
{
|
||||
formalName = "heal turret II";
|
||||
range = 50;
|
||||
reload = 20f;
|
||||
health = 90;
|
||||
}
|
||||
},
|
||||
|
||||
shieldgenerator = new ShieldBlock("shieldgenerator"){
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class Junction extends Block{
|
||||
|
||||
public Junction(String name) {
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Tile tile, Item item, Tile source){
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = tile.getNearby()[dir];
|
||||
|
||||
Timers.run(15, ()->{
|
||||
if(to == null || to.entity == null) return;
|
||||
to.block().handleItem(to, item, tile);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile dest, Tile source){
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = dest.getNearby()[dir];
|
||||
//uncomment the junction bit to disable giving items to other junctions
|
||||
return to != null /*&& to.block() != junction*/ && to.block().acceptItem(item, to, dest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description(){
|
||||
return "Serves as a conveyor junction.";
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,12 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
public class PowerBooster{
|
||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||
|
||||
public class PowerBooster extends PowerBlock{
|
||||
|
||||
//TODO
|
||||
public PowerBooster(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
//TODO
|
||||
public class Sorter extends Junction{
|
||||
|
||||
public Sorter(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
SorterEntity entity = tile.entity();
|
||||
return super.acceptItem(item, tile, source) && item == entity.sortItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new SorterEntity();
|
||||
}
|
||||
|
||||
public static class SorterEntity extends TileEntity{
|
||||
public Item sortItem = Item.stone;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
stream.writeByte(sortItem.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException{
|
||||
sortItem = Item.values()[stream.readByte()];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
|
||||
//TODO
|
||||
public class Teleporter extends Block{
|
||||
public static final int colors = 4;
|
||||
|
||||
public Teleporter(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new TeleporterEntity();
|
||||
}
|
||||
|
||||
public static class TeleporterEntity extends TileEntity{
|
||||
public byte color = 0;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
stream.writeByte(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException{
|
||||
color = stream.readByte();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||
@ -15,7 +20,7 @@ public class LiquidPowerGenerator extends LiquidBlock{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
LiquidEntity entity = tile.entity();
|
||||
LiquidPowerEntity entity = tile.entity();
|
||||
|
||||
if(entity.liquidAmount >= generateAmount){
|
||||
entity.liquidAmount -= generateAmount;
|
||||
@ -27,4 +32,25 @@ public class LiquidPowerGenerator extends LiquidBlock{
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
return liquid == generateLiquid && super.acceptLiquid(tile, source, liquid, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new LiquidPowerEntity();
|
||||
}
|
||||
|
||||
public static class LiquidPowerEntity extends LiquidEntity{
|
||||
public float power;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
super.write(stream);
|
||||
stream.writeFloat(power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException{
|
||||
super.read(stream);
|
||||
power = stream.readFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|