Implemented liquid turrets with ammo / Implemented flamer turret
This commit is contained in:
@@ -6,5 +6,7 @@ import io.anuke.mindustry.resource.AmmoType;
|
||||
public class AmmoTypes {
|
||||
public static final AmmoType
|
||||
|
||||
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5, 0.9f);
|
||||
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5, 0.9f),
|
||||
|
||||
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f);
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ public class Recipes {
|
||||
|
||||
new Recipe(units, DebugBlocks.itemSource, stack(Items.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.itemVoid, stack(Items.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.liquidSource, stack(Items.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.powerVoid, stack(Items.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.powerInfinite, stack(Items.steel, 10), stack(Items.densealloy, 5)).setDebug()
|
||||
);
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
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.Sorter;
|
||||
import io.anuke.mindustry.world.blocks.types.power.PowerDistributor;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class DebugBlocks {
|
||||
public static final Block
|
||||
@@ -43,6 +55,90 @@ public class DebugBlocks {
|
||||
}
|
||||
},
|
||||
|
||||
liquidSource = new Block("liquidsource"){
|
||||
{
|
||||
update = true;
|
||||
solid = true;
|
||||
hasLiquids = true;
|
||||
liquidCapacity = 100f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfigurable(Tile tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile) {
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
|
||||
tile.entity.liquid.amount = liquidCapacity;
|
||||
tile.entity.liquid.liquid = entity.source;
|
||||
tryDumpLiquid(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
|
||||
Draw.color(entity.source.color);
|
||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
|
||||
Array<Liquid> items = Liquid.getAllLiquids();
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
Table cont = new Table();
|
||||
cont.margin(4);
|
||||
cont.marginBottom(5);
|
||||
|
||||
cont.add().colspan(4).height(50f * (int)(items.size/4f + 1f));
|
||||
cont.row();
|
||||
|
||||
for(int i = 0; i < items.size; i ++){
|
||||
if(i == 0) continue;
|
||||
final int f = i;
|
||||
ImageButton button = cont.addImageButton("white", "toggle", 24, () -> {
|
||||
entity.source = items.get(f);
|
||||
}).size(38, 42).padBottom(-5.1f).group(group).get();
|
||||
button.getStyle().imageUpColor = items.get(i).color;
|
||||
button.setChecked(entity.source.id == f);
|
||||
|
||||
if(i%4 == 3){
|
||||
cont.row();
|
||||
}
|
||||
}
|
||||
|
||||
table.add(cont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new LiquidSourceEntity();
|
||||
}
|
||||
|
||||
class LiquidSourceEntity extends TileEntity{
|
||||
public Liquid source = Liquids.water;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException {
|
||||
stream.writeByte(source.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException {
|
||||
source = Liquid.getByID(stream.readByte());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
itemVoid = new Block("itemvoid"){
|
||||
{
|
||||
update = solid = true;
|
||||
|
||||
@@ -35,9 +35,14 @@ public class WeaponBlocks{
|
||||
ammoUseEffect = BulletFx.shellEjectSmall;
|
||||
}},
|
||||
|
||||
flameturret = new Turret("flameturret"){
|
||||
|
||||
},
|
||||
flameturret = new LiquidTurret("flameturret"){{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.basicFlame};
|
||||
recoil = 0f;
|
||||
reload = 5f;
|
||||
shootCone = 50f;
|
||||
shootEffect = BulletFx.shootSmallFlame;
|
||||
ammoUseEffect = BulletFx.shellEjectSmall;
|
||||
}},
|
||||
|
||||
railgunturret = new Turret("railgunturret"){
|
||||
|
||||
@@ -55,9 +60,9 @@ public class WeaponBlocks{
|
||||
|
||||
},
|
||||
|
||||
magmaturret = new LiquidTurret("magmaturret") {
|
||||
|
||||
},
|
||||
magmaturret = new LiquidTurret("magmaturret") {{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.basicFlame};
|
||||
}},
|
||||
|
||||
plasmaturret = new Turret("plasmaturret"){
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package io.anuke.mindustry.content.bullets;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.graphics.fx.BulletFx;
|
||||
import io.anuke.mindustry.graphics.fx.Fx;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
|
||||
public class TurretBullets {
|
||||
@@ -15,5 +17,19 @@ public class TurretBullets {
|
||||
Draw.rect("bullet", b.x, b.y, 9f, 5f + b.fract()*7f, b.angle() - 90);
|
||||
Draw.color();
|
||||
}
|
||||
},
|
||||
|
||||
basicFlame = new BulletType(2f, 4) {
|
||||
{
|
||||
hitsize = 7f;
|
||||
lifetime = 30f;
|
||||
pierce = true;
|
||||
drag = 0.07f;
|
||||
hiteffect = BulletFx.hitFlameSmall;
|
||||
despawneffect = Fx.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b) {}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user