Added batteries, 3x3 teleporter

This commit is contained in:
Anuken
2018-03-10 20:28:25 -05:00
parent bf6e33791d
commit 3ce7284fc5
20 changed files with 392 additions and 367 deletions
@@ -78,6 +78,8 @@ public class Recipes {
new Recipe(power, DistributionBlocks.powerlaser, stack(Item.steel, 3), stack(Item.iron, 3)),
new Recipe(power, DistributionBlocks.powerlasercorner, stack(Item.steel, 4), stack(Item.iron, 4)),
new Recipe(power, DistributionBlocks.powerlaserrouter, stack(Item.steel, 5), stack(Item.iron, 5)),
new Recipe(power, DistributionBlocks.battery, stack(Item.steel, 5), stack(Item.iron, 5)),
new Recipe(power, DistributionBlocks.batteryLarge, stack(Item.steel, 5), stack(Item.iron, 5)),
new Recipe(power, DefenseBlocks.shieldgenerator, stack(Item.titanium, 30), stack(Item.dirium, 30)),
@@ -72,11 +72,21 @@ public class DistributionBlocks{
}},
powerlaser = new PowerLaser("powerlaser"){{
}},
powerlaserrouter = new PowerLaserRouter("powerlaserrouter"){{
powerlaserrouter = new PowerLaser("powerlaserrouter"){{
laserDirections = 3;
}},
powerlasercorner = new PowerLaserRouter("powerlasercorner"){{
powerlasercorner = new PowerLaser("powerlasercorner"){{
laserDirections = 2;
}},
battery = new PowerLaser("battery"){{
laserDirections = 1;
powerCapacity = 320f;
}},
batteryLarge = new PowerLaser("batterylarge"){{
laserDirections = 1;
size = 3;
powerCapacity = 2000f;
}},
teleporter = new Teleporter("teleporter"){{
}},
sorter = new Sorter("sorter"){{
@@ -13,6 +13,7 @@ public class BlockPart extends Block{
public BlockPart() {
super("blockpart");
solid = false;
hasPower = hasInventory = hasLiquids = true;
}
@Override
@@ -5,7 +5,6 @@ import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.BlockGroup;
public abstract class PowerBlock extends Block{
public float powerCapacity = 10f;
public float voltage = 0.001f;
public PowerBlock(String name) {
@@ -10,6 +10,7 @@ public class Wall extends Block{
solid = true;
destructible = true;
group = BlockGroup.walls;
hasInventory = false;
}
@Override
@@ -10,6 +10,7 @@ public abstract class LiquidTurret extends Turret{
public LiquidTurret(String name) {
super(name);
hasLiquids = true;
}
@Override
@@ -26,6 +26,7 @@ public class ShieldBlock extends PowerBlock{
super(name);
voltage = powerDrain;
powerCapacity = 80f;
hasInventory = false;
}
@Override
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.distribution;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.generation.Generator;
import io.anuke.ucore.graphics.Draw;
public class PowerLaser extends Generator{
public Color color = Color.valueOf("e54135");
@@ -14,6 +15,12 @@ public class PowerLaser extends Generator{
explosive = false;
laserDirections = 1;
health = 50;
hasInventory = false;
}
@Override
public void draw(Tile tile) {
Draw.rect(name(), tile.drawx(), tile.drawy(), tile.getRotation() * 90 - 90);
}
@Override
@@ -1,17 +0,0 @@
package io.anuke.mindustry.world.blocks.types.distribution;
import io.anuke.mindustry.world.Tile;
public class PowerLaserRouter extends PowerLaser{
public PowerLaserRouter(String name) {
super(name);
laserDirections = 3;
}
@Override
public void update(Tile tile){
distributeLaserPower(tile);
}
}
@@ -6,6 +6,7 @@ import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.BarType;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerBlock;
import io.anuke.ucore.core.Timers;
@@ -13,7 +14,6 @@ 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 io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
import java.io.DataInputStream;
@@ -47,7 +47,7 @@ public class Teleporter extends PowerBlock{
solid = true;
health = 80;
powerCapacity = 30f;
instantTransfer = true;
size = 3;
}
@Override
@@ -59,6 +59,12 @@ public class Teleporter extends PowerBlock{
}
}
@Override
public void setBars(){
super.setBars();
bars.remove(BarType.inventory);
}
@Override
public void setStats(){
super.setStats();
@@ -78,10 +84,10 @@ public class Teleporter extends PowerBlock{
super.draw(tile);
Draw.color(colorArray[entity.color]);
Draw.rect("blank", tile.worldx(), tile.worldy(), 2, 2);
Draw.color(Color.WHITE);
Draw.alpha(0.45f + Mathf.absin(Timers.time(), 7f, 0.26f));
Draw.rect("teleporter-top", tile.worldx(), tile.worldy());
Draw.rect("teleporter-top", tile.drawx(), tile.drawy());
//Draw.color(Color.WHITE);
//Draw.alpha(0.45f + Mathf.absin(Timers.time(), 7f, 0.26f));
//Draw.rect("teleporter-top", tile.worldx(), tile.worldy());
Draw.reset();
}
@@ -255,7 +255,7 @@ public class Generator extends PowerBlock{
if(other != null && other.block().hasPower){
Tile linked = other.getLinked();
if(linked == null || linked.block().hasPower){
if((linked == null || linked.block().hasPower) && linked != tile){
return other;
}
}