Start of drill re-tiering / Animated drills / Fixed fracker bugs

This commit is contained in:
Anuken 2018-03-29 21:36:34 -04:00
parent d83a852681
commit 027e8dc35e
32 changed files with 439 additions and 411 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 270 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Wed Mar 28 22:57:35 EDT 2018
#Thu Mar 29 21:34:26 EDT 2018
version=release
androidBuildCode=718
androidBuildCode=725
name=Mindustry
code=3.4
build=custom build

View File

@ -1,36 +1,52 @@
package io.anuke.mindustry.content;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.resource.Item;
public class Items {
public static final Item
stone = new Item("stone") {
stone = new Item("stone", Color.valueOf("777777")) {
{
material = false;
hardness = 2;
}
},
iron = new Item("iron"),
lead = new Item("lead"),
coal = new Item("coal") {
iron = new Item("iron", Color.valueOf("bc8271")){
{
hardness = 1;
}
},
lead = new Item("lead", Color.valueOf("8e85a2")){
{
hardness = 1;
}
},
coal = new Item("coal", Color.valueOf("272727")) {
{
explosiveness = 0.2f;
flammability = 0.5f;
fluxiness = 0.5f;
material = false;
hardness = 2;
}
},
steel = new Item("steel"),
titanium = new Item("titanium"),
thorium = new Item("thorium") {
steel = new Item("steel", Color.valueOf("e2e2e2")),
titanium = new Item("titanium", Color.valueOf("8da1e3")){
{
hardness = 3;
}
},
thorium = new Item("thorium", Color.valueOf("bb80bd")) {
{
explosiveness = 0.1f;
hardness = 4;
}
},
silicon = new Item("silicon"),
plastic = new Item("plastic"),
densealloy = new Item("densealloy"),
biomatter = new Item("biomatter") {
silicon = new Item("silicon", Color.valueOf("53565c")),
plastic = new Item("plastic", Color.valueOf("e9ead3")),
densealloy = new Item("densealloy", Color.valueOf("b4d5c7")),
biomatter = new Item("biomatter", Color.valueOf("648b55")) {
{
material = false;
flammability = 0.4f;

View File

@ -68,7 +68,10 @@ public class Recipes {
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.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.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
//new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),

View File

@ -9,51 +9,35 @@ import io.anuke.mindustry.world.blocks.types.production.*;
public class ProductionBlocks {
public static final Block
stonedrill = new Drill("stonedrill") {{
resource = Blocks.stone;
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;
ironDrill = new Drill("irondrill") {{
tier = 1;
drillTime = 400;
}},
coaldrill = new Drill("coaldrill") {{
resource = Blocks.coal;
result = Items.coal;
drillTime = 420;
reinforcedDrill = new Drill("reinforceddrill") {{
tier = 2;
drillTime = 360;
}},
thoriumdrill = new Drill("thoriumdrill") {{
resource = Blocks.thorium;
result = Items.thorium;
drillTime = 600;
steelDrill = new Drill("steeldrill") {{
tier = 3;
drillTime = 320;
}},
titaniumdrill = new Drill("titaniumdrill") {{
resource = Blocks.titanium;
result = Items.titanium;
drillTime = 540;
titaniumDrill = new Drill("titaniumdrill") {{
tier = 4;
drillTime = 280;
}},
laserdrill = new GenericDrill("laserdrill") {{
drillTime = 200;
drillTime = 220;
size = 2;
powerUse = 0.2f;
hasPower = true;
}},
nucleardrill = new GenericDrill("nucleardrill") {{
drillTime = 240;
drillTime = 170;
size = 3;
powerUse = 0.32f;
hasPower = true;
@ -61,21 +45,13 @@ public class ProductionBlocks {
plasmadrill = new GenericDrill("plasmadrill") {{
inputLiquid = Liquids.plasma;
drillTime = 240;
drillTime = 110;
size = 4;
powerUse = 0.16f;
hasLiquids = true;
hasPower = true;
}},
quartzextractor = new GenericDrill("quartzextractor") {{
powerUse = 0.1f;
resource = Blocks.sand;
result = Items.silicon;
drillTime = 320;
size = 2;
}},
waterextractor = new SolidPump("waterextractor") {{
result = Liquids.water;
powerUse = 0.2f;
@ -97,7 +73,6 @@ public class ProductionBlocks {
}},
cultivator = new Cultivator("cultivator") {{
resource = Blocks.grass;
result = Items.biomatter;
inputLiquid = Liquids.water;
liquidUse = 0.2f;

View File

@ -169,16 +169,6 @@ public class World extends Module{
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(){
return seed;
}

View File

@ -4,7 +4,6 @@ import com.badlogic.gdx.math.GridPoint2;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.blocks.Blocks;
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.core.GameState.State;
import io.anuke.mindustry.world.Block;
@ -243,7 +242,7 @@ public class Tutorial{
canForward = false;
blockPlaceX = 0;
blockPlaceY = -3;
targetBlock = ProductionBlocks.stonedrill;
//targetBlock = ProductionBlocks.stonedrill;
}
void onSwitch(){

View File

@ -20,6 +20,7 @@ public class Fx{
public static Color glowy = Color.valueOf("fdc056");
public static Color beam = Color.valueOf("9bffbe");
public static Color beamLight = Color.valueOf("ddffe9");
public static Color stoneGray = Color.valueOf("8f8f8f");
public static final Effect
@ -189,15 +190,23 @@ public class Fx{
pulverize = new Effect(40, e -> {
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);
Draw.reset();
});
}),
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)->{
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);
Draw.reset();
});
@ -352,13 +361,27 @@ public class Fx{
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 -> {
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);
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 -> {
Lines.stroke(1f);

View File

@ -1,5 +1,6 @@
package io.anuke.mindustry.resource;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.ucore.graphics.Draw;
@ -10,17 +11,23 @@ public class Item implements Comparable<Item>{
public final int id;
public final String name;
public final Color color;
public TextureRegion region;
public float explosiveness = 0f;
/**flammability above 0.3 makes this eleigible for item burners.*/
public float flammability = 0f;
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
public float fluxiness = 0f;
/**whether this material goes in the core*/
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.name = name;
this.color = color;
items.add(this);
}

View File

@ -2,9 +2,9 @@ package io.anuke.mindustry.world.blocks.types.distribution;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.BlockGroup;
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.layout.Table;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Tmp;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@ -35,11 +34,10 @@ public class Sorter extends Block{
super.draw(tile);
SorterEntity entity = tile.entity();
TextureRegion region = entity.sortItem.region;
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
Draw.rect(Tmp.tr1, tile.worldx(), tile.worldy(), 4f, 4f);
Draw.color(entity.sortItem.color);
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
Draw.color();
}
@Override

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
@ -20,6 +21,8 @@ public class Cultivator extends GenericDrill {
protected Color plantColorLight = Color.valueOf("73a75f");
protected Color bottomColor = Color.valueOf("474747");
protected Item result;
protected SeedRandom random = new SeedRandom(0);
protected float recurrence = 6f;
@ -75,6 +78,11 @@ public class Cultivator extends GenericDrill {
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 float warmup;

View File

@ -15,19 +15,22 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
import io.anuke.ucore.util.Tmp;
public class Drill extends Block{
protected final static float hardnessDrillMultiplier = 40f;
protected final int timerDrill = timers++;
protected final int timerDump = timers++;
protected final Array<Tile> drawTiles = new Array<>();
protected Block resource;
protected Item result;
protected int tier;
protected float drillTime = 300;
protected Effect drillEffect = Fx.mine;
protected float rotateSpeed = 2f;
protected Effect updateEffect = Fx.pulverizeSmall;
protected float updateEffectChance = 0.02f;
protected Array<Item> toAdd = new Array<>();
public Drill(String name) {
super(name);
@ -40,14 +43,17 @@ public class Drill extends Block{
@Override
public void draw(Tile tile) {
boolean valid = isMultiblock() || isValid(tile);
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());
TextureRegion region = result.region;
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
Draw.rect(Tmp.tr1, tile.drawx(), tile.drawy(), 2f, 2f);
if(!isMultiblock() && isValid(tile)) {
Draw.color(tile.floor().drops.item.color);
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
Draw.color();
}
}
@Override
@ -63,26 +69,37 @@ public class Drill extends Block{
@Override
public void update(Tile tile){
toAdd.clear();
TileEntity entity = tile.entity;
int mines = 0;
float multiplier = 0f;
float totalHardness = 0f;
if(isMultiblock()){
for(Tile other : tile.getLinkedTiles(tempTiles)){
if(isValid(other)){
mines ++;
}
for(Tile other : tile.getLinkedTiles(tempTiles)){
if(isValid(other)){
toAdd.add(other.floor().drops.item);
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){
for(int i = 0; i < mines; i ++) offloadNear(tile, result);
Effects.effect(drillEffect, tile.drawx(), tile.drawy());
if(toAdd.size > 0 && tile.entity.inventory.totalItems() < itemCapacity){
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);
}
}
@ -109,7 +126,7 @@ public class Drill extends Block{
}
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;
}
}

View File

@ -1,15 +1,12 @@
package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
@ -23,13 +20,10 @@ public class GenericDrill extends Drill{
protected Liquid inputLiquid = Liquids.water;
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){
super(name);
updateEffect = Fx.pulverizeMedium;
}
@Override
@ -53,10 +47,12 @@ public class GenericDrill extends Drill{
DrillEntity entity = tile.entity();
float multiplier = 0f;
float totalHardness = 0f;
for(Tile other : tile.getLinkedTiles(tempTiles)){
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;
}
}
@ -81,7 +77,7 @@ public class GenericDrill extends Drill{
return;
}
if(toAdd.size > 0 && entity.progress >= drillTime
if(toAdd.size > 0 && entity.progress >= drillTime + hardnessDrillMultiplier*totalHardness
&& tile.entity.inventory.totalItems() < itemCapacity){
int index = entity.index % toAdd.size;
@ -90,7 +86,7 @@ public class GenericDrill extends Drill{
entity.index ++;
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)){
@ -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
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
return super.acceptLiquid(tile, source, liquid, amount) && liquid == inputLiquid;

View File

@ -2,16 +2,15 @@ package io.anuke.mindustry.world.blocks.types.storage;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.style.TextureRegionDrawable;
import io.anuke.ucore.scene.ui.ButtonGroup;
import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Tmp;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@ -47,10 +46,9 @@ public class SortedUnloader extends Unloader {
SortedUnloaderEntity entity = tile.entity();
TextureRegion region = entity.sortItem.region;
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
Draw.rect(Tmp.tr1, tile.worldx(), tile.worldy(), 2f, 2f);
Draw.color(entity.sortItem.color);
Draw.rect("blank", tile.worldx(), tile.worldy(), 2f, 2f);
Draw.color();
}
@Override