Implemented #1093
This commit is contained in:
@@ -532,6 +532,8 @@ error.crashtitle = An error has occured
|
|||||||
blocks.input = Input
|
blocks.input = Input
|
||||||
blocks.output = Output
|
blocks.output = Output
|
||||||
blocks.booster = Booster
|
blocks.booster = Booster
|
||||||
|
blocks.tiles = Required Tiles
|
||||||
|
blocks.affinities = Affinities
|
||||||
block.unknown = [lightgray]???
|
block.unknown = [lightgray]???
|
||||||
blocks.powercapacity = Power Capacity
|
blocks.powercapacity = Power Capacity
|
||||||
blocks.powershot = Power/Shot
|
blocks.powershot = Power/Shot
|
||||||
|
|||||||
@@ -13,11 +13,19 @@ import static mindustry.Vars.renderer;
|
|||||||
|
|
||||||
public class ThermalGenerator extends PowerGenerator{
|
public class ThermalGenerator extends PowerGenerator{
|
||||||
public Effect generateEffect = Fx.none;
|
public Effect generateEffect = Fx.none;
|
||||||
|
public Attribute attribute = Attribute.heat;
|
||||||
|
|
||||||
public ThermalGenerator(String name){
|
public ThermalGenerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStats(){
|
||||||
|
super.setStats();
|
||||||
|
|
||||||
|
stats.add(BlockStat.tiles, attribute);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
GeneratorEntity entity = tile.ent();
|
GeneratorEntity entity = tile.ent();
|
||||||
@@ -29,7 +37,7 @@ public class ThermalGenerator extends PowerGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(Attribute.heat, x, y) * 100, 1), x, y, valid);
|
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(attribute, x, y) * 100, 1), x, y, valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,7 +51,7 @@ public class ThermalGenerator extends PowerGenerator{
|
|||||||
super.onProximityAdded(tile);
|
super.onProximityAdded(tile);
|
||||||
|
|
||||||
GeneratorEntity entity = tile.ent();
|
GeneratorEntity entity = tile.ent();
|
||||||
entity.productionEfficiency = sumAttribute(Attribute.heat, tile.x, tile.y);
|
entity.productionEfficiency = sumAttribute(attribute, tile.x, tile.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,6 +64,6 @@ public class ThermalGenerator extends PowerGenerator{
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlaceOn(Tile tile){
|
public boolean canPlaceOn(Tile tile){
|
||||||
//make sure there's heat at this location
|
//make sure there's heat at this location
|
||||||
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(Attribute.heat)) > 0.01f;
|
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > 0.01f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package mindustry.world.blocks.production;
|
package mindustry.world.blocks.production;
|
||||||
|
|
||||||
import arc.Core;
|
import arc.*;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.Mathf;
|
import arc.math.*;
|
||||||
import arc.math.Rand;
|
import arc.util.*;
|
||||||
import arc.util.Time;
|
import mindustry.content.*;
|
||||||
import mindustry.content.Fx;
|
import mindustry.entities.type.*;
|
||||||
import mindustry.entities.type.TileEntity;
|
import mindustry.graphics.*;
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.Bar;
|
import mindustry.world.*;
|
||||||
import mindustry.world.Tile;
|
import mindustry.world.meta.*;
|
||||||
import mindustry.world.meta.Attribute;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -57,6 +56,13 @@ public class Cultivator extends GenericCrafter{
|
|||||||
() -> ((CultivatorEntity)entity).warmup));
|
() -> ((CultivatorEntity)entity).warmup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStats(){
|
||||||
|
super.setStats();
|
||||||
|
|
||||||
|
stats.add(BlockStat.affinities, attribute);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", (1 + sumAttribute(attribute, x, y)) * 100, 1), x, y, valid);
|
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", (1 + sumAttribute(attribute, x, y)) * 100, 1), x, y, valid);
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class SolidPump extends Pump{
|
|||||||
|
|
||||||
stats.remove(BlockStat.output);
|
stats.remove(BlockStat.output);
|
||||||
stats.add(BlockStat.output, result, 60f * pumpAmount, true);
|
stats.add(BlockStat.output, result, 60f * pumpAmount, true);
|
||||||
|
stats.add(BlockStat.affinities, attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public enum BlockStat{
|
|||||||
powerConnections(StatCategory.power),
|
powerConnections(StatCategory.power),
|
||||||
basePowerGeneration(StatCategory.power),
|
basePowerGeneration(StatCategory.power),
|
||||||
|
|
||||||
|
tiles(StatCategory.crafting),
|
||||||
input(StatCategory.crafting),
|
input(StatCategory.crafting),
|
||||||
output(StatCategory.crafting),
|
output(StatCategory.crafting),
|
||||||
productionTime(StatCategory.crafting),
|
productionTime(StatCategory.crafting),
|
||||||
@@ -45,7 +46,8 @@ public enum BlockStat{
|
|||||||
ammo(StatCategory.shooting),
|
ammo(StatCategory.shooting),
|
||||||
|
|
||||||
booster(StatCategory.optional),
|
booster(StatCategory.optional),
|
||||||
boostEffect(StatCategory.optional);
|
boostEffect(StatCategory.optional),
|
||||||
|
affinities(StatCategory.optional);
|
||||||
|
|
||||||
public final StatCategory category;
|
public final StatCategory category;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package mindustry.world.meta;
|
package mindustry.world.meta;
|
||||||
|
|
||||||
import arc.struct.Array;
|
import arc.math.*;
|
||||||
import arc.struct.ObjectMap.Entry;
|
import arc.struct.*;
|
||||||
import arc.struct.OrderedMap;
|
import arc.struct.ObjectMap.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.*;
|
||||||
import mindustry.world.meta.values.*;
|
import mindustry.world.meta.values.*;
|
||||||
|
|
||||||
/** Hold and organizes a list of block stats. */
|
/** Hold and organizes a list of block stats. */
|
||||||
@@ -36,6 +38,13 @@ public class BlockStats{
|
|||||||
add(stat, new LiquidValue(liquid, amount, perSecond));
|
add(stat, new LiquidValue(liquid, amount, perSecond));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(BlockStat stat, Attribute attr){
|
||||||
|
for(Block block : Vars.content.blocks()){
|
||||||
|
if(!block.isFloor() || Mathf.zero(block.asFloor().attributes.get(attr))) continue;
|
||||||
|
add(stat, new FloorValue(block.asFloor()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Adds a single string value with this stat. */
|
/** Adds a single string value with this stat. */
|
||||||
public void add(BlockStat stat, String format, Object... args){
|
public void add(BlockStat stat, String format, Object... args){
|
||||||
add(stat, new StringValue(format, args));
|
add(stat, new StringValue(format, args));
|
||||||
|
|||||||
21
core/src/mindustry/world/meta/values/FloorValue.java
Normal file
21
core/src/mindustry/world/meta/values/FloorValue.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package mindustry.world.meta.values;
|
||||||
|
|
||||||
|
import arc.scene.ui.*;
|
||||||
|
import arc.scene.ui.layout.*;
|
||||||
|
import mindustry.ui.*;
|
||||||
|
import mindustry.world.blocks.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
public class FloorValue implements StatValue{
|
||||||
|
private final Floor floor;
|
||||||
|
|
||||||
|
public FloorValue(Floor floor){
|
||||||
|
this.floor = floor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Table table){
|
||||||
|
table.add(new Image(floor.icon(Cicon.small))).padRight(3);
|
||||||
|
table.add(floor.localizedName).padRight(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user