Added longer-range power nodes / Resprite of some generators
BIN
core/assets-raw/sprites/blocks/extra/cross-4.png
Normal file
After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 315 B |
After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
BIN
core/assets-raw/sprites/blocks/power/powernodelarge.png
Normal file
After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 101 KiB |
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sat Mar 31 15:29:43 EDT 2018
|
||||
#Sat Mar 31 17:19:49 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=766
|
||||
androidBuildCode=773
|
||||
name=Mindustry
|
||||
code=3.4
|
||||
build=custom build
|
||||
|
@ -86,16 +86,17 @@ public class Recipes {
|
||||
new Recipe(production, ProductionBlocks.waterextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.oilextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
|
||||
new Recipe(power, PowerBlocks.coalgenerator, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.thermalgenerator, stack(Items.steel, 30)),
|
||||
new Recipe(power, PowerBlocks.combustiongenerator, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.solarpanel, stack(Items.iron, 30), stack(Items.silicon, 20)),
|
||||
new Recipe(power, PowerBlocks.largesolarpanel, stack(Items.iron, 30), stack(Items.silicon, 20)),
|
||||
new Recipe(power, PowerBlocks.rtgenerator, stack(Items.titanium, 20), stack(Items.steel, 20)),
|
||||
new Recipe(power, PowerBlocks.nuclearReactor, stack(Items.titanium, 40), stack(Items.densealloy, 40), stack(Items.steel, 50)),
|
||||
new Recipe(power, PowerBlocks.powernode, stack(Items.steel, 3), stack(Items.iron, 3)),
|
||||
new Recipe(power, PowerBlocks.powernodelarge, stack(Items.steel, 3), stack(Items.iron, 3)),
|
||||
new Recipe(power, PowerBlocks.battery, stack(Items.steel, 5), stack(Items.iron, 5)),
|
||||
new Recipe(power, PowerBlocks.batteryLarge, stack(Items.steel, 5), stack(Items.iron, 5)),
|
||||
new Recipe(power, PowerBlocks.combustiongenerator, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.liquidcombustiongenerator, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.thermalgenerator, stack(Items.steel, 30)),
|
||||
new Recipe(power, PowerBlocks.rtgenerator, stack(Items.titanium, 20), stack(Items.steel, 20)),
|
||||
new Recipe(power, PowerBlocks.solarpanel, stack(Items.iron, 30), stack(Items.silicon, 20)),
|
||||
new Recipe(power, PowerBlocks.largesolarpanel, stack(Items.iron, 30), stack(Items.silicon, 20)),
|
||||
new Recipe(power, PowerBlocks.nuclearReactor, stack(Items.titanium, 40), stack(Items.densealloy, 40), stack(Items.steel, 50)),
|
||||
|
||||
new Recipe(power, PowerBlocks.shieldgenerator, stack(Items.titanium, 30), stack(Items.densealloy, 30)),
|
||||
|
||||
|
@ -10,8 +10,7 @@ import io.anuke.mindustry.world.blocks.types.power.*;
|
||||
public class PowerBlocks {
|
||||
public static final Block
|
||||
|
||||
coalgenerator = new BurnerGenerator("coalgenerator") {{
|
||||
//generateItem = Items.coal;
|
||||
combustiongenerator = new BurnerGenerator("combustiongenerator") {{
|
||||
powerOutput = 0.04f;
|
||||
powerCapacity = 40f;
|
||||
}},
|
||||
@ -23,17 +22,16 @@ public class PowerBlocks {
|
||||
generateEffect = BlockFx.redgeneratespark;
|
||||
}},
|
||||
|
||||
combustiongenerator = new LiquidBurnerGenerator("combustiongenerator") {{
|
||||
liquidcombustiongenerator = new LiquidBurnerGenerator("liquidcombustiongenerator") {{
|
||||
maxLiquidGenerate = 0.4f;
|
||||
powerPerLiquid = 0.12f;
|
||||
powerCapacity = 40f;
|
||||
}},
|
||||
|
||||
rtgenerator = new BurnerGenerator("rtgenerator") {{
|
||||
//generateItem = Items.thorium;
|
||||
rtgenerator = new DecayGenerator("rtgenerator") {{
|
||||
powerCapacity = 40f;
|
||||
powerOutput = 0.03f;
|
||||
itemDuration = 240f;
|
||||
powerOutput = 0.02f;
|
||||
itemDuration = 500f;
|
||||
}},
|
||||
|
||||
solarpanel = new SolarGenerator("solarpanel") {{
|
||||
@ -72,14 +70,23 @@ public class PowerBlocks {
|
||||
|
||||
battery = new PowerGenerator("battery") {{
|
||||
powerCapacity = 320f;
|
||||
hasInventory = false;
|
||||
}},
|
||||
|
||||
batteryLarge = new PowerGenerator("batterylarge") {{
|
||||
size = 3;
|
||||
powerCapacity = 2000f;
|
||||
hasInventory = false;
|
||||
}},
|
||||
|
||||
powernode = new PowerDistributor("powernode"),
|
||||
|
||||
powernodelarge = new PowerDistributor("powernodelarge"){{
|
||||
size = 2;
|
||||
powerSpeed = 1f;
|
||||
maxNodes = 5;
|
||||
laserRange = 6.5f;
|
||||
}},
|
||||
|
||||
teleporter = new Teleporter("teleporter");
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import static io.anuke.mindustry.Vars.respawnduration;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class Fx{
|
||||
public static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
public static Color lightOrange = Color.valueOf("f68021");
|
||||
public static Color lighterOrange = Color.valueOf("f6e096");
|
||||
public static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f);
|
||||
|
@ -17,6 +17,8 @@ public class Item implements Comparable<Item>{
|
||||
public float explosiveness = 0f;
|
||||
/**flammability above 0.3 makes this eleigible for item burners.*/
|
||||
public float flammability = 0f;
|
||||
/**how radioactive this item is. 0=none, 1=ridiculous*/
|
||||
public float radioactivity;
|
||||
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
|
||||
public float fluxiness = 0f;
|
||||
/**whether this material goes in the core*/
|
||||
|
@ -12,11 +12,11 @@ public class Edges {
|
||||
private static final int maxRadius = 12;
|
||||
private static GridPoint2[][] edges = new GridPoint2[maxSize][0];
|
||||
private static GridPoint2[][] edgeInside = new GridPoint2[maxSize][0];
|
||||
private static Vector2[][] polygons = new Vector2[12][0];
|
||||
private static Vector2[][] polygons = new Vector2[maxRadius*2][0];
|
||||
|
||||
static{
|
||||
for(int i = 0; i < maxRadius; i ++){
|
||||
polygons[i] = Geometry.pixelCircle(i + 1);
|
||||
for(int i = 0; i < maxRadius*2; i ++){
|
||||
polygons[i] = Geometry.pixelCircle((i + 1)/2f);
|
||||
}
|
||||
|
||||
for(int i = 0; i < maxSize; i ++){
|
||||
@ -49,9 +49,9 @@ public class Edges {
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector2[] getPixelPolygon(int radius){
|
||||
public static Vector2[] getPixelPolygon(float radius){
|
||||
if(radius < 1 || radius > maxRadius) throw new RuntimeException("Polygon size must be between 1 and " + maxRadius);
|
||||
return polygons[radius - 1];
|
||||
return polygons[(int)(radius*2) - 1];
|
||||
}
|
||||
|
||||
public static synchronized GridPoint2[] getEdges(int size){
|
||||
|
@ -19,7 +19,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class BurnerGenerator extends PowerGenerator {
|
||||
protected float minFlammability = 0.2f;
|
||||
protected float minEfficiency = 0.2f;
|
||||
protected float powerOutput;
|
||||
protected float itemDuration = 70f;
|
||||
protected Effect generateEffect = BlockFx.generatespark;
|
||||
@ -61,7 +61,7 @@ public class BurnerGenerator extends PowerGenerator {
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
return item.flammability >= minFlammability && tile.entity.inventory.totalItems() < itemCapacity;
|
||||
return getItemEfficiency(item) >= minEfficiency && tile.entity.inventory.totalItems() < itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,7 +82,7 @@ public class BurnerGenerator extends PowerGenerator {
|
||||
for(int i = 0; i < entity.inventory.items.length; i ++){
|
||||
if(entity.inventory.items[i] > 0){
|
||||
entity.inventory.items[i] --;
|
||||
entity.efficiency = Item.getByID(i).flammability;
|
||||
entity.efficiency = getItemEfficiency(Item.getByID(i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -93,6 +93,10 @@ public class BurnerGenerator extends PowerGenerator {
|
||||
|
||||
}
|
||||
|
||||
protected float getItemEfficiency(Item item){
|
||||
return item.flammability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity() {
|
||||
return new BurnerEntity();
|
||||
|
@ -0,0 +1,15 @@
|
||||
package io.anuke.mindustry.world.blocks.types.power;
|
||||
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
|
||||
public class DecayGenerator extends BurnerGenerator {
|
||||
|
||||
public DecayGenerator(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getItemEfficiency(Item item) {
|
||||
return item.radioactivity;
|
||||
}
|
||||
}
|
@ -35,8 +35,9 @@ public class PowerDistributor extends PowerBlock{
|
||||
protected Translator t1 = new Translator();
|
||||
protected Translator t2 = new Translator();
|
||||
|
||||
public int laserRange = 6;
|
||||
public float powerSpeed = 0.5f;
|
||||
protected float laserRange = 6;
|
||||
protected float powerSpeed = 0.5f;
|
||||
protected int maxNodes = 3;
|
||||
|
||||
public PowerDistributor(String name){
|
||||
super(name);
|
||||
@ -79,12 +80,13 @@ public class PowerDistributor extends PowerBlock{
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tile tile, Tile other){
|
||||
DistributorEntity entity = tile.entity();
|
||||
other = other.target();
|
||||
|
||||
if(linkValid(tile, other)){
|
||||
if(linked(tile, other)){
|
||||
unlink(tile, other);
|
||||
}else{
|
||||
}else if(entity.links.size < maxNodes){
|
||||
link(tile, other);
|
||||
}
|
||||
return false;
|
||||
@ -106,6 +108,7 @@ public class PowerDistributor extends PowerBlock{
|
||||
|
||||
@Override
|
||||
public void drawConfigure(Tile tile){
|
||||
DistributorEntity entity = tile.entity();
|
||||
|
||||
Draw.color("accent");
|
||||
|
||||
@ -119,13 +122,14 @@ public class PowerDistributor extends PowerBlock{
|
||||
|
||||
Draw.color("power");
|
||||
|
||||
for(int x = tile.x - laserRange; x <= tile.x + laserRange; x ++){
|
||||
for(int y = tile.y - laserRange; y <= tile.y + laserRange; y ++){
|
||||
for(int x = (int)(tile.x - laserRange); x <= tile.x + laserRange; x ++){
|
||||
for(int y = (int)(tile.y - laserRange); y <= tile.y + laserRange; y ++){
|
||||
Tile link = world.tile(x, y);
|
||||
if(link != null) link = link.target();
|
||||
|
||||
if(link != tile && linkValid(tile, link)){
|
||||
if(linked(tile, link)){
|
||||
boolean linked = linked(tile, link);
|
||||
if(linked){
|
||||
Draw.color("place");
|
||||
}else{
|
||||
Draw.color(Color.SCARLET);
|
||||
@ -133,6 +137,11 @@ public class PowerDistributor extends PowerBlock{
|
||||
|
||||
Lines.square(link.drawx(), link.drawy(),
|
||||
link.block().size * tilesize / 2f + 1f + Mathf.absin(Timers.time(), 4f, 1f));
|
||||
|
||||
if(entity.links.size >= maxNodes && !linked){
|
||||
Draw.color();
|
||||
Draw.rect("cross-" + link.block().size, link.drawx(), link.drawy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,10 +264,13 @@ public class PowerDistributor extends PowerBlock{
|
||||
if(!(tile != link && link != null && link.block().hasPower)) return false;
|
||||
|
||||
if(link.block() instanceof PowerDistributor){
|
||||
return Vector2.dst(tile.worldx(), tile.worldy(), link.worldx(), link.worldy()) <= Math.max(laserRange * tilesize,
|
||||
((PowerDistributor)link.block()).laserRange * tilesize) - tilesize/2f;
|
||||
DistributorEntity oe = link.entity();
|
||||
|
||||
return Vector2.dst(tile.drawx(), tile.drawy(), link.worldx(), link.worldy()) <= Math.max(laserRange * tilesize,
|
||||
((PowerDistributor)link.block()).laserRange * tilesize) - tilesize/2f &&
|
||||
oe.links.size < ((PowerDistributor)link.block()).maxNodes;
|
||||
}else{
|
||||
return Vector2.dst(tile.worldx(), tile.worldy(), link.worldx(), link.worldy())
|
||||
return Vector2.dst(tile.drawx(), tile.drawy(), link.worldx(), link.worldy())
|
||||
<= laserRange * tilesize - tilesize/2f + (link.block().size-1)*tilesize;
|
||||
}
|
||||
}
|
||||
|