Start of drill re-tiering / Animated drills / Fixed fracker bugs
|
Before Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 405 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 196 B |
BIN
core/assets-raw/sprites/blocks/production/reinforceddrill.png
Normal file
|
After Width: | Height: | Size: 228 B |
BIN
core/assets-raw/sprites/blocks/production/steeldrill-rotator.png
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
core/assets-raw/sprites/blocks/production/steeldrill-top.png
Normal file
|
After Width: | Height: | Size: 196 B |
BIN
core/assets-raw/sprites/blocks/production/steeldrill.png
Normal file
|
After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 174 B |
BIN
core/assets-raw/sprites/blocks/production/titaniumdrill-top.png
Normal file
|
After Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 261 B |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 270 B |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 99 KiB |
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Wed Mar 28 22:57:35 EDT 2018
|
#Thu Mar 29 21:34:26 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=718
|
androidBuildCode=725
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.4
|
code=3.4
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -1,36 +1,52 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
|
|
||||||
public class Items {
|
public class Items {
|
||||||
public static final Item
|
public static final Item
|
||||||
|
|
||||||
stone = new Item("stone") {
|
stone = new Item("stone", Color.valueOf("777777")) {
|
||||||
{
|
{
|
||||||
material = false;
|
material = false;
|
||||||
|
hardness = 2;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
iron = new Item("iron"),
|
iron = new Item("iron", Color.valueOf("bc8271")){
|
||||||
lead = new Item("lead"),
|
{
|
||||||
coal = new Item("coal") {
|
hardness = 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lead = new Item("lead", Color.valueOf("8e85a2")){
|
||||||
|
{
|
||||||
|
hardness = 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
coal = new Item("coal", Color.valueOf("272727")) {
|
||||||
{
|
{
|
||||||
explosiveness = 0.2f;
|
explosiveness = 0.2f;
|
||||||
flammability = 0.5f;
|
flammability = 0.5f;
|
||||||
fluxiness = 0.5f;
|
fluxiness = 0.5f;
|
||||||
material = false;
|
material = false;
|
||||||
|
hardness = 2;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
steel = new Item("steel"),
|
steel = new Item("steel", Color.valueOf("e2e2e2")),
|
||||||
titanium = new Item("titanium"),
|
titanium = new Item("titanium", Color.valueOf("8da1e3")){
|
||||||
thorium = new Item("thorium") {
|
{
|
||||||
|
hardness = 3;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
thorium = new Item("thorium", Color.valueOf("bb80bd")) {
|
||||||
{
|
{
|
||||||
explosiveness = 0.1f;
|
explosiveness = 0.1f;
|
||||||
|
hardness = 4;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
silicon = new Item("silicon"),
|
silicon = new Item("silicon", Color.valueOf("53565c")),
|
||||||
plastic = new Item("plastic"),
|
plastic = new Item("plastic", Color.valueOf("e9ead3")),
|
||||||
densealloy = new Item("densealloy"),
|
densealloy = new Item("densealloy", Color.valueOf("b4d5c7")),
|
||||||
biomatter = new Item("biomatter") {
|
biomatter = new Item("biomatter", Color.valueOf("648b55")) {
|
||||||
{
|
{
|
||||||
material = false;
|
material = false;
|
||||||
flammability = 0.4f;
|
flammability = 0.4f;
|
||||||
|
|||||||
@@ -68,7 +68,10 @@ public class Recipes {
|
|||||||
new Recipe(crafting, CraftingBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.iron, 60)).setDesktop(),
|
new Recipe(crafting, CraftingBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.iron, 60)).setDesktop(),
|
||||||
|
|
||||||
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||||
new Recipe(production, ProductionBlocks.irondrill, stack(Items.iron, 25)),
|
new Recipe(production, ProductionBlocks.ironDrill, stack(Items.iron, 25)),
|
||||||
|
new Recipe(production, ProductionBlocks.reinforcedDrill, stack(Items.iron, 25)),
|
||||||
|
new Recipe(production, ProductionBlocks.steelDrill, stack(Items.iron, 25)),
|
||||||
|
new Recipe(production, ProductionBlocks.titaniumDrill, stack(Items.iron, 25)),
|
||||||
//new Recipe(production, ProductionBlocks.leaddrill, stack(Items.iron, 25)),
|
//new Recipe(production, ProductionBlocks.leaddrill, stack(Items.iron, 25)),
|
||||||
//new Recipe(production, ProductionBlocks.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
|
//new Recipe(production, ProductionBlocks.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
|
||||||
//new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),
|
//new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),
|
||||||
|
|||||||
@@ -9,51 +9,35 @@ import io.anuke.mindustry.world.blocks.types.production.*;
|
|||||||
public class ProductionBlocks {
|
public class ProductionBlocks {
|
||||||
public static final Block
|
public static final Block
|
||||||
|
|
||||||
stonedrill = new Drill("stonedrill") {{
|
ironDrill = new Drill("irondrill") {{
|
||||||
resource = Blocks.stone;
|
tier = 1;
|
||||||
result = Items.stone;
|
|
||||||
drillTime = 240;
|
|
||||||
}},
|
|
||||||
|
|
||||||
irondrill = new Drill("irondrill") {{
|
|
||||||
resource = Blocks.iron;
|
|
||||||
result = Items.iron;
|
|
||||||
drillTime = 360;
|
|
||||||
}},
|
|
||||||
|
|
||||||
leaddrill = new Drill("leaddrill") {{
|
|
||||||
resource = Blocks.lead;
|
|
||||||
result = Items.lead;
|
|
||||||
drillTime = 400;
|
drillTime = 400;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
coaldrill = new Drill("coaldrill") {{
|
reinforcedDrill = new Drill("reinforceddrill") {{
|
||||||
resource = Blocks.coal;
|
tier = 2;
|
||||||
result = Items.coal;
|
drillTime = 360;
|
||||||
drillTime = 420;
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
thoriumdrill = new Drill("thoriumdrill") {{
|
steelDrill = new Drill("steeldrill") {{
|
||||||
resource = Blocks.thorium;
|
tier = 3;
|
||||||
result = Items.thorium;
|
drillTime = 320;
|
||||||
drillTime = 600;
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
titaniumdrill = new Drill("titaniumdrill") {{
|
titaniumDrill = new Drill("titaniumdrill") {{
|
||||||
resource = Blocks.titanium;
|
tier = 4;
|
||||||
result = Items.titanium;
|
drillTime = 280;
|
||||||
drillTime = 540;
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
laserdrill = new GenericDrill("laserdrill") {{
|
laserdrill = new GenericDrill("laserdrill") {{
|
||||||
drillTime = 200;
|
drillTime = 220;
|
||||||
size = 2;
|
size = 2;
|
||||||
powerUse = 0.2f;
|
powerUse = 0.2f;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
nucleardrill = new GenericDrill("nucleardrill") {{
|
nucleardrill = new GenericDrill("nucleardrill") {{
|
||||||
drillTime = 240;
|
drillTime = 170;
|
||||||
size = 3;
|
size = 3;
|
||||||
powerUse = 0.32f;
|
powerUse = 0.32f;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
@@ -61,21 +45,13 @@ public class ProductionBlocks {
|
|||||||
|
|
||||||
plasmadrill = new GenericDrill("plasmadrill") {{
|
plasmadrill = new GenericDrill("plasmadrill") {{
|
||||||
inputLiquid = Liquids.plasma;
|
inputLiquid = Liquids.plasma;
|
||||||
drillTime = 240;
|
drillTime = 110;
|
||||||
size = 4;
|
size = 4;
|
||||||
powerUse = 0.16f;
|
powerUse = 0.16f;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
quartzextractor = new GenericDrill("quartzextractor") {{
|
|
||||||
powerUse = 0.1f;
|
|
||||||
resource = Blocks.sand;
|
|
||||||
result = Items.silicon;
|
|
||||||
drillTime = 320;
|
|
||||||
size = 2;
|
|
||||||
}},
|
|
||||||
|
|
||||||
waterextractor = new SolidPump("waterextractor") {{
|
waterextractor = new SolidPump("waterextractor") {{
|
||||||
result = Liquids.water;
|
result = Liquids.water;
|
||||||
powerUse = 0.2f;
|
powerUse = 0.2f;
|
||||||
@@ -97,7 +73,6 @@ public class ProductionBlocks {
|
|||||||
}},
|
}},
|
||||||
|
|
||||||
cultivator = new Cultivator("cultivator") {{
|
cultivator = new Cultivator("cultivator") {{
|
||||||
resource = Blocks.grass;
|
|
||||||
result = Items.biomatter;
|
result = Items.biomatter;
|
||||||
inputLiquid = Liquids.water;
|
inputLiquid = Liquids.water;
|
||||||
liquidUse = 0.2f;
|
liquidUse = 0.2f;
|
||||||
|
|||||||
@@ -169,16 +169,6 @@ public class World extends Module{
|
|||||||
WorldGenerator.generate(tiles, MapIO.readTileData(map));
|
WorldGenerator.generate(tiles, MapIO.readTileData(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(int x, int y, Block type, int rot){
|
|
||||||
if(!Mathf.inBounds(x, y, tiles)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(type == ProductionBlocks.stonedrill){
|
|
||||||
tiles[x][y].setFloor(Blocks.stone);
|
|
||||||
}
|
|
||||||
tiles[x][y].setBlock(type, rot);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeed(){
|
public int getSeed(){
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.badlogic.gdx.math.GridPoint2;
|
|||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.content.blocks.DistributionBlocks;
|
import io.anuke.mindustry.content.blocks.DistributionBlocks;
|
||||||
import io.anuke.mindustry.content.blocks.ProductionBlocks;
|
|
||||||
import io.anuke.mindustry.content.blocks.WeaponBlocks;
|
import io.anuke.mindustry.content.blocks.WeaponBlocks;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
@@ -243,7 +242,7 @@ public class Tutorial{
|
|||||||
canForward = false;
|
canForward = false;
|
||||||
blockPlaceX = 0;
|
blockPlaceX = 0;
|
||||||
blockPlaceY = -3;
|
blockPlaceY = -3;
|
||||||
targetBlock = ProductionBlocks.stonedrill;
|
//targetBlock = ProductionBlocks.stonedrill;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSwitch(){
|
void onSwitch(){
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class Fx{
|
|||||||
public static Color glowy = Color.valueOf("fdc056");
|
public static Color glowy = Color.valueOf("fdc056");
|
||||||
public static Color beam = Color.valueOf("9bffbe");
|
public static Color beam = Color.valueOf("9bffbe");
|
||||||
public static Color beamLight = Color.valueOf("ddffe9");
|
public static Color beamLight = Color.valueOf("ddffe9");
|
||||||
|
public static Color stoneGray = Color.valueOf("8f8f8f");
|
||||||
|
|
||||||
public static final Effect
|
public static final Effect
|
||||||
|
|
||||||
@@ -189,15 +190,23 @@ public class Fx{
|
|||||||
|
|
||||||
pulverize = new Effect(40, e -> {
|
pulverize = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
|
Draw.color(stoneGray);
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
pulverizeSmall = new Effect(30, e -> {
|
pulverizeSmall = new Effect(30, e -> {
|
||||||
|
Angles.randLenVectors(e.id, 3, e.ifract()*5f, (x, y)->{
|
||||||
|
Draw.color(stoneGray);
|
||||||
|
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45);
|
||||||
|
Draw.reset();
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
|
||||||
|
pulverizeMedium = new Effect(30, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
|
Draw.color(stoneGray);
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
@@ -352,14 +361,28 @@ public class Fx{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
spark = new Effect(10, e -> {
|
||||||
|
Lines.stroke(1f);
|
||||||
|
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||||
|
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||||
|
Draw.reset();
|
||||||
|
}),
|
||||||
|
|
||||||
mine = new Effect(20, e -> {
|
mine = new Effect(20, e -> {
|
||||||
Angles.randLenVectors(e.id, 6, 3f + e.ifract()*6f, (x, y)->{
|
Angles.randLenVectors(e.id, 6, 3f + e.ifract()*6f, (x, y)->{
|
||||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract());
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
sparkbig = new Effect(11, e -> {
|
||||||
|
Lines.stroke(1f);
|
||||||
|
Draw.color(lightRed, Color.GRAY, e.ifract());
|
||||||
|
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8);
|
||||||
|
Draw.reset();
|
||||||
|
}),
|
||||||
|
|
||||||
smelt = new Effect(10, e -> {
|
smelt = new Effect(10, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.YELLOW, Color.RED, e.ifract());
|
Draw.color(Color.YELLOW, Color.RED, e.ifract());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.resource;
|
package io.anuke.mindustry.resource;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
@@ -10,17 +11,23 @@ public class Item implements Comparable<Item>{
|
|||||||
|
|
||||||
public final int id;
|
public final int id;
|
||||||
public final String name;
|
public final String name;
|
||||||
|
public final Color color;
|
||||||
public TextureRegion region;
|
public TextureRegion region;
|
||||||
|
|
||||||
public float explosiveness = 0f;
|
public float explosiveness = 0f;
|
||||||
|
/**flammability above 0.3 makes this eleigible for item burners.*/
|
||||||
public float flammability = 0f;
|
public float flammability = 0f;
|
||||||
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
|
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
|
||||||
public float fluxiness = 0f;
|
public float fluxiness = 0f;
|
||||||
|
/**whether this material goes in the core*/
|
||||||
public boolean material = true;
|
public boolean material = true;
|
||||||
|
/**drill hardness of the item*/
|
||||||
|
public int hardness = 0;
|
||||||
|
|
||||||
public Item(String name) {
|
public Item(String name, Color color) {
|
||||||
this.id = items.size;
|
this.id = items.size;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.color = color;
|
||||||
|
|
||||||
items.add(this);
|
items.add(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package io.anuke.mindustry.world.blocks.types.distribution;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.content.Items;
|
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.BlockGroup;
|
import io.anuke.mindustry.world.BlockGroup;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
@@ -14,7 +14,6 @@ import io.anuke.ucore.scene.ui.ButtonGroup;
|
|||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Tmp;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -36,10 +35,9 @@ public class Sorter extends Block{
|
|||||||
|
|
||||||
SorterEntity entity = tile.entity();
|
SorterEntity entity = tile.entity();
|
||||||
|
|
||||||
TextureRegion region = entity.sortItem.region;
|
Draw.color(entity.sortItem.color);
|
||||||
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
|
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
||||||
|
Draw.color();
|
||||||
Draw.rect(Tmp.tr1, tile.worldx(), tile.worldy(), 4f, 4f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
@@ -20,6 +21,8 @@ public class Cultivator extends GenericDrill {
|
|||||||
protected Color plantColorLight = Color.valueOf("73a75f");
|
protected Color plantColorLight = Color.valueOf("73a75f");
|
||||||
protected Color bottomColor = Color.valueOf("474747");
|
protected Color bottomColor = Color.valueOf("474747");
|
||||||
|
|
||||||
|
protected Item result;
|
||||||
|
|
||||||
protected SeedRandom random = new SeedRandom(0);
|
protected SeedRandom random = new SeedRandom(0);
|
||||||
protected float recurrence = 6f;
|
protected float recurrence = 6f;
|
||||||
|
|
||||||
@@ -75,6 +78,11 @@ public class Cultivator extends GenericDrill {
|
|||||||
return new CultivatorEntity();
|
return new CultivatorEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(Tile tile){
|
||||||
|
return tile.block().drops != null && tile.block().drops.item == result;
|
||||||
|
}
|
||||||
|
|
||||||
public static class CultivatorEntity extends DrillEntity{
|
public static class CultivatorEntity extends DrillEntity{
|
||||||
public float warmup;
|
public float warmup;
|
||||||
|
|
||||||
|
|||||||
@@ -15,19 +15,22 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
import io.anuke.ucore.util.Tmp;
|
|
||||||
|
|
||||||
public class Drill extends Block{
|
public class Drill extends Block{
|
||||||
|
protected final static float hardnessDrillMultiplier = 40f;
|
||||||
protected final int timerDrill = timers++;
|
protected final int timerDrill = timers++;
|
||||||
protected final int timerDump = timers++;
|
protected final int timerDump = timers++;
|
||||||
|
|
||||||
protected final Array<Tile> drawTiles = new Array<>();
|
protected final Array<Tile> drawTiles = new Array<>();
|
||||||
|
|
||||||
protected Block resource;
|
protected int tier;
|
||||||
protected Item result;
|
|
||||||
protected float drillTime = 300;
|
protected float drillTime = 300;
|
||||||
protected Effect drillEffect = Fx.mine;
|
protected Effect drillEffect = Fx.mine;
|
||||||
protected float rotateSpeed = 2f;
|
protected float rotateSpeed = 2f;
|
||||||
|
protected Effect updateEffect = Fx.pulverizeSmall;
|
||||||
|
protected float updateEffectChance = 0.02f;
|
||||||
|
|
||||||
|
protected Array<Item> toAdd = new Array<>();
|
||||||
|
|
||||||
public Drill(String name) {
|
public Drill(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@@ -40,14 +43,17 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile) {
|
public void draw(Tile tile) {
|
||||||
|
boolean valid = isMultiblock() || isValid(tile);
|
||||||
|
|
||||||
Draw.rect(name, tile.drawx(), tile.drawy());
|
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||||
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), Timers.time() * rotateSpeed);
|
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), valid ? Timers.time() * rotateSpeed : 0f);
|
||||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
TextureRegion region = result.region;
|
if(!isMultiblock() && isValid(tile)) {
|
||||||
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
|
Draw.color(tile.floor().drops.item.color);
|
||||||
|
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
|
||||||
Draw.rect(Tmp.tr1, tile.drawx(), tile.drawy(), 2f, 2f);
|
Draw.color();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -63,26 +69,37 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
|
toAdd.clear();
|
||||||
|
|
||||||
TileEntity entity = tile.entity;
|
TileEntity entity = tile.entity;
|
||||||
|
|
||||||
int mines = 0;
|
float multiplier = 0f;
|
||||||
|
float totalHardness = 0f;
|
||||||
|
|
||||||
if(isMultiblock()){
|
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
||||||
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
if(isValid(other)){
|
||||||
if(isValid(other)){
|
toAdd.add(other.floor().drops.item);
|
||||||
mines ++;
|
totalHardness += other.floor().drops.item.hardness;
|
||||||
}
|
multiplier += 1f;
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
if(isValid(tile)) mines = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mines > 0 && entity.timer.get(timerDrill, drillTime) && tile.entity.inventory.getItem(result) < itemCapacity){
|
if(toAdd.size > 0 && tile.entity.inventory.totalItems() < itemCapacity){
|
||||||
for(int i = 0; i < mines; i ++) offloadNear(tile, result);
|
|
||||||
Effects.effect(drillEffect, tile.drawx(), tile.drawy());
|
if(entity.timer.get(timerDrill, drillTime/multiplier + totalHardness*hardnessDrillMultiplier)) {
|
||||||
|
int extra = tile.getExtra() % toAdd.size;
|
||||||
|
|
||||||
|
offloadNear(tile, toAdd.get(extra));
|
||||||
|
|
||||||
|
tile.setExtra((byte)((extra + 1) % toAdd.size));
|
||||||
|
Effects.effect(drillEffect, toAdd.get(extra).color, tile.drawx(), tile.drawy());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Mathf.chance(Timers.delta() * updateEffectChance))
|
||||||
|
Effects.effect(updateEffect, entity.x + Mathf.range(size*2f), entity.y + Mathf.range(size*2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.timer.get(timerDump, 30)){
|
if(entity.timer.get(timerDump, 15)){
|
||||||
tryDump(tile);
|
tryDump(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +126,7 @@ public class Drill extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isValid(Tile tile){
|
protected boolean isValid(Tile tile){
|
||||||
return tile.floor() == resource || (resource != null && resource.drops != null && resource.drops.equals(tile.floor().drops));
|
return tile.floor().drops != null && tile.floor().drops.item.hardness <= tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
package io.anuke.mindustry.world.blocks.types.production;
|
package io.anuke.mindustry.world.blocks.types.production;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.Array;
|
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
import io.anuke.mindustry.resource.Item;
|
|
||||||
import io.anuke.mindustry.resource.Liquid;
|
import io.anuke.mindustry.resource.Liquid;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
@@ -23,13 +20,10 @@ public class GenericDrill extends Drill{
|
|||||||
protected Liquid inputLiquid = Liquids.water;
|
protected Liquid inputLiquid = Liquids.water;
|
||||||
|
|
||||||
protected float rotateSpeed = 1.5f;
|
protected float rotateSpeed = 1.5f;
|
||||||
protected Effect updateEffect = Fx.pulverizeSmall;
|
|
||||||
protected float updateEffectChance = 0.02f;
|
|
||||||
|
|
||||||
private Array<Item> toAdd = new Array<>();
|
|
||||||
|
|
||||||
public GenericDrill(String name){
|
public GenericDrill(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
updateEffect = Fx.pulverizeMedium;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,10 +47,12 @@ public class GenericDrill extends Drill{
|
|||||||
DrillEntity entity = tile.entity();
|
DrillEntity entity = tile.entity();
|
||||||
|
|
||||||
float multiplier = 0f;
|
float multiplier = 0f;
|
||||||
|
float totalHardness = 0f;
|
||||||
|
|
||||||
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
||||||
if(isValid(other)){
|
if(isValid(other)){
|
||||||
toAdd.add(result == null ? other.floor().drops.item : result);
|
toAdd.add(other.floor().drops.item);
|
||||||
|
totalHardness += other.floor().drops.item.hardness;
|
||||||
multiplier += 1f;
|
multiplier += 1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +77,7 @@ public class GenericDrill extends Drill{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(toAdd.size > 0 && entity.progress >= drillTime
|
if(toAdd.size > 0 && entity.progress >= drillTime + hardnessDrillMultiplier*totalHardness
|
||||||
&& tile.entity.inventory.totalItems() < itemCapacity){
|
&& tile.entity.inventory.totalItems() < itemCapacity){
|
||||||
|
|
||||||
int index = entity.index % toAdd.size;
|
int index = entity.index % toAdd.size;
|
||||||
@@ -90,7 +86,7 @@ public class GenericDrill extends Drill{
|
|||||||
entity.index ++;
|
entity.index ++;
|
||||||
entity.progress = 0f;
|
entity.progress = 0f;
|
||||||
|
|
||||||
Effects.effect(drillEffect, tile.drawx(), tile.drawy());
|
Effects.effect(drillEffect, toAdd.get(index).color, tile.drawx(), tile.drawy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.timer.get(timerDump, 15)){
|
if(entity.timer.get(timerDump, 15)){
|
||||||
@@ -98,15 +94,6 @@ public class GenericDrill extends Drill{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isValid(Tile tile){
|
|
||||||
if(resource == null) {
|
|
||||||
return tile.floor().drops != null;
|
|
||||||
}else{
|
|
||||||
return tile.floor() == resource || (resource.drops != null && resource.drops.equals(tile.floor().drops));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
|
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
|
||||||
return super.acceptLiquid(tile, source, liquid, amount) && liquid == inputLiquid;
|
return super.acceptLiquid(tile, source, liquid, amount) && liquid == inputLiquid;
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ package io.anuke.mindustry.world.blocks.types.storage;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.content.Items;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Tmp;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -47,10 +46,9 @@ public class SortedUnloader extends Unloader {
|
|||||||
|
|
||||||
SortedUnloaderEntity entity = tile.entity();
|
SortedUnloaderEntity entity = tile.entity();
|
||||||
|
|
||||||
TextureRegion region = entity.sortItem.region;
|
Draw.color(entity.sortItem.color);
|
||||||
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
|
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
|
||||||
|
Draw.color();
|
||||||
Draw.rect(Tmp.tr1, tile.worldx(), tile.worldy(), 2f, 2f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||