New metal floor / Selective floor attribute stats
This commit is contained in:
BIN
core/assets-raw/sprites/blocks/environment/metal-floor-4.png
Normal file
BIN
core/assets-raw/sprites/blocks/environment/metal-floor-4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 369 B |
@@ -677,6 +677,7 @@ unit.nobuild = [scarlet]Unit can't build
|
|||||||
lastaccessed = [lightgray]Last Accessed: {0}
|
lastaccessed = [lightgray]Last Accessed: {0}
|
||||||
block.unknown = [lightgray]???
|
block.unknown = [lightgray]???
|
||||||
|
|
||||||
|
stat.showinmap = <load map to show>
|
||||||
stat.description = Purpose
|
stat.description = Purpose
|
||||||
stat.input = Input
|
stat.input = Input
|
||||||
stat.output = Output
|
stat.output = Output
|
||||||
@@ -1163,8 +1164,9 @@ block.spore-cluster.name = Spore Cluster
|
|||||||
block.metal-floor.name = Metal Floor 1
|
block.metal-floor.name = Metal Floor 1
|
||||||
block.metal-floor-2.name = Metal Floor 2
|
block.metal-floor-2.name = Metal Floor 2
|
||||||
block.metal-floor-3.name = Metal Floor 3
|
block.metal-floor-3.name = Metal Floor 3
|
||||||
block.metal-floor-5.name = Metal Floor 4
|
block.metal-floor-4.name = Metal Floor 4
|
||||||
block.metal-floor-damaged.name = Metal Floor Damaged
|
block.metal-floor-5.name = Metal Floor 5
|
||||||
|
block.metal-floor-damaged.name = Damaged Metal Floor
|
||||||
block.dark-panel-1.name = Dark Panel 1
|
block.dark-panel-1.name = Dark Panel 1
|
||||||
block.dark-panel-2.name = Dark Panel 2
|
block.dark-panel-2.name = Dark Panel 2
|
||||||
block.dark-panel-3.name = Dark Panel 3
|
block.dark-panel-3.name = Dark Panel 3
|
||||||
|
|||||||
@@ -351,3 +351,4 @@
|
|||||||
63360=navanax|unit-navanax-ui
|
63360=navanax|unit-navanax-ui
|
||||||
63354=payload-launch-pad|block-payload-launch-pad-ui
|
63354=payload-launch-pad|block-payload-launch-pad-ui
|
||||||
63353=silicon-arc-furnace|block-silicon-arc-furnace-ui
|
63353=silicon-arc-furnace|block-silicon-arc-furnace-ui
|
||||||
|
63352=metal-floor-4|block-metal-floor-4-ui
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ public class BlockIndexer{
|
|||||||
private static final Rect rect = new Rect();
|
private static final Rect rect = new Rect();
|
||||||
private static boolean returnBool = false;
|
private static boolean returnBool = false;
|
||||||
|
|
||||||
private final IntSet intSet = new IntSet();
|
|
||||||
|
|
||||||
private int quadWidth, quadHeight;
|
private int quadWidth, quadHeight;
|
||||||
|
|
||||||
/** Stores all ore quadrants on the map. Maps ID to qX to qY to a list of tiles with that ore. */
|
/** Stores all ore quadrants on the map. Maps ID to qX to qY to a list of tiles with that ore. */
|
||||||
@@ -41,9 +39,9 @@ public class BlockIndexer{
|
|||||||
private Seq<Team> activeTeams = new Seq<>(Team.class);
|
private Seq<Team> activeTeams = new Seq<>(Team.class);
|
||||||
/** Maps teams to a map of flagged tiles by flag. */
|
/** Maps teams to a map of flagged tiles by flag. */
|
||||||
private TileArray[][] flagMap = new TileArray[Team.all.length][BlockFlag.all.length];
|
private TileArray[][] flagMap = new TileArray[Team.all.length][BlockFlag.all.length];
|
||||||
|
/** Counts whether a certain floor is present in the world upon load. */
|
||||||
|
private boolean[] blocksPresent;
|
||||||
|
|
||||||
/** Empty set used for returning. */
|
|
||||||
private TileArray emptySet = new TileArray();
|
|
||||||
/** Array used for returning and reusing. */
|
/** Array used for returning and reusing. */
|
||||||
private Seq<Tile> returnArray = new Seq<>();
|
private Seq<Tile> returnArray = new Seq<>();
|
||||||
/** Array used for returning and reusing. */
|
/** Array used for returning and reusing. */
|
||||||
@@ -74,6 +72,7 @@ public class BlockIndexer{
|
|||||||
ores = new IntSeq[content.items().size][][];
|
ores = new IntSeq[content.items().size][][];
|
||||||
quadWidth = Mathf.ceil(world.width() / (float)quadrantSize);
|
quadWidth = Mathf.ceil(world.width() / (float)quadrantSize);
|
||||||
quadHeight = Mathf.ceil(world.height() / (float)quadrantSize);
|
quadHeight = Mathf.ceil(world.height() / (float)quadrantSize);
|
||||||
|
blocksPresent = new boolean[content.blocks().size];
|
||||||
|
|
||||||
for(Tile tile : world.tiles){
|
for(Tile tile : world.tiles){
|
||||||
process(tile);
|
process(tile);
|
||||||
@@ -153,6 +152,12 @@ public class BlockIndexer{
|
|||||||
seq.removeValue(pos);
|
seq.removeValue(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return whether a certain block is anywhere on this map. */
|
||||||
|
public boolean isBlockPresent(Block block){
|
||||||
|
return blocksPresent != null && blocksPresent[block.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
private TileArray[] getFlagged(Team team){
|
private TileArray[] getFlagged(Team team){
|
||||||
@@ -383,6 +388,12 @@ public class BlockIndexer{
|
|||||||
}
|
}
|
||||||
data.buildings.insert(tile.build);
|
data.buildings.insert(tile.build);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!tile.block().isStatic()){
|
||||||
|
blocksPresent[tile.floorID()] = true;
|
||||||
|
blocksPresent[tile.overlayID()] = true;
|
||||||
|
}
|
||||||
|
blocksPresent[tile.blockID()] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileArray implements Iterable<Tile>{
|
public static class TileArray implements Iterable<Tile>{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class Blocks implements ContentList{
|
|||||||
dacite,
|
dacite,
|
||||||
stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
|
stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
|
||||||
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, grass, salt,
|
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, grass, salt,
|
||||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall,
|
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall,
|
||||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||||
pebbles, tendrils,
|
pebbles, tendrils,
|
||||||
|
|
||||||
@@ -410,32 +410,24 @@ public class Blocks implements ContentList{
|
|||||||
wall = sporeWall;
|
wall = sporeWall;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloor = new Floor("metal-floor"){{
|
metalFloor = new MetalFloor("metal-floor"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
|
attributes.set(Attribute.water, -1f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloorDamaged = new Floor("metal-floor-damaged"){{
|
metalFloorDamaged = new MetalFloor("metal-floor-damaged", 3);
|
||||||
variants = 3;
|
|
||||||
}};
|
|
||||||
|
|
||||||
metalFloor2 = new Floor("metal-floor-2"){{
|
metalFloor2 = new MetalFloor("metal-floor-2");
|
||||||
variants = 0;
|
metalFloor3 = new MetalFloor("metal-floor-3");
|
||||||
}};
|
metalFloor4 = new MetalFloor("metal-floor-4");
|
||||||
|
metalFloor5 = new MetalFloor("metal-floor-5");
|
||||||
|
|
||||||
metalFloor3 = new Floor("metal-floor-3"){{
|
darkPanel1 = new MetalFloor("dark-panel-1");
|
||||||
variants = 0;
|
darkPanel2 = new MetalFloor("dark-panel-2");
|
||||||
}};
|
darkPanel3 = new MetalFloor("dark-panel-3");
|
||||||
|
darkPanel4 = new MetalFloor("dark-panel-4");
|
||||||
metalFloor5 = new Floor("metal-floor-5"){{
|
darkPanel5 = new MetalFloor("dark-panel-5");
|
||||||
variants = 0;
|
darkPanel6 = new MetalFloor("dark-panel-6");
|
||||||
}};
|
|
||||||
|
|
||||||
darkPanel1 = new Floor("dark-panel-1"){{ variants = 0; }};
|
|
||||||
darkPanel2 = new Floor("dark-panel-2"){{ variants = 0; }};
|
|
||||||
darkPanel3 = new Floor("dark-panel-3"){{ variants = 0; }};
|
|
||||||
darkPanel4 = new Floor("dark-panel-4"){{ variants = 0; }};
|
|
||||||
darkPanel5 = new Floor("dark-panel-5"){{ variants = 0; }};
|
|
||||||
darkPanel6 = new Floor("dark-panel-6"){{ variants = 0; }};
|
|
||||||
|
|
||||||
darkMetal = new StaticWall("dark-metal");
|
darkMetal = new StaticWall("dark-metal");
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class ContentInfoDialog extends BaseDialog{
|
|||||||
for(Stat stat : map.keys()){
|
for(Stat stat : map.keys()){
|
||||||
table.table(inset -> {
|
table.table(inset -> {
|
||||||
inset.left();
|
inset.left();
|
||||||
inset.add("[lightgray]" + stat.localized() + ":[] ").left();
|
inset.add("[lightgray]" + stat.localized() + ":[] ").left().top();
|
||||||
Seq<StatValue> arr = map.get(stat);
|
Seq<StatValue> arr = map.get(stat);
|
||||||
for(StatValue value : arr){
|
for(StatValue value : arr){
|
||||||
value.display(inset);
|
value.display(inset);
|
||||||
|
|||||||
19
core/src/mindustry/world/blocks/environment/MetalFloor.java
Normal file
19
core/src/mindustry/world/blocks/environment/MetalFloor.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package mindustry.world.blocks.environment;
|
||||||
|
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
/** Class for quickly defining a floor with no water and no variants. Offers no new functionality. */
|
||||||
|
public class MetalFloor extends Floor{
|
||||||
|
|
||||||
|
public MetalFloor(String name){
|
||||||
|
super(name);
|
||||||
|
variants = 0;
|
||||||
|
attributes.set(Attribute.water, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MetalFloor(String name, int variants){
|
||||||
|
super(name);
|
||||||
|
this.variants = variants;
|
||||||
|
attributes.set(Attribute.water, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,10 +8,12 @@ import arc.scene.ui.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.maps.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
@@ -117,6 +119,51 @@ public class StatValues{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static StatValue floors(Attribute attr, boolean floating, float scale, boolean startZero){
|
||||||
|
return table -> table.table(c -> {
|
||||||
|
Runnable[] rebuild = {null};
|
||||||
|
Map[] lastMap = {null};
|
||||||
|
|
||||||
|
rebuild[0] = () -> {
|
||||||
|
c.clearChildren();
|
||||||
|
c.left();
|
||||||
|
|
||||||
|
if(state.isGame()){
|
||||||
|
var blocks = Vars.content.blocks()
|
||||||
|
.select(block -> block instanceof Floor f && indexer.isBlockPresent(block) && f.attributes.get(attr) != 0 && !(f.isLiquid && !floating))
|
||||||
|
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(attr)));
|
||||||
|
|
||||||
|
if(blocks.any()){
|
||||||
|
int i = 0;
|
||||||
|
for(var block : blocks){
|
||||||
|
|
||||||
|
floorEfficiency(block, block.attributes.get(attr) * scale, startZero).display(c);
|
||||||
|
if(++i % 5 == 0){
|
||||||
|
c.row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
c.add("@none.found");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
c.add("@stat.showinmap");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
rebuild[0].run();
|
||||||
|
|
||||||
|
//rebuild when map changes.
|
||||||
|
c.update(() -> {
|
||||||
|
Map current = state.isGame() ? state.map : null;
|
||||||
|
|
||||||
|
if(current != lastMap[0]){
|
||||||
|
rebuild[0].run();
|
||||||
|
lastMap[0] = current;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static StatValue blocks(Boolf<Block> pred){
|
public static StatValue blocks(Boolf<Block> pred){
|
||||||
return blocks(content.blocks().select(pred));
|
return blocks(content.blocks().select(pred));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package mindustry.world.meta;
|
|||||||
import arc.struct.ObjectMap.*;
|
import arc.struct.ObjectMap.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.*;
|
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.blocks.environment.*;
|
|
||||||
|
|
||||||
/** Hold and organizes a list of block stats. */
|
/** Hold and organizes a list of block stats. */
|
||||||
public class Stats{
|
public class Stats{
|
||||||
@@ -68,11 +66,7 @@ public class Stats{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void add(Stat stat, Attribute attr, boolean floating, float scale, boolean startZero){
|
public void add(Stat stat, Attribute attr, boolean floating, float scale, boolean startZero){
|
||||||
for(var block : Vars.content.blocks()
|
add(stat, StatValues.floors(attr, floating, scale, startZero));
|
||||||
.select(block -> block instanceof Floor f && f.attributes.get(attr) != 0 && !(f.isLiquid && !floating))
|
|
||||||
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(attr)))){
|
|
||||||
add(stat, StatValues.floorEfficiency(block, block.attributes.get(attr) * scale, startZero));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a single string value with this stat. */
|
/** Adds a single string value with this stat. */
|
||||||
|
|||||||
Reference in New Issue
Block a user