Removed WallOre class

This commit is contained in:
Anuken
2022-01-19 23:23:05 -05:00
parent 698e89e796
commit 9593765742
9 changed files with 18 additions and 36 deletions

View File

@@ -748,14 +748,19 @@ public class Blocks{
oreCrystalThorium = new OreBlock("ore-crystal-thorium", Items.thorium);
wallOreBeryl = new WallOreBlock(Items.beryllium);
wallOreBeryl = new OreBlock("ore-wall-beryllium", Items.beryllium){{
wallOre = true;
}};
graphiticWall = new StaticWall("graphitic-wall"){{
itemDrop = Items.graphite;
variants = 3;
}};
wallOreTungsten = new WallOreBlock(Items.tungsten);
//TODO merge with standard ore?
wallOreTungsten = new OreBlock("ore-wall-tungsten", Items.tungsten){{
wallOre = true;
}};
//endregion
//region crafting

View File

@@ -104,8 +104,8 @@ public class MapRenderer implements Disposable{
Tile tile = editor.tiles().getn(wx, wy);
Team team = tile.team();
Block floor = tile.floor();
Block overlay = tile.overlay();
Floor floor = tile.floor();
Floor overlay = tile.overlay();
Block wall = tile.block();
TextureRegion region;
@@ -113,7 +113,7 @@ public class MapRenderer implements Disposable{
int idxWall = (wx % chunkSize) + (wy % chunkSize) * chunkSize;
int idxDecal = (wx % chunkSize) + (wy % chunkSize) * chunkSize + chunkSize * chunkSize;
boolean center = tile.isCenter();
boolean useSyntheticWall = wall.synthetic() || overlay instanceof WallOreBlock;
boolean useSyntheticWall = wall.synthetic() || overlay.wallOre;
//draw synthetic wall or floor
if(wall != Blocks.air && useSyntheticWall){
@@ -148,7 +148,7 @@ public class MapRenderer implements Disposable{
offsetX = tilesize / 2f - region.width / 2f * Draw.scl;
offsetY = tilesize / 2f - region.height / 2f * Draw.scl;
}else if((wall == Blocks.air || overlay instanceof WallOreBlock) && !overlay.isAir()){
}else if((wall == Blocks.air || overlay.wallOre) && !overlay.isAir()){
region = overlay.editorVariantRegions()[Mathf.randomSeed(idxWall, 0, tile.overlay().editorVariantRegions().length - 1)];
}else{
region = clearEditor;

View File

@@ -41,7 +41,7 @@ public class MenuRenderer implements Disposable{
private void generate(){
world.beginMapLoad();
Tiles tiles = world.resize(width, height);
Seq<Block> ores = content.blocks().select(b -> b instanceof OreBlock && !(b instanceof WallOreBlock));
Seq<Block> ores = content.blocks().select(b -> b instanceof OreBlock ore && !ore.wallOre);
shadows = new FrameBuffer(width, height);
int offset = Mathf.random(100000);
int s1 = offset, s2 = offset + 1, s3 = offset + 2;

View File

@@ -177,7 +177,6 @@ public class ClassMap{
classes.put("StaticTree", mindustry.world.blocks.environment.StaticTree.class);
classes.put("StaticWall", mindustry.world.blocks.environment.StaticWall.class);
classes.put("TreeBlock", mindustry.world.blocks.environment.TreeBlock.class);
classes.put("WallOreBlock", mindustry.world.blocks.environment.WallOreBlock.class);
classes.put("WobbleProp", mindustry.world.blocks.environment.WobbleProp.class);
classes.put("BlockForge", mindustry.world.blocks.experimental.BlockForge.class);
classes.put("BlockForgeBuild", mindustry.world.blocks.experimental.BlockForge.BlockForgeBuild.class);

View File

@@ -529,7 +529,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
public @Nullable Item wallDrop(){
return block.solid ?
block.itemDrop != null ? block.itemDrop :
overlay instanceof WallOreBlock ? overlay.itemDrop :
overlay.wallOre ? overlay.itemDrop :
null : null;
}

View File

@@ -65,6 +65,8 @@ public class Floor extends Block{
public boolean canShadow = true;
/** Whether this overlay needs a surface to be on. False for floating blocks, like spawns. */
public boolean needsSurface = true;
/** If true, this ore is allowed on walls. */
public boolean wallOre = false;
protected TextureRegion[][] edges;
protected Seq<Block> blenders = new Seq<>();

View File

@@ -35,7 +35,7 @@ public class OreBlock extends OverlayFloor{
}
public void setup(Item ore){
this.localizedName = ore.localizedName;
this.localizedName = ore.localizedName + (wallOre ? " " + Core.bundle.get("wallore") : "");
this.itemDrop = ore;
this.mapColor.set(ore.color);
}

View File

@@ -36,8 +36,8 @@ public class StaticWall extends Prop{
}
//draw ore on top
if(tile.overlay() instanceof WallOreBlock ore){
ore.drawBase(tile);
if(tile.overlay().wallOre){
tile.overlay().drawBase(tile);
}
}

View File

@@ -1,24 +0,0 @@
package mindustry.world.blocks.environment;
import arc.*;
import mindustry.type.*;
/**An overlay ore that draws on top of walls. */
public class WallOreBlock extends OreBlock{
public WallOreBlock(Item ore){
super("ore-wall-" + ore.name, ore);
}
//mods only
public WallOreBlock(String name){
super(name);
}
@Override
public void init(){
super.init();
this.localizedName = this.localizedName + " " + Core.bundle.get("wallore");
}
}