Added pulverizer, new temporary laser graphics, debug power blocks

This commit is contained in:
Anuken
2018-02-21 23:28:02 -05:00
parent 1fdffa8be5
commit eae07c15a7
13 changed files with 181 additions and 119 deletions

View File

@ -439,7 +439,7 @@ block.fluxpump.name=fluxpump
block.fluxpump.fulldescription=An advanced version of the pump. Stores more liquid and pumps liquid faster.
block.smelter.name=smelter
block.smelter.fulldescription=The essential crafting block. When inputted 1 iron and 1 coal as fuel, outputs one steel. It is advised to input iron and coal on different belts to prevent clogging.
block.crucible.name=crucible
block.crucible.name=alloy smelter
block.crucible.fulldescription=An advanced crafting block. When inputted 1 titanium, 1 steel and 1 coal as fuel, outputs one dirium. It is advised to input coal, steel and titanium on different belts to prevent clogging.
block.coalpurifier.name=coal extractor
block.coalpurifier.fulldescription=A basic extractor block. Outputs coal when supplied with large amounts of water and stone.

View File

@ -711,55 +711,69 @@ blocks/poweredconveyormove
orig: 8, 8
offset: 0, 0
index: -1
blocks/powerlaser
blocks/powerinfinite
rotate: false
xy: 308, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/powerlasercorner
blocks/powerlaser
rotate: false
xy: 318, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/powerlaserrouter
blocks/powerlasercorner
rotate: false
xy: 328, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pulseconduit
blocks/powerlaserrouter
rotate: false
xy: 338, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pulseconduitbottom
blocks/powervoid
rotate: false
xy: 348, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pulseconduittop
blocks/pulseconduit
rotate: false
xy: 358, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pump
blocks/pulseconduitbottom
rotate: false
xy: 368, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pulseconduittop
rotate: false
xy: 378, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/pump
rotate: false
xy: 388, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/repairturret
rotate: false
xy: 166, 81
@ -769,77 +783,77 @@ blocks/repairturret
index: -1
blocks/rock1
rotate: false
xy: 378, 75
xy: 398, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/rock2
rotate: false
xy: 388, 75
xy: 408, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/router
rotate: false
xy: 398, 75
xy: 418, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/rtgenerator
rotate: false
xy: 408, 75
xy: 428, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/rtgenerator-top
rotate: false
xy: 418, 75
xy: 438, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/sand1
rotate: false
xy: 428, 75
xy: 448, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/sand2
rotate: false
xy: 438, 75
xy: 458, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/sand3
rotate: false
xy: 448, 75
xy: 468, 75
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/sandblock1
rotate: false
xy: 458, 75
xy: 875, 417
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/sandblock2
rotate: false
xy: 468, 75
xy: 885, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/sandblock3
rotate: false
xy: 875, 417
xy: 895, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -860,7 +874,7 @@ blocks/shadow
index: -1
blocks/shieldgenerator
rotate: false
xy: 895, 421
xy: 915, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -874,28 +888,28 @@ blocks/shotgunturret
index: -1
blocks/shrub
rotate: false
xy: 945, 421
xy: 965, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/shrubshadow
rotate: false
xy: 955, 421
xy: 975, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/smelter
rotate: false
xy: 965, 421
xy: 985, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/smelter-middle
rotate: false
xy: 975, 421
xy: 995, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -909,42 +923,42 @@ blocks/sniperturret
index: -1
blocks/snow1
rotate: false
xy: 985, 421
xy: 298, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/snow2
rotate: false
xy: 995, 421
xy: 308, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/snow3
rotate: false
xy: 298, 65
xy: 318, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/snowblock1
rotate: false
xy: 308, 65
xy: 328, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/snowblock2
rotate: false
xy: 318, 65
xy: 338, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/snowblock3
rotate: false
xy: 328, 65
xy: 348, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -958,35 +972,35 @@ blocks/snowedge
index: -1
blocks/sorter
rotate: false
xy: 338, 65
xy: 358, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/splitter
rotate: false
xy: 348, 65
xy: 368, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/steelconveyor
rotate: false
xy: 358, 65
xy: 378, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/steelconveyormove
rotate: false
xy: 368, 65
xy: 388, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/steelwall
rotate: false
xy: 378, 65
xy: 398, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1000,56 +1014,56 @@ blocks/steelwall-large
index: -1
blocks/steelwall-large-icon
rotate: false
xy: 388, 65
xy: 408, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stone1
rotate: false
xy: 398, 65
xy: 418, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stone2
rotate: false
xy: 408, 65
xy: 428, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stone3
rotate: false
xy: 418, 65
xy: 438, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stoneblock1
rotate: false
xy: 428, 65
xy: 448, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stoneblock2
rotate: false
xy: 438, 65
xy: 458, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stoneblock3
rotate: false
xy: 448, 65
xy: 468, 65
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stonedrill
rotate: false
xy: 458, 65
xy: 885, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1063,35 +1077,35 @@ blocks/stoneedge
index: -1
blocks/stoneformer
rotate: false
xy: 468, 65
xy: 895, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/stonewall
rotate: false
xy: 885, 411
xy: 905, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/teleporter
rotate: false
xy: 895, 411
xy: 915, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/teleporter-top
rotate: false
xy: 905, 411
xy: 925, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/thermalgenerator
rotate: false
xy: 915, 411
xy: 935, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1112,49 +1126,49 @@ blocks/titancannon-icon
index: -1
blocks/titanium1
rotate: false
xy: 925, 411
xy: 945, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titanium2
rotate: false
xy: 935, 411
xy: 955, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titanium3
rotate: false
xy: 945, 411
xy: 965, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumdrill
rotate: false
xy: 955, 411
xy: 975, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumpurifier
rotate: false
xy: 965, 411
xy: 985, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumshieldwall
rotate: false
xy: 975, 411
xy: 995, 411
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/titaniumwall
rotate: false
xy: 985, 411
xy: 535, 127
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1168,7 +1182,7 @@ blocks/titaniumwall-large
index: -1
blocks/titaniumwall-large-icon
rotate: false
xy: 995, 411
xy: 742, 382
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1182,35 +1196,35 @@ blocks/turret
index: -1
blocks/uranium1
rotate: false
xy: 634, 267
xy: 644, 268
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/uranium2
rotate: false
xy: 644, 278
xy: 654, 272
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/uranium3
rotate: false
xy: 644, 268
xy: 664, 272
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/uraniumdrill
rotate: false
xy: 654, 272
xy: 674, 272
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
blocks/water
rotate: false
xy: 684, 272
xy: 654, 262
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1238,7 +1252,7 @@ blocks/weaponfactory
index: -1
blocks/weaponfactory-icon
rotate: false
xy: 644, 258
xy: 644, 248
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1616,28 +1630,28 @@ mechs/ship-standard
index: -1
shell
rotate: false
xy: 885, 421
xy: 905, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
shot
rotate: false
xy: 925, 421
xy: 945, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
shot-long
rotate: false
xy: 935, 421
xy: 955, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titanshell
rotate: false
xy: 535, 127
xy: 634, 277
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -2497,42 +2511,42 @@ weapons/clustergun-equip
index: -1
weapons/shockgun
rotate: false
xy: 905, 421
xy: 925, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
weapons/shockgun-equip
rotate: false
xy: 915, 421
xy: 935, 421
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
weapons/triblaster
rotate: false
xy: 742, 382
xy: 634, 267
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
weapons/triblaster-equip
rotate: false
xy: 634, 277
xy: 644, 278
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
weapons/vulcan
rotate: false
xy: 664, 272
xy: 684, 272
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
weapons/vulcan-equip
rotate: false
xy: 674, 272
xy: 644, 258
size: 8, 8
orig: 8, 8
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Wed Feb 21 20:34:22 EST 2018
#Wed Feb 21 23:25:11 EST 2018
version=release
androidBuildCode=267
androidBuildCode=269
name=Mindustry
code=3.3
build=custom build

View File

@ -114,7 +114,8 @@ public class BlockLoader {
DistributionBlocks.conduit,
ProductionBlocks.coaldrill,
WeaponBlocks.chainturret,
SpecialBlocks.enemySpawn
SpecialBlocks.enemySpawn,
DebugBlocks.powerVoid
//add any new block sections here
};

View File

@ -6,7 +6,7 @@ public class Recipe {
public Block result;
public ItemStack[] requirements;
public Section section;
public boolean desktopOnly = false;
public boolean desktopOnly = false, debugOnly = false;
public Recipe(Section section, Block result, ItemStack... requirements){
this.result = result;
@ -18,4 +18,9 @@ public class Recipe {
desktopOnly = true;
return this;
}
public Recipe setDebug(){
debugOnly = true;
return this;
}
}

View File

@ -3,11 +3,9 @@ package io.anuke.mindustry.resource;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.DefenseBlocks;
import io.anuke.mindustry.world.blocks.DistributionBlocks;
import io.anuke.mindustry.world.blocks.ProductionBlocks;
import io.anuke.mindustry.world.blocks.WeaponBlocks;
import io.anuke.mindustry.world.blocks.*;
import static io.anuke.mindustry.Vars.debug;
import static io.anuke.mindustry.resource.Section.*;
public class Recipes {
@ -85,7 +83,10 @@ public class Recipes {
new Recipe(liquid, DistributionBlocks.liquidjunction, stack(Item.steel, 2)),
new Recipe(production, ProductionBlocks.pump, stack(Item.steel, 10)),
new Recipe(production, ProductionBlocks.fluxpump, stack(Item.steel, 10), stack(Item.dirium, 5))
new Recipe(production, ProductionBlocks.fluxpump, stack(Item.steel, 10), stack(Item.dirium, 5)),
new Recipe(units, DebugBlocks.powerVoid, stack(Item.steel, 10)).setDebug(),
new Recipe(units, DebugBlocks.powerInfinite, stack(Item.steel, 10), stack(Item.dirium, 5)).setDebug()
);
private static ItemStack stack(Item item, int amount){
@ -107,8 +108,9 @@ public class Recipes {
public static Array<Recipe> getBy(Section section, Array<Recipe> r){
for(Recipe recipe : list){
if(recipe.section == section && !(Vars.android && recipe.desktopOnly))
if(recipe.section == section && !(Vars.android && recipe.desktopOnly) && !(!debug && recipe.debugOnly)) {
r.add(recipe);
}
}
return r;

View File

@ -0,0 +1,34 @@
package io.anuke.mindustry.world.blocks;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerBlock;
import io.anuke.mindustry.world.blocks.types.distribution.PowerLaser;
public class DebugBlocks {
public static final Block
powerVoid = new PowerBlock("powervoid") {
{
powerCapacity = Float.MAX_VALUE;
}
},
powerInfinite = new PowerLaser("powerinfinite") {
{
powerCapacity = 100f;
laserDirections = 4;
}
@Override
public boolean acceptsPower(Tile tile) {
return false;
}
@Override
public void update(Tile tile){
super.update(tile);
tile.<GeneratorEntity>entity().power = powerCapacity;
}
};
}

View File

@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks;
import io.anuke.mindustry.graphics.Fx;
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.blocks.types.defense.CoreBlock;
@ -104,15 +105,13 @@ public class ProductionBlocks{
}
},
pulverizer = new LiquidCrafter("siliconextractor"){
pulverizer = new PowerSmelter("pulverizer"){
{
input = Item.sand;
inputAmount = 5;
inputLiquid = Liquid.water;
liquidAmount = 18.99f;
output = Item.sand;
inputs = new ItemStack[]{new ItemStack(Item.stone, 5)};
result = Item.sand;
health = 50;
purifyTime = 50;
craftTime = 60f;
powerDrain = 0.02f;
}
},
@ -173,7 +172,7 @@ public class ProductionBlocks{
}
},
sandextractor = new Omnidrill("omnidrill"){
sandextractor = new Omnidrill("sandextractor"){
{
time = 4;
}

View File

@ -29,17 +29,6 @@ public abstract class PowerBlock extends Block implements PowerAcceptor{
list.add("[powerinfo]Power Capacity: " + powerCapacity);
}
/**Tries adding all the power with no remainder, returns success.*/
public boolean tryAddPower(Tile tile, float amount){
PowerEntity entity = tile.entity();
if(entity.power + amount <= powerCapacity){
entity.power += amount;
return true;
}
return false;
}
@Override
public boolean acceptsPower(Tile tile){
PowerEntity entity = tile.entity();

View File

@ -5,6 +5,7 @@ import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.world.Layer;
import io.anuke.mindustry.world.Tile;
@ -134,13 +135,13 @@ public class Generator extends PowerBlock{
public void drawLayer(Tile tile){
if(!Settings.getBool("lasers")) return;
PowerEntity entity = tile.entity();
GeneratorEntity entity = tile.entity();
for(int i = 0; i < laserDirections; i++){
if(entity.power > powerSpeed){
Draw.alpha(1f);
entity.laserThickness = Mathf.lerpDelta(entity.laserThickness, 1f, 0.05f);
}else{
Draw.alpha(0.5f);
entity.laserThickness = Mathf.lerpDelta(entity.laserThickness, 0.2f, 0.05f);
}
drawLaserTo(tile, (tile.getRotation() + i) - laserDirections / 2);
}
@ -153,6 +154,15 @@ public class Generator extends PowerBlock{
return false;
}
@Override
public TileEntity getEntity() {
return new GeneratorEntity();
}
public static class GeneratorEntity extends PowerEntity{
float laserThickness = 0.5f;
}
protected void distributeLaserPower(Tile tile){
PowerEntity entity = tile.entity();
@ -177,6 +187,10 @@ public class Generator extends PowerBlock{
Tile target = laserTarget(tile, rotation);
GeneratorEntity entity = tile.entity();
float scale = 1f * entity.laserThickness;
if(target != null){
boolean interfering = isInterfering(target, rotation);
@ -202,11 +216,14 @@ public class Generator extends PowerBlock{
if(relative == -1){
Shapes.laser("laser", "laserend", tile.worldx() + t2.x, tile.worldy() + t2.y,
target.worldx() - t1.x + Mathf.range(r),
target.worldy() - t1.y + Mathf.range(r), 0.7f);
target.worldy() - t1.y + Mathf.range(r), scale);
}else{
float s = 18f;
float sclx = (relative == 1 || relative == 3) ? entity.laserThickness : 1f;
float scly = (relative == 1 || relative == 3) ? 1f : entity.laserThickness;
Draw.rect("laserfull",
tile.worldx() + Geometry.d4[relative].x * width * tilesize / 2f,
tile.worldy() + Geometry.d4[relative].y * width * tilesize / 2f);
tile.worldy() + Geometry.d4[relative].y * width * tilesize / 2f , s * sclx, s * scly);
}
Draw.color();

View File

@ -109,7 +109,7 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{
return liquidCapacity;
}
public static class LiquidPowerEntity extends PowerEntity{
public static class LiquidPowerEntity extends GeneratorEntity{
public Liquid liquid;
public float liquidAmount;

View File

@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.world.BlockBar;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerBlock;
@ -21,7 +22,7 @@ public class PowerSmelter extends PowerBlock {
protected final int timerDump = timers++;
protected final int timerCraft = timers++;
protected Item[] inputs;
protected ItemStack[] inputs;
protected Item result;
protected float powerDrain = 0.01f;
@ -43,8 +44,8 @@ public class PowerSmelter extends PowerBlock {
@Override
public void init(){
for(Item item : inputs){
bars.add(new BlockBar(Color.GREEN, true, tile -> (float)tile.entity.getItem(item)/capacity));
for(ItemStack item : inputs){
bars.add(new BlockBar(Color.GREEN, true, tile -> (float)tile.entity.getItem(item.item)/capacity));
}
}
@ -82,8 +83,8 @@ public class PowerSmelter extends PowerBlock {
entity.heat = Mathf.clamp(entity.heat);
//make sure it has all the items
for(Item item : inputs){
if(!entity.hasItem(item)){
for(ItemStack item : inputs){
if(!entity.hasItem(item.item, item.amount)){
return;
}
}
@ -94,8 +95,8 @@ public class PowerSmelter extends PowerBlock {
return;
}
for(Item item : inputs){
entity.removeItem(item, 1);
for(ItemStack item : inputs){
entity.removeItem(item.item, item.amount);
}
offloadNear(tile, result);
@ -106,8 +107,8 @@ public class PowerSmelter extends PowerBlock {
public boolean acceptItem(Item item, Tile tile, Tile source){
boolean isInput = false;
for(Item req : inputs){
if(req == item){
for(ItemStack req : inputs){
if(req.item == item){
isInput = true;
break;
}
@ -120,12 +121,12 @@ public class PowerSmelter extends PowerBlock {
public void draw(Tile tile){
super.draw(tile);
Smelter.CrafterEntity entity = tile.entity();
PowerSmelterEntity entity = tile.entity();
//draw glowing center
if(entity.burnTime > 0){
if(entity.heat > 0f){
Draw.color(1f, 1f, 1f, Mathf.absin(Timers.time(), 9f, 0.4f) + Mathf.random(0.05f));
Draw.rect("smelter-middle", tile.worldx(), tile.worldy());
Draw.rect("smelter-middle", tile.drawx(), tile.drawy());
Draw.color();
}
}