Added uranium and oil refinery
BIN
core/assets-raw/sprites/blocks/liquidjunction.png
Normal file
After Width: | Height: | Size: 243 B |
BIN
core/assets-raw/sprites/blocks/oilrefinery.png
Normal file
After Width: | Height: | Size: 241 B |
BIN
core/assets-raw/sprites/blocks/poweredconveyor.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
core/assets-raw/sprites/blocks/poweredconveyormove.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
core/assets-raw/sprites/blocks/uranium1.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
core/assets-raw/sprites/blocks/uranium2.png
Normal file
After Width: | Height: | Size: 271 B |
BIN
core/assets-raw/sprites/blocks/uranium3.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
core/assets-raw/sprites/blocks/uraniumdrill.png
Normal file
After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 276 B |
BIN
core/assets-raw/sprites/icon-uranium.png
Normal file
After Width: | Height: | Size: 282 B |
BIN
core/assets-raw/sprites/ui/icon-crafting.png
Normal file
After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 177 B |
BIN
core/assets-raw/sprites/ui/icon-weapon.png
Normal file
After Width: | Height: | Size: 200 B |
@ -16,8 +16,11 @@ varying vec2 v_texCoord;
|
||||
void main() {
|
||||
|
||||
vec2 T = v_texCoord.xy;
|
||||
|
||||
vec2 coords = (T * u_texsize) + u_offset;
|
||||
|
||||
T += vec2(sin(coords.y / 3.0 + u_time / 20.0) / 250.0, sin(coords.x / 3.0 + u_time / 20.0) / 250.0);
|
||||
|
||||
float si = 1.0 + sin(u_time / 20.0 /*+ (coords.x + coords.y) / 30.0*/) / 8.0;
|
||||
|
||||
vec4 color = texture2D(u_texture, T) * vec4(si, si, si, 1.0);
|
||||
@ -27,7 +30,7 @@ void main() {
|
||||
bool any = false;
|
||||
|
||||
float thickness = 1.0;
|
||||
float step = 1.0;
|
||||
float step = 1.5;
|
||||
|
||||
if(texture2D(u_texture, T).a < 0.1 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.1 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.1 ||
|
||||
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
@ -85,6 +85,13 @@ public class EffectCreator{
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("purifyoil", 10, e -> {
|
||||
Draw.color(Hue.mix(Color.BLACK, Color.GRAY, e.ifract()));
|
||||
Draw.thickness(2f);
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("generate", 11, e -> {
|
||||
Draw.color(Hue.mix(Color.ORANGE, Color.YELLOW, e.ifract()));
|
||||
Draw.thickness(1f);
|
||||
|
@ -40,6 +40,8 @@ public class UI extends SceneModule{
|
||||
VisibilityProvider play = () -> !GameState.is(State.menu);
|
||||
VisibilityProvider nplay = () -> GameState.is(State.menu);
|
||||
|
||||
private Array<Item> tempItems = new Array<>();
|
||||
|
||||
public UI() {
|
||||
Dialog.setShowAction(()-> sequence(Actions.moveToAligned(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), Align.center),
|
||||
parallel(Actions.moveToAligned(Gdx.graphics.getWidth()/2,
|
||||
@ -237,12 +239,16 @@ public class UI extends SceneModule{
|
||||
}
|
||||
});
|
||||
button.setName("sectionbutton" + sec.name());
|
||||
add(button).fill().height(54).padRight(-0.1f).padTop(-10).units(Unit.dp);
|
||||
button.getImageCell().size(40).padBottom(4).units(Unit.dp);
|
||||
add(button).growX().height(54).padTop(sec.ordinal() <= 2 ? -10 : -5).units(Unit.dp);
|
||||
button.getImageCell().size(40).padBottom(4).padTop(2).units(Unit.dp);
|
||||
group.add(button);
|
||||
|
||||
if(sec.ordinal() % 3 == 2 && sec.ordinal() > 0){
|
||||
row();
|
||||
}
|
||||
|
||||
table.pad(4);
|
||||
table.top();
|
||||
table.top().left();
|
||||
|
||||
int i = 0;
|
||||
|
||||
@ -277,12 +283,6 @@ public class UI extends SceneModule{
|
||||
i++;
|
||||
}
|
||||
|
||||
//additional padding
|
||||
for(int j = 0; j < maxcol - (int)((float)recipes.size/rows+2); j ++){
|
||||
table.row();
|
||||
table.add().size(size);
|
||||
}
|
||||
|
||||
table.setVisible(()-> button.isChecked());
|
||||
|
||||
stack.add(table);
|
||||
@ -290,7 +290,7 @@ public class UI extends SceneModule{
|
||||
|
||||
|
||||
row();
|
||||
add(stack).colspan(3);
|
||||
add(stack).colspan(Section.values().length);
|
||||
get().pad(10f);
|
||||
|
||||
get().padLeft(0f);
|
||||
@ -716,8 +716,14 @@ public class UI extends SceneModule{
|
||||
public void updateItems(){
|
||||
itemtable.clear();
|
||||
itemtable.left();
|
||||
|
||||
tempItems.clear();
|
||||
for(Item item : control.getItems().keys()){
|
||||
tempItems.add(item);
|
||||
}
|
||||
tempItems.sort();
|
||||
|
||||
for(Item stack : control.getItems().keys()){
|
||||
for(Item stack : tempItems){
|
||||
Image image = new Image(Draw.region("icon-" + stack.name()));
|
||||
Label label = new Label("" + Mindustry.formatter.format(control.getAmount(stack)));
|
||||
label.setFontScale(fontscale*1.5f);
|
||||
|
@ -6,9 +6,11 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.BulletEntity;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class Shield extends Entity{
|
||||
public boolean active;
|
||||
@ -55,10 +57,12 @@ public class Shield extends Entity{
|
||||
|
||||
ShieldBlock block = (ShieldBlock)tile.block();
|
||||
|
||||
float rad = block.shieldRadius*2 + Mathf.sin(Timers.time(), 25f, 2f);
|
||||
|
||||
Graphics.surface("shield", false);
|
||||
Draw.color(Color.ROYAL);
|
||||
Draw.thick(2f);
|
||||
Draw.rect("circle2", x, y, block.shieldRadius*2, block.shieldRadius*2);
|
||||
Draw.rect("circle2", x, y, rad, rad);
|
||||
Draw.reset();
|
||||
Graphics.surface();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public enum Item{
|
||||
stone, iron, coal, steel, titanium, dirium;
|
||||
stone, iron, coal, steel, titanium, dirium, uranium;
|
||||
}
|
||||
|
16
core/src/io/anuke/mindustry/resource/Mech.java
Normal file
@ -0,0 +1,16 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public enum Mech{
|
||||
normal("default"),
|
||||
scout("scout"){{
|
||||
|
||||
}};
|
||||
public final String name;
|
||||
public float speedBoost = 1f, damageBoost = 1f;
|
||||
public int regenRate = 10;
|
||||
public int health = 20;
|
||||
|
||||
private Mech(String name){
|
||||
this.name = name;
|
||||
}
|
||||
}
|
@ -8,47 +8,52 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
|
||||
public enum Recipe{
|
||||
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)),
|
||||
machineturret(defense, WeaponBlocks.machineturret, stack(Item.iron, 8), stack(Item.stone, 10)),
|
||||
shotgunturret(defense, WeaponBlocks.shotgunturret, stack(Item.iron, 10), stack(Item.stone, 10)),
|
||||
flameturret(defense, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
|
||||
sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 15), stack(Item.steel, 10)),
|
||||
laserturret(defense, WeaponBlocks.laserturret, stack(Item.steel, 10), stack(Item.titanium, 10)),
|
||||
mortarturret(defense, WeaponBlocks.mortarturret, stack(Item.steel, 20), stack(Item.titanium, 15)),
|
||||
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)),
|
||||
|
||||
stonewall(defense, DefenseBlocks.stonewall, stack(Item.stone, 2)),
|
||||
ironwall(defense, DefenseBlocks.ironwall, stack(Item.iron, 2)),
|
||||
steelwall(defense, DefenseBlocks.steelwall, stack(Item.steel, 2)),
|
||||
titaniumwall(defense, DefenseBlocks.titaniumwall, stack(Item.titanium, 2)),
|
||||
duriumwall(defense, DefenseBlocks.diriumwall, stack(Item.dirium, 2)),
|
||||
compositewall(defense, DefenseBlocks.compositewall, stack(Item.dirium, 2), stack(Item.titanium, 2), stack(Item.steel, 2), stack(Item.iron, 2)),
|
||||
healturret(defense, DefenseBlocks.repairturret, stack(Item.iron, 30)),
|
||||
megahealturret(defense, DefenseBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)),
|
||||
titaniumshieldwall(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 2)),
|
||||
|
||||
conveyor(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)),
|
||||
steelconveyor(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
|
||||
poweredconveyor(distribution, DistributionBlocks.poweredconveyor, stack(Item.dirium, 1)),
|
||||
router(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
|
||||
junction(distribution, DistributionBlocks.junction, stack(Item.iron, 2)),
|
||||
conduit(distribution, DistributionBlocks.conduit, stack(Item.steel, 1)),
|
||||
liquidrouter(distribution, DistributionBlocks.liquidrouter, stack(Item.steel, 2)),
|
||||
liquidjunction(distribution, DistributionBlocks.liquidjunction, stack(Item.steel, 2)),
|
||||
|
||||
turret(weapon, WeaponBlocks.turret, stack(Item.stone, 4)),
|
||||
dturret(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
|
||||
machineturret(weapon, WeaponBlocks.machineturret, stack(Item.iron, 8), stack(Item.stone, 10)),
|
||||
shotgunturret(weapon, WeaponBlocks.shotgunturret, stack(Item.iron, 10), stack(Item.stone, 10)),
|
||||
flameturret(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
|
||||
sniperturret(weapon, WeaponBlocks.sniperturret, stack(Item.iron, 15), stack(Item.steel, 10)),
|
||||
laserturret(weapon, WeaponBlocks.laserturret, stack(Item.steel, 10), stack(Item.titanium, 10)),
|
||||
mortarturret(weapon, WeaponBlocks.mortarturret, stack(Item.steel, 20), stack(Item.titanium, 15)),
|
||||
teslaturret(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)),
|
||||
plasmaturret(weapon, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)),
|
||||
|
||||
smelter(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
|
||||
crucible(crafting, ProductionBlocks.crucible, stack(Item.titanium, 40), stack(Item.steel, 40)),
|
||||
coalpurifier(crafting, ProductionBlocks.coalpurifier, stack(Item.steel, 10), stack(Item.iron, 10)),
|
||||
titaniumpurifier(crafting, ProductionBlocks.titaniumpurifier, stack(Item.steel, 30), stack(Item.iron, 30)),
|
||||
oilrefinery(crafting, ProductionBlocks.oilrefinery, stack(Item.steel, 30), stack(Item.iron, 30)),
|
||||
|
||||
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)),
|
||||
smelter(production, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
|
||||
crucible(production, ProductionBlocks.crucible, stack(Item.titanium, 40), stack(Item.steel, 40)),
|
||||
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)),
|
||||
uraniumdrill(production, ProductionBlocks.uraniumdrill, stack(Item.titanium, 20), stack(Item.steel, 40)),
|
||||
omnidrill(production, ProductionBlocks.omnidrill, stack(Item.titanium, 20), stack(Item.dirium, 20)),
|
||||
|
||||
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, power;
|
||||
weapon, production, distribution, power, defense, crafting;
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ public class Generator{
|
||||
if(Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.253){
|
||||
floor = Blocks.titanium;
|
||||
}
|
||||
|
||||
if(Noise.nnoise(x + 99999, y + 99999, 6, 1) > 0.254){
|
||||
floor = Blocks.uranium;
|
||||
}
|
||||
}
|
||||
|
||||
if(block == Blocks.grassblock){
|
||||
|
@ -87,6 +87,10 @@ public class Blocks{
|
||||
drops = new ItemStack(Item.titanium, 1);
|
||||
}},
|
||||
|
||||
uranium = new Floor("uranium"){{
|
||||
drops = new ItemStack(Item.uranium, 1);
|
||||
}},
|
||||
|
||||
dirt = new Floor("dirt"),
|
||||
|
||||
grass = new Floor("grass"),
|
||||
|
@ -30,7 +30,7 @@ public class DistributionBlocks{
|
||||
poweredconveyor = new Conveyor("poweredconveyor"){{
|
||||
health = 90;
|
||||
speed = 0.09f;
|
||||
formalName = "powered conveyor";
|
||||
formalName = "pulse conveyor";
|
||||
}},
|
||||
|
||||
router = new Router("router"){
|
||||
@ -38,5 +38,8 @@ public class DistributionBlocks{
|
||||
|
||||
junction = new Junction("junction"){
|
||||
|
||||
},
|
||||
liquidjunction = new LiquidJunction("liquidjunction"){
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class ProductionBlocks{
|
||||
}
|
||||
},
|
||||
|
||||
coalpurifier = new Purifier("coalpurifier"){
|
||||
coalpurifier = new LiquidCrafter("coalpurifier"){
|
||||
{
|
||||
formalName = "coal extractor";
|
||||
input = Item.stone;
|
||||
@ -83,7 +83,7 @@ public class ProductionBlocks{
|
||||
}
|
||||
},
|
||||
|
||||
titaniumpurifier = new Purifier("titaniumpurifier"){
|
||||
titaniumpurifier = new LiquidCrafter("titaniumpurifier"){
|
||||
{
|
||||
formalName = "titanium\nextractor";
|
||||
input = Item.iron;
|
||||
@ -102,6 +102,24 @@ public class ProductionBlocks{
|
||||
}
|
||||
},
|
||||
|
||||
oilrefinery = new LiquidCrafter("oilrefinery"){
|
||||
{
|
||||
formalName = "oil refinery";
|
||||
inputLiquid = Liquid.oil;
|
||||
liquidAmount = 45f;
|
||||
liquidCapacity = 46f;
|
||||
purifyTime = 70;
|
||||
output = Item.coal;
|
||||
health = 80;
|
||||
craftEffect = "purifyoil";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description(){
|
||||
return "Takes in oil, outputs coal.";
|
||||
}
|
||||
},
|
||||
|
||||
stonedrill = new Drill("stonedrill"){{
|
||||
resource = Blocks.stone;
|
||||
result = Item.stone;
|
||||
@ -120,6 +138,12 @@ public class ProductionBlocks{
|
||||
formalName = "coal drill";
|
||||
}},
|
||||
|
||||
uraniumdrill = new Drill("uraniumdrill"){{
|
||||
resource = Blocks.uranium;
|
||||
result = Item.uranium;
|
||||
formalName = "uranium drill";
|
||||
}},
|
||||
|
||||
titaniumdrill = new Drill("titaniumdrill"){{
|
||||
resource = Blocks.titanium;
|
||||
result = Item.titanium;
|
||||
@ -153,7 +177,7 @@ public class ProductionBlocks{
|
||||
coalgenerator = new ItemPowerGenerator("coalgenerator"){
|
||||
{
|
||||
//TODO
|
||||
generateItem = Item.stone;
|
||||
generateItem = Item.coal;
|
||||
generateAmount = 4f;
|
||||
powerCapacity = 40f;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class ShieldBlock extends PowerBlock{
|
||||
private static boolean debugShield = true;
|
||||
|
||||
public float shieldRadius = 40f;
|
||||
public float powerDrain = 0.01f;
|
||||
|
||||
@ -20,6 +22,8 @@ public class ShieldBlock extends PowerBlock{
|
||||
|
||||
if(entity.shield == null){
|
||||
entity.shield = new Shield(tile);
|
||||
if(debugShield)
|
||||
entity.shield.add();
|
||||
}
|
||||
|
||||
if(entity.power > powerDrain * Timers.delta()){
|
||||
@ -29,7 +33,7 @@ public class ShieldBlock extends PowerBlock{
|
||||
|
||||
entity.power -= powerDrain * Timers.delta();
|
||||
}else{
|
||||
if(entity.shield.active){
|
||||
if(entity.shield.active && !debugShield){
|
||||
entity.shield.remove();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
|
||||
public class LiquidJunction extends LiquidBlock{
|
||||
|
||||
public LiquidJunction(String name) {
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
rotate = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
Draw.rect(name(), tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = tile.getNearby()[dir];
|
||||
|
||||
((LiquidBlock)to.block()).handleLiquid(to, tile, liquid, amount);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile dest, Tile source, Liquid liquid, float amount){
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = dest.getNearby()[dir];
|
||||
return to != null && to.block() != this && to.block() instanceof LiquidBlock &&
|
||||
((LiquidBlock)to.block()).acceptLiquid(to, dest, liquid, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description(){
|
||||
return "Serves as a liquid junction.";
|
||||
}
|
||||
}
|
@ -1,12 +1,21 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.production.Generator;
|
||||
|
||||
public class PowerBooster extends PowerBlock{
|
||||
public class PowerBooster extends Generator{
|
||||
|
||||
//TODO
|
||||
public PowerBooster(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float addPower(Tile tile, float amount){
|
||||
PowerEntity entity = tile.entity();
|
||||
|
||||
float canAccept = Math.min(powerCapacity - entity.power, amount);
|
||||
entity.power += canAccept;
|
||||
return canAccept;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class Purifier extends LiquidBlock{
|
||||
public class LiquidCrafter extends LiquidBlock{
|
||||
/**Can be null.*/
|
||||
public Item input = null;
|
||||
public int inputAmount = 5;
|
||||
public Liquid inputLiquid = null;
|
||||
@ -20,8 +21,9 @@ public class Purifier extends LiquidBlock{
|
||||
public Item output = null;
|
||||
public int itemCapacity = 90;
|
||||
public int purifyTime = 80;
|
||||
public String craftEffect = "purify";
|
||||
|
||||
public Purifier(String name) {
|
||||
public LiquidCrafter(String name) {
|
||||
super(name);
|
||||
update = true;
|
||||
rotate = false;
|
||||
@ -48,12 +50,13 @@ public class Purifier extends LiquidBlock{
|
||||
LiquidEntity entity = tile.entity();
|
||||
|
||||
if(Timers.get(tile, "purify", purifyTime) && entity.liquidAmount >= liquidAmount &&
|
||||
entity.hasItem(input, inputAmount)){
|
||||
(input == null || entity.hasItem(input, inputAmount))){
|
||||
|
||||
entity.removeItem(input, inputAmount);
|
||||
if(input != null)
|
||||
entity.removeItem(input, inputAmount);
|
||||
entity.liquidAmount -= liquidAmount;
|
||||
offloadNear(tile, output);
|
||||
Effects.effect("purify", tile.worldx(), tile.worldy());
|
||||
Effects.effect(craftEffect, tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
if(Timers.get(tile.hashCode(), "dump", 30)){
|
||||
@ -63,6 +66,8 @@ public class Purifier extends LiquidBlock{
|
||||
|
||||
@Override
|
||||
public void drawPixelOverlay(Tile tile){
|
||||
if(input == null) return;
|
||||
|
||||
float fract = (float)tile.entity.items.get(input, 0) / itemCapacity;
|
||||
|
||||
Vars.renderer.drawBar(Color.GREEN, tile.worldx(), tile.worldy() + 13, fract);
|
||||
@ -76,7 +81,7 @@ public class Purifier extends LiquidBlock{
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
TileEntity entity = tile.entity();
|
||||
return item == input && entity.items.get(item, 0) < itemCapacity;
|
||||
return input != null && item == input && entity.items.get(item, 0) < itemCapacity;
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ public class Pump extends LiquidBlock{
|
||||
public Pump(String name) {
|
||||
super(name);
|
||||
rotate = false;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|