mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 19:39:04 +07:00
Added incinerator
This commit is contained in:
parent
6db1175c95
commit
21fe0f9246
BIN
core/assets-raw/sprites/blocks/production/incinerator.png
Normal file
BIN
core/assets-raw/sprites/blocks/production/incinerator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 274 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sun Apr 08 12:00:18 EDT 2018
|
||||
#Sun Apr 08 12:22:42 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=873
|
||||
androidBuildCode=874
|
||||
name=Mindustry
|
||||
code=3.5
|
||||
build=custom build
|
||||
|
@ -67,6 +67,7 @@ public class Recipes {
|
||||
new Recipe(crafting, CraftingBlocks.pulverizer, stack(Items.steel, 10), stack(Items.iron, 10)),
|
||||
new Recipe(crafting, CraftingBlocks.stoneFormer, stack(Items.steel, 10), stack(Items.iron, 10)),
|
||||
new Recipe(crafting, CraftingBlocks.melter, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, CraftingBlocks.incinerator, stack(Items.steel, 60), stack(Items.iron, 60)),
|
||||
new Recipe(crafting, CraftingBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.iron, 60)).setDesktop(),
|
||||
|
||||
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||
|
@ -193,5 +193,9 @@ public class CraftingBlocks {
|
||||
weaponFactory = new WeaponFactory("weaponfactory") {{
|
||||
size = 2;
|
||||
health = 250;
|
||||
}},
|
||||
|
||||
incinerator = new Incinerator("incinerator") {{
|
||||
health = 90;
|
||||
}};
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
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.graphics.Fill;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class Incinerator extends Block {
|
||||
protected float powerUse = 0.07f;
|
||||
protected Effect effect = BlockFx.fuelburn;
|
||||
protected Color flameColor = Color.valueOf("ffad9d");
|
||||
|
||||
public Incinerator(String name) {
|
||||
super(name);
|
||||
hasPower = true;
|
||||
hasInventory = false;
|
||||
update = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile) {
|
||||
IncineratorEntity entity = tile.entity();
|
||||
|
||||
float used = Math.min(powerCapacity, powerUse * Timers.delta());
|
||||
|
||||
if(entity.power.amount >= used){
|
||||
entity.power.amount -= used;
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.04f);
|
||||
}else{
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 0f, 0.02f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile) {
|
||||
super.draw(tile);
|
||||
|
||||
IncineratorEntity entity = tile.entity();
|
||||
|
||||
if(entity.heat > 0f){
|
||||
float g = 0.3f;
|
||||
float r = 0.06f;
|
||||
float cr = Mathf.random(0.05f);
|
||||
|
||||
Draw.alpha(((1f-g) + Mathf.absin(Timers.time(), 8f, g) + Mathf.random(r) - r) * entity.heat);
|
||||
|
||||
Draw.tint(flameColor);
|
||||
Fill.circle(tile.drawx(), tile.drawy(), 2f);
|
||||
Draw.color(1f, 1f, 1f, entity.heat);
|
||||
Fill.circle(tile.drawx(), tile.drawy(), 1f);
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source) {
|
||||
if(Mathf.chance(0.3)){
|
||||
Effects.effect(effect, tile.drawx(), tile.drawy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source) {
|
||||
IncineratorEntity entity = tile.entity();
|
||||
return entity.heat > 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity() {
|
||||
return new IncineratorEntity();
|
||||
}
|
||||
|
||||
public static class IncineratorEntity extends TileEntity{
|
||||
public float heat;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user