Dacite decoration block / Environmental renaming

This commit is contained in:
Anuken
2020-09-10 15:17:10 -04:00
parent 88e3022db0
commit 74cefb3ec9
95 changed files with 10486 additions and 10175 deletions

View File

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

View File

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

View File

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

View File

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 414 B

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

View File

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

@@ -916,21 +916,21 @@ block.sand-boulder.name = Sand Boulder
block.grass.name = Grass block.grass.name = Grass
block.slag.name = Slag block.slag.name = Slag
block.salt.name = Salt block.salt.name = Salt
block.saltrocks.name = Salt Rocks block.salt-wall.name = Salt Wall
block.pebbles.name = Pebbles block.pebbles.name = Pebbles
block.tendrils.name = Tendrils block.tendrils.name = Tendrils
block.sandrocks.name = Sand Rocks block.sand-wall.name = Sand Wall
block.spore-pine.name = Spore Pine block.spore-pine.name = Spore Pine
block.sporerocks.name = Spore Rocks block.spore-wall.name = Spore Wall
block.rock.name = Rock block.boulder.name = Boulder
block.snowrock.name = Snow Rock block.snow-boulder.name = Snow Boulder
block.snow-pine.name = Snow Pine block.snow-pine.name = Snow Pine
block.shale.name = Shale block.shale.name = Shale
block.shale-boulder.name = Shale Boulder block.shale-boulder.name = Shale Boulder
block.moss.name = Moss block.moss.name = Moss
block.shrubs.name = Shrubs block.shrubs.name = Shrubs
block.spore-moss.name = Spore Moss block.spore-moss.name = Spore Moss
block.shalerocks.name = Shale Rocks block.shale-wall.name = Shale Wall
block.scrap-wall.name = Scrap Wall block.scrap-wall.name = Scrap Wall
block.scrap-wall-large.name = Large Scrap Wall block.scrap-wall-large.name = Large Scrap Wall
block.scrap-wall-huge.name = Huge Scrap Wall block.scrap-wall-huge.name = Huge Scrap Wall
@@ -958,13 +958,16 @@ block.craters.name = Craters
block.sand-water.name = Sand water block.sand-water.name = Sand water
block.darksand-water.name = Dark Sand Water block.darksand-water.name = Dark Sand Water
block.char.name = Char block.char.name = Char
block.holostone.name = Holo stone block.dacite.name = Dacite
block.dacite-wall.name = Dacite Wall
block.ice-snow.name = Ice Snow block.ice-snow.name = Ice Snow
block.rocks.name = Rocks block.stone-wall.name = Stone Wall
block.icerocks.name = Ice rocks block.ice-wall.name = Ice Wall
block.snowrocks.name = Snow Rocks block.snow-wall.name = Snow Wall
block.dunerocks.name = Dune Rocks block.dune-wall.name = Dune Wall
block.pine.name = Pine block.pine.name = Pine
block.dirt.name = Dirt
block.dirt-wall.name = Dirt Wall
block.white-tree-dead.name = White Tree Dead block.white-tree-dead.name = White Tree Dead
block.white-tree.name = White Tree block.white-tree.name = White Tree
block.spore-cluster.name = Spore Cluster block.spore-cluster.name = Spore Cluster
@@ -980,7 +983,7 @@ block.dark-panel-4.name = Dark Panel 4
block.dark-panel-5.name = Dark Panel 5 block.dark-panel-5.name = Dark Panel 5
block.dark-panel-6.name = Dark Panel 6 block.dark-panel-6.name = Dark Panel 6
block.dark-metal.name = Dark Metal block.dark-metal.name = Dark Metal
block.ignarock.name = Igna Rock block.basalt.name = Basalt
block.hotrock.name = Hot Rock block.hotrock.name = Hot Rock
block.magmarock.name = Magma Rock block.magmarock.name = Magma Rock
block.cliffs.name = Cliffs block.cliffs.name = Cliffs

View File

@@ -303,3 +303,10 @@
63441=salt-wall|block-salt-wall-medium 63441=salt-wall|block-salt-wall-medium
63440=shale-wall|block-shale-wall-medium 63440=shale-wall|block-shale-wall-medium
63439=dirt-wall|block-dirt-wall-medium 63439=dirt-wall|block-dirt-wall-medium
63438=holostone-wall|block-holostone-wall-medium
63437=basalt|block-basalt-medium
63436=dacite|block-dacite-medium
63435=boulder|block-boulder-medium
63434=snow-boulder|block-snow-boulder-medium
63433=dacite-wall|block-dacite-wall-medium
63432=dacite-boulder|block-dacite-boulder-medium

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 811 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 KiB

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 KiB

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -255,15 +255,15 @@ public class BlockIndexer{
if(e == null) continue; if(e == null) continue;
if(e.team != team || !pred.get(e) || !e.block().targetable) if(e.team != team || !pred.get(e) || !e.block.targetable)
continue; continue;
float ndst = e.dst2(x, y); float ndst = e.dst2(x, y);
if(ndst < range2 && (closest == null || if(ndst < range2 && (closest == null ||
//this one is closer, and it is at least of equal priority //this one is closer, and it is at least of equal priority
(ndst < dst && (!usePriority || closest.block().priority.ordinal() <= e.block().priority.ordinal())) || (ndst < dst && (!usePriority || closest.block.priority.ordinal() <= e.block.priority.ordinal())) ||
//priority is used, and new block has higher priority regardless of range //priority is used, and new block has higher priority regardless of range
(usePriority && closest.block().priority.ordinal() < e.block().priority.ordinal()))){ (usePriority && closest.block.priority.ordinal() < e.block.priority.ordinal()))){
dst = ndst; dst = ndst;
closest = e; closest = e;
} }

View File

@@ -93,7 +93,7 @@ public class WaveSpawner{
if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam) && !state.teams.playerCores().isEmpty()){ if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam) && !state.teams.playerCores().isEmpty()){
Building firstCore = state.teams.playerCores().first(); Building firstCore = state.teams.playerCores().first();
for(Building core : state.rules.waveTeam.cores()){ for(Building core : state.rules.waveTeam.cores()){
Tmp.v1.set(firstCore).sub(core).limit(coreMargin + core.block().size * tilesize /2f * Mathf.sqrt2); Tmp.v1.set(firstCore).sub(core).limit(coreMargin + core.block.size * tilesize /2f * Mathf.sqrt2);
boolean valid = false; boolean valid = false;
int steps = 0; int steps = 0;

View File

@@ -29,7 +29,7 @@ public class SuicideAI extends GroundAI{
if(!Units.invalidateTarget(target, unit, unit.range())){ if(!Units.invalidateTarget(target, unit, unit.range())){
rotate = true; rotate = true;
shoot = unit.within(target, unit.type().weapons.first().bullet.range() + shoot = unit.within(target, unit.type().weapons.first().bullet.range() +
(target instanceof Building ? ((Building)target).block().size * Vars.tilesize / 2f : ((Hitboxc)target).hitSize() / 2f)); (target instanceof Building ? ((Building)target).block.size * Vars.tilesize / 2f : ((Hitboxc)target).hitSize() / 2f));
if(unit.type().hasWeapons()){ if(unit.type().hasWeapons()){
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed)); unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));

View File

@@ -35,9 +35,9 @@ public class Blocks implements ContentList{
//environment //environment
air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, ice, snow, darksandTaintedWater, air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, ice, snow, darksandTaintedWater,
holostone, stoneWall, dirtWall, sporeWall, iceWall, cliffs, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster, dacite, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, cliffs, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, grass, salt, iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowWall, rock, snowrock, saltWall, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, basalt, magmarock, hotrock, snowWall, boulder, snowBoulder, saltWall,
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
pebbles, tendrils, pebbles, tendrils,
@@ -221,14 +221,14 @@ public class Blocks implements ContentList{
blendGroup = stone; blendGroup = stone;
}}; }};
ignarock = new Floor("ignarock"){{ basalt = new Floor("basalt"){{
attributes.set(Attribute.water, -0.25f); attributes.set(Attribute.water, -0.25f);
}}; }};
hotrock = new Floor("hotrock"){{ hotrock = new Floor("hotrock"){{
attributes.set(Attribute.heat, 0.5f); attributes.set(Attribute.heat, 0.5f);
attributes.set(Attribute.water, -0.5f); attributes.set(Attribute.water, -0.5f);
blendGroup = ignarock; blendGroup = basalt;
emitLight = true; emitLight = true;
lightRadius = 30f; lightRadius = 30f;
@@ -239,7 +239,7 @@ public class Blocks implements ContentList{
attributes.set(Attribute.heat, 0.75f); attributes.set(Attribute.heat, 0.75f);
attributes.set(Attribute.water, -0.75f); attributes.set(Attribute.water, -0.75f);
updateEffect = Fx.magmasmoke; updateEffect = Fx.magmasmoke;
blendGroup = ignarock; blendGroup = basalt;
emitLight = true; emitLight = true;
lightRadius = 60f; lightRadius = 60f;
@@ -264,7 +264,7 @@ public class Blocks implements ContentList{
((ShallowLiquid)sandWater).set(Blocks.water, Blocks.sand); ((ShallowLiquid)sandWater).set(Blocks.water, Blocks.sand);
((ShallowLiquid)darksandWater).set(Blocks.water, Blocks.darksand); ((ShallowLiquid)darksandWater).set(Blocks.water, Blocks.darksand);
holostone = new Floor("holostone"); dacite = new Floor("dacite");
grass = new Floor("grass"){{ grass = new Floor("grass"){{
attributes.set(Attribute.water, 0.1f); attributes.set(Attribute.water, 0.1f);
@@ -305,11 +305,11 @@ public class Blocks implements ContentList{
variants = 2; variants = 2;
}}; }};
rock = new Rock("rock"){{ boulder = new Boulder("boulder"){{
variants = 2; variants = 2;
}}; }};
snowrock = new Rock("snowrock"){{ snowBoulder = new Boulder("snow-boulder"){{
variants = 2; variants = 2;
}}; }};
@@ -317,6 +317,10 @@ public class Blocks implements ContentList{
variants = 2; variants = 2;
}}; }};
daciteWall = new StaticWall("dacite-wall"){{
variants = 2;
}};
iceWall = new StaticWall("ice-wall"){{ iceWall = new StaticWall("ice-wall"){{
variants = 2; variants = 2;
iceSnow.asFloor().wall = this; iceSnow.asFloor().wall = this;
@@ -328,7 +332,7 @@ public class Blocks implements ContentList{
duneWall = new StaticWall("dune-wall"){{ duneWall = new StaticWall("dune-wall"){{
variants = 2; variants = 2;
ignarock.asFloor().wall = this; basalt.asFloor().wall = this;
}}; }};
sandWall = new StaticWall("sand-wall"){{ sandWall = new StaticWall("sand-wall"){{
@@ -355,7 +359,7 @@ public class Blocks implements ContentList{
whiteTree = new TreeBlock("white-tree"); whiteTree = new TreeBlock("white-tree");
sporeCluster = new Rock("spore-cluster"){{ sporeCluster = new Boulder("spore-cluster"){{
variants = 3; variants = 3;
}}; }};
@@ -368,11 +372,15 @@ public class Blocks implements ContentList{
variants = 2; variants = 2;
}}; }};
shaleBoulder = new Rock("shale-boulder"){{ shaleBoulder = new Boulder("shale-boulder"){{
variants = 2; variants = 2;
}}; }};
sandBoulder = new Rock("sand-boulder"){{ sandBoulder = new Boulder("sand-boulder"){{
variants = 2;
}};
daciteBoulder = new Boulder("dacite-boulder"){{
variants = 2; variants = 2;
}}; }};
@@ -513,7 +521,7 @@ public class Blocks implements ContentList{
itemCapacity = 30; itemCapacity = 30;
boostScale = 0.15f; boostScale = 0.15f;
consumes.items(new ItemStack(Items.coal, 3), new ItemStack(Items.sand, 6), new ItemStack(Items.pyratite, 1)); consumes.items(new ItemStack(Items.coal, 4), new ItemStack(Items.sand, 6), new ItemStack(Items.pyratite, 1));
consumes.power(4f); consumes.power(4f);
}}; }};

View File

@@ -182,7 +182,7 @@ public class Control implements ApplicationListener, Loadable{
app.post(() -> ui.hudfrag.showLand()); app.post(() -> ui.hudfrag.showLand());
renderer.zoomIn(Fx.coreLand.lifetime); renderer.zoomIn(Fx.coreLand.lifetime);
app.post(() -> Fx.coreLand.at(core.getX(), core.getY(), 0, core.block())); app.post(() -> Fx.coreLand.at(core.getX(), core.getY(), 0, core.block));
Time.run(Fx.coreLand.lifetime, () -> { Time.run(Fx.coreLand.lifetime, () -> {
Fx.launch.at(core); Fx.launch.at(core);
Effect.shake(5f, 5f, core); Effect.shake(5f, 5f, core);

View File

@@ -809,7 +809,7 @@ public class NetServer implements ApplicationListener{
short sent = 0; short sent = 0;
for(Building entity : Groups.build){ for(Building entity : Groups.build){
if(!entity.block().sync) continue; if(!entity.block.sync) continue;
sent ++; sent ++;
dataStream.writeInt(entity.pos()); dataStream.writeInt(entity.pos());
@@ -838,7 +838,7 @@ public class NetServer implements ApplicationListener{
dataStream.writeByte(cores.size); dataStream.writeByte(cores.size);
for(CoreBuild entity : cores){ for(CoreBuild entity : cores){
dataStream.writeInt(entity.tile().pos()); dataStream.writeInt(entity.tile.pos());
entity.items.write(Writes.get(dataStream)); entity.items.write(Writes.get(dataStream));
} }

View File

@@ -271,7 +271,7 @@ public class Renderer implements ApplicationListener{
float fract = landTime / Fx.coreLand.lifetime; float fract = landTime / Fx.coreLand.lifetime;
Building entity = player.closestCore(); Building entity = player.closestCore();
TextureRegion reg = entity.block().icon(Cicon.full); TextureRegion reg = entity.block.icon(Cicon.full);
float scl = Scl.scl(4f) / camerascale; float scl = Scl.scl(4f) / camerascale;
float s = reg.getWidth() * Draw.scl * scl * 4f * fract; float s = reg.getWidth() * Draw.scl * scl * 4f * fract;

View File

@@ -105,7 +105,9 @@ public class World{
public Tile tileBuilding(int x, int y){ public Tile tileBuilding(int x, int y){
Tile tile = tiles.get(x, y); Tile tile = tiles.get(x, y);
if(tile == null) return null; if(tile == null) return null;
if(tile.build != null) return tile.build.tile(); if(tile.build != null){
return tile.build.tile();
}
return tile; return tile;
} }

View File

@@ -1,6 +1,7 @@
package mindustry.editor; package mindustry.editor;
import arc.func.*; import arc.func.*;
import arc.input.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
@@ -10,8 +11,8 @@ import mindustry.game.*;
import mindustry.world.*; import mindustry.world.*;
public enum EditorTool{ public enum EditorTool{
zoom, zoom(KeyCode.v),
pick{ pick(KeyCode.i){
public void touched(MapEditor editor, int x, int y){ public void touched(MapEditor editor, int x, int y){
if(!Structs.inBounds(x, y, editor.width(), editor.height())) return; if(!Structs.inBounds(x, y, editor.width(), editor.height())) return;
@@ -19,7 +20,7 @@ public enum EditorTool{
editor.drawBlock = tile.block() == Blocks.air ? tile.overlay() == Blocks.air ? tile.floor() : tile.overlay() : tile.block(); editor.drawBlock = tile.block() == Blocks.air ? tile.overlay() == Blocks.air ? tile.floor() : tile.overlay() : tile.block();
} }
}, },
line("replace", "orthogonal"){ line(KeyCode.l, "replace", "orthogonal"){
@Override @Override
public void touchedLine(MapEditor editor, int x1, int y1, int x2, int y2){ public void touchedLine(MapEditor editor, int x1, int y1, int x2, int y2){
@@ -43,7 +44,7 @@ public enum EditorTool{
}); });
} }
}, },
pencil("replace", "square", "drawteams"){ pencil(KeyCode.b, "replace", "square", "drawteams"){
{ {
edit = true; edit = true;
draggable = true; draggable = true;
@@ -67,7 +68,7 @@ public enum EditorTool{
} }
}, },
eraser("eraseores"){ eraser(KeyCode.e, "eraseores"){
{ {
edit = true; edit = true;
draggable = true; draggable = true;
@@ -86,7 +87,7 @@ public enum EditorTool{
}); });
} }
}, },
fill("replaceall", "fillteams"){ fill(KeyCode.g, "replaceall", "fillteams"){
{ {
edit = true; edit = true;
} }
@@ -205,7 +206,7 @@ public enum EditorTool{
} }
} }
}, },
spray("replace"){ spray(KeyCode.r, "replace"){
final double chance = 0.012; final double chance = 0.012;
{ {
@@ -231,8 +232,12 @@ public enum EditorTool{
} }
}; };
public static final EditorTool[] all = values();
/** All the internal alternate placement modes of this tool. */ /** All the internal alternate placement modes of this tool. */
public final String[] altModes; public final String[] altModes;
/** Key to activate this tool. */
public KeyCode key = KeyCode.unset;
/** The current alternate placement mode. -1 is the standard mode, no changes.*/ /** The current alternate placement mode. -1 is the standard mode, no changes.*/
public int mode = -1; public int mode = -1;
/** Whether this tool causes canvas changes when touched.*/ /** Whether this tool causes canvas changes when touched.*/
@@ -244,10 +249,20 @@ public enum EditorTool{
this(new String[]{}); this(new String[]{});
} }
EditorTool(KeyCode code){
this(new String[]{});
this.key = code;
}
EditorTool(String... altModes){ EditorTool(String... altModes){
this.altModes = altModes; this.altModes = altModes;
} }
EditorTool(KeyCode code, String... altModes){
this.altModes = altModes;
this.key = code;
}
public void touched(MapEditor editor, int x, int y){} public void touched(MapEditor editor, int x, int y){}
public void touchedLine(MapEditor editor, int x1, int y1, int x2, int y2){} public void touchedLine(MapEditor editor, int x1, int y1, int x2, int y2){}

View File

@@ -576,22 +576,20 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(Core.input.ctrl()){ if(Core.input.ctrl()){
//alt mode select //alt mode select
for(int i = 0; i < view.getTool().altModes.length + 1; i++){ for(int i = 0; i < view.getTool().altModes.length; i++){
if(Core.input.keyTap(KeyCode.valueOf("num" + (i + 1)))){ if(i + 1 < KeyCode.numbers.length && Core.input.keyTap(KeyCode.numbers[i + 1])){
view.getTool().mode = i - 1; view.getTool().mode = i;
} }
} }
}else{ }else{
//tool select for(EditorTool tool : EditorTool.all){
for(int i = 0; i < EditorTool.values().length; i++){ if(Core.input.keyTap(tool.key)){
if(Core.input.keyTap(KeyCode.valueOf("num" + (i + 1)))){ view.setTool(tool);
view.setTool(EditorTool.values()[i]);
break; break;
} }
} }
} }
if(Core.input.keyTap(KeyCode.escape)){ if(Core.input.keyTap(KeyCode.escape)){
if(!menu.isShown()){ if(!menu.isShown()){
menu.show(); menu.show();
@@ -619,7 +617,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(int x = 0; x < editor.width(); x++){ for(int x = 0; x < editor.width(); x++){
for(int y = 0; y < editor.height(); y++){ for(int y = 0; y < editor.height(); y++){
Tile tile = editor.tile(x, y); Tile tile = editor.tile(x, y);
if(tile.block().breakable && tile.block() instanceof Rock){ if(tile.block().breakable && tile.block() instanceof Boulder){
tile.setBlock(Blocks.air); tile.setBlock(Blocks.air);
editor.renderer().updatePoint(x, y); editor.renderer().updatePoint(x, y);
} }

View File

@@ -46,8 +46,8 @@ public class HealBulletType extends BulletType{
public void hitTile(Bullet b, Building tile){ public void hitTile(Bullet b, Building tile){
super.hit(b); super.hit(b);
if(tile.team == b.team && !(tile.block() instanceof ConstructBlock)){ if(tile.team == b.team && !(tile.block instanceof ConstructBlock)){
Fx.healBlockFull.at(tile.x, tile.y, tile.block().size, Pal.heal); Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
tile.heal(healPercent / 100f * tile.maxHealth()); tile.heal(healPercent / 100f * tile.maxHealth());
} }
} }

View File

@@ -18,9 +18,9 @@ abstract class BlockUnitComp implements Unitc{
this.tile = tile; this.tile = tile;
//sets up block stats //sets up block stats
maxHealth(tile.block().health); maxHealth(tile.block.health);
health(tile.health()); health(tile.health());
hitSize(tile.block().size * tilesize * 0.7f); hitSize(tile.block.size * tilesize * 0.7f);
set(tile); set(tile);
} }

View File

@@ -829,7 +829,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, base()) && !PowerNode.insulated(other, base()) if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, base()) && !PowerNode.insulated(other, base())
&& !other.proximity().contains(this.<Building>base()) && && !other.proximity().contains(this.<Building>base()) &&
!(block.outputsPower && proximity.contains(p -> p.power != null && p.power.graph == other.power.graph))){ !(block.outputsPower && proximity.contains(p -> p.power != null && p.power.graph == other.power.graph))){
tempTiles.add(other.tile()); tempTiles.add(other.tile);
} }
}); });
tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile))); tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile)));

View File

@@ -112,9 +112,9 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
/** @return whether the tile has been successfully placed. */ /** @return whether the tile has been successfully placed. */
boolean dropBlock(BlockPayload payload){ boolean dropBlock(BlockPayload payload){
Building tile = payload.entity; Building tile = payload.entity;
int tx = Vars.world.toTile(x - tile.block().offset), ty = Vars.world.toTile(y - tile.block().offset); int tx = Vars.world.toTile(x - tile.block.offset), ty = Vars.world.toTile(y - tile.block.offset);
Tile on = Vars.world.tile(tx, ty); Tile on = Vars.world.tile(tx, ty);
if(on != null && Build.validPlace(tile.block(), tile.team, tx, ty, tile.rotation)){ if(on != null && Build.validPlace(tile.block, tile.team, tx, ty, tile.rotation)){
int rot = (int)((rotation + 45f) / 90f) % 4; int rot = (int)((rotation + 45f) / 90f) % 4;
payload.place(on, rot); payload.place(on, rot);

View File

@@ -347,9 +347,9 @@ public class Schematics implements Loadable{
for(int cy = y; cy <= y2; cy++){ for(int cy = y; cy <= y2; cy++){
Building linked = world.build(cx, cy); Building linked = world.build(cx, cy);
if(linked != null &&linked.block().isVisible() && !(linked.block() instanceof ConstructBlock)){ if(linked != null && linked.block.isVisible() && !(linked.block instanceof ConstructBlock)){
int top = linked.block().size/2; int top = linked.block.size/2;
int bot = linked.block().size % 2 == 1 ? -linked.block().size/2 : -(linked.block().size - 1)/2; int bot = linked.block.size % 2 == 1 ? -linked.block.size/2 : -(linked.block.size - 1)/2;
minx = Math.min(linked.tileX() + bot, minx); minx = Math.min(linked.tileX() + bot, minx);
miny = Math.min(linked.tileY() + bot, miny); miny = Math.min(linked.tileY() + bot, miny);
maxx = Math.max(linked.tileX() + top, maxx); maxx = Math.max(linked.tileX() + top, maxx);
@@ -375,11 +375,11 @@ public class Schematics implements Loadable{
for(int cy = oy; cy <= oy2; cy++){ for(int cy = oy; cy <= oy2; cy++){
Building tile = world.build(cx, cy); Building tile = world.build(cx, cy);
if(tile != null && !counted.contains(tile.pos()) && !(tile.block() instanceof ConstructBlock) if(tile != null && !counted.contains(tile.pos()) && !(tile.block instanceof ConstructBlock)
&& (tile.block().isVisible() || (tile.block() instanceof CoreBlock))){ && (tile.block.isVisible() || (tile.block instanceof CoreBlock))){
Object config = tile.config(); Object config = tile.config();
tiles.add(new Stile(tile.block(), tile.tileX() + offsetX, tile.tileY() + offsetY, config, (byte)tile.rotation)); tiles.add(new Stile(tile.block, tile.tileX() + offsetX, tile.tileY() + offsetY, config, (byte)tile.rotation));
counted.add(tile.pos()); counted.add(tile.pos());
} }
} }

View File

@@ -250,7 +250,7 @@ public class Tutorial{
Building core = state.teams.playerCores().first(); Building core = state.teams.playerCores().first();
for(int i = 0; i < blocksToBreak; i++){ for(int i = 0; i < blocksToBreak; i++){
if(world.tile(core.tile().x + blockOffset, core.tile().y + i).block() == Blocks.scrapWall){ if(world.tile(core.tile.x + blockOffset, core.tile.y + i).block() == Blocks.scrapWall){
return false; return false;
} }
} }

View File

@@ -192,7 +192,9 @@ public class BlockRenderer implements Disposable{
Tile tile = world.rawTile(x, y); Tile tile = world.rawTile(x, y);
Block block = tile.block(); Block block = tile.block();
//link to center //link to center
if(tile.build != null) tile = tile.build.tile(); if(tile.build != null){
tile = tile.build.tile;
}
if(block != Blocks.air && block.cacheLayer == CacheLayer.normal && (tile.build == null || !processedEntities.contains(tile.build.id()))){ if(block != Blocks.air && block.cacheLayer == CacheLayer.normal && (tile.build == null || !processedEntities.contains(tile.build.id()))){
if(block.expanded || !expanded){ if(block.expanded || !expanded){
@@ -207,8 +209,8 @@ public class BlockRenderer implements Disposable{
if(tile.build != null && tile.build.power != null && tile.build.power.links.size > 0){ if(tile.build != null && tile.build.power != null && tile.build.power.links.size > 0){
for(Building other : tile.build.getPowerConnections(outArray2)){ for(Building other : tile.build.getPowerConnections(outArray2)){
if(other.block() instanceof PowerNode){ //TODO need a generic way to render connections! if(other.block instanceof PowerNode){ //TODO need a generic way to render connections!
tileview.add(other.tile()); tileview.add(other.tile);
} }
} }
} }

View File

@@ -187,7 +187,7 @@ public class Drawf{
Draw.color(Pal.accent); Draw.color(Pal.accent);
Draw.alpha(speed); Draw.alpha(speed);
Lines.lineAngleCenter(t.x + Mathf.sin(time, 20f, Vars.tilesize / 2f * t.block().size - 2f), t.y, 90, t.block().size * Vars.tilesize - 4f); Lines.lineAngleCenter(t.x + Mathf.sin(time, 20f, Vars.tilesize / 2f * t.block.size - 2f), t.y, 90, t.block.size * Vars.tilesize - 4f);
Draw.reset(); Draw.reset();
} }

View File

@@ -59,8 +59,8 @@ public class MenuRenderer implements Disposable{
new Block[]{Blocks.moss, Blocks.sporePine} new Block[]{Blocks.moss, Blocks.sporePine}
); );
Block[] selected2 = Structs.select( Block[] selected2 = Structs.select(
new Block[]{Blocks.ignarock, Blocks.duneWall}, new Block[]{Blocks.basalt, Blocks.duneWall},
new Block[]{Blocks.ignarock, Blocks.duneWall}, new Block[]{Blocks.basalt, Blocks.duneWall},
new Block[]{Blocks.stone, Blocks.stoneWall}, new Block[]{Blocks.stone, Blocks.stoneWall},
new Block[]{Blocks.stone, Blocks.stoneWall}, new Block[]{Blocks.stone, Blocks.stoneWall},
new Block[]{Blocks.moss, Blocks.sporeWall}, new Block[]{Blocks.moss, Blocks.sporeWall},
@@ -113,7 +113,7 @@ public class MenuRenderer implements Disposable{
if(heat > base){ if(heat > base){
ore = Blocks.air; ore = Blocks.air;
wall = Blocks.air; wall = Blocks.air;
floor = Blocks.ignarock; floor = Blocks.basalt;
if(heat > base + 0.1){ if(heat > base + 0.1){
floor = Blocks.hotrock; floor = Blocks.hotrock;

View File

@@ -82,7 +82,7 @@ public class OverlayRenderer{
if(select instanceof BlockUnitc){ if(select instanceof BlockUnitc){
//special selection for block "units" //special selection for block "units"
Fill.square(select.x, select.y, ((BlockUnitc)select).tile().block().size * tilesize/2f); Fill.square(select.x, select.y, ((BlockUnitc)select).tile().block.size * tilesize/2f);
}else{ }else{
Draw.rect(select.type().icon(Cicon.full), select.x(), select.y(), select.rotation() - 90); Draw.rect(select.type().icon(Cicon.full), select.x(), select.y(), select.rotation() - 90);
} }
@@ -140,10 +140,10 @@ public class OverlayRenderer{
build.drawDisabled(); build.drawDisabled();
} }
if(Core.input.keyDown(Binding.rotateplaced) && build.block().rotate && build.interactable(player.team())){ if(Core.input.keyDown(Binding.rotateplaced) && build.block.rotate && build.interactable(player.team())){
control.input.drawArrow(build.block(), build.tileX(), build.tileY(), build.rotation, true); control.input.drawArrow(build.block, build.tileX(), build.tileY(), build.rotation, true);
Draw.color(Pal.accent, 0.3f + Mathf.absin(4f, 0.2f)); Draw.color(Pal.accent, 0.3f + Mathf.absin(4f, 0.2f));
Fill.square(build.x, build.y, build.block().size * tilesize/2f); Fill.square(build.x, build.y, build.block.size * tilesize/2f);
Draw.color(); Draw.color();
} }
} }
@@ -163,9 +163,9 @@ public class OverlayRenderer{
Building tile = world.buildWorld(v.x, v.y); Building tile = world.buildWorld(v.x, v.y);
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0 && player.within(tile, itemTransferRange)){ if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0 && player.within(tile, itemTransferRange)){
Lines.stroke(3f, Pal.gray); Lines.stroke(3f, Pal.gray);
Lines.square(tile.x, tile.y, tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f)); Lines.square(tile.x, tile.y, tile.block.size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
Lines.stroke(1f, Pal.place); Lines.stroke(1f, Pal.place);
Lines.square(tile.x, tile.y, tile.block().size * tilesize / 2f + 2 + Mathf.absin(Time.time(), 5f, 1f)); Lines.square(tile.x, tile.y, tile.block.size * tilesize / 2f + 2 + Mathf.absin(Time.time(), 5f, 1f));
Draw.reset(); Draw.reset();
} }

View File

@@ -128,7 +128,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(tile != null && tile.team == unit.team if(tile != null && tile.team == unit.team
&& unit.within(tile, tilesize * tile.block.size * 1.2f)){ && unit.within(tile, tilesize * tile.block.size * 1.2f)){
//pick up block directly //pick up block directly
if(tile.block().buildVisibility != BuildVisibility.hidden && tile.canPickup() && pay.canPickup(tile)){ if(tile.block.buildVisibility != BuildVisibility.hidden && tile.canPickup() && pay.canPickup(tile)){
pay.pickup(tile); pay.pickup(tile);
}else{ //pick up block payload }else{ //pick up block payload
Payload current = tile.getPayload(); Payload current = tile.getPayload();
@@ -189,7 +189,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(player == null || tile == null || !player.within(tile, buildingRange)) return; if(player == null || tile == null || !player.within(tile, buildingRange)) return;
if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, tile) || if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, tile) ||
!netServer.admins.allowAction(player, ActionType.depositItem, tile.tile(), action -> { !netServer.admins.allowAction(player, ActionType.depositItem, tile.tile, action -> {
action.itemAmount = player.unit().stack.amount; action.itemAmount = player.unit().stack.amount;
action.item = player.unit().item(); action.item = player.unit().item();
}))){ }))){
@@ -219,7 +219,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public static void tileConfig(@Nullable Player player, Building tile, @Nullable Object value){ public static void tileConfig(@Nullable Player player, Building tile, @Nullable Object value){
if(tile == null) return; if(tile == null) return;
if(net.server() && (!Units.canInteract(player, tile) || if(net.server() && (!Units.canInteract(player, tile) ||
!netServer.admins.allowAction(player, ActionType.configure, tile.tile(), action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile."); !netServer.admins.allowAction(player, ActionType.configure, tile.tile, action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile.");
tile.configured(player == null || player.dead() ? null : player.unit(), value); tile.configured(player == null || player.dead() ? null : player.unit(), value);
Core.app.post(() -> Events.fire(new ConfigEvent(tile, player, value))); Core.app.post(() -> Events.fire(new ConfigEvent(tile, player, value)));
} }
@@ -753,7 +753,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
boolean consumed = false, showedInventory = false; boolean consumed = false, showedInventory = false;
//check if tapped block is configurable //check if tapped block is configurable
if(tile.block().configurable && tile.interactable(player.team())){ if(tile.block.configurable && tile.interactable(player.team())){
consumed = true; consumed = true;
if(((!frag.config.isShown() && tile.shouldShowConfigure(player)) //if the config fragment is hidden, show if(((!frag.config.isShown() && tile.shouldShowConfigure(player)) //if the config fragment is hidden, show
//alternatively, the current selected block can 'agree' to switch config tiles //alternatively, the current selected block can 'agree' to switch config tiles
@@ -780,10 +780,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
//consume tap event if necessary //consume tap event if necessary
if(tile.interactable(player.team()) && tile.block().consumesTap){ if(tile.interactable(player.team()) && tile.block.consumesTap){
consumed = true; consumed = true;
}else if(tile.interactable(player.team()) && tile.block().synthetic() && !consumed){ }else if(tile.interactable(player.team()) && tile.block.synthetic() && !consumed){
if(tile.block().hasItems && tile.items.total() > 0){ if(tile.block.hasItems && tile.items.total() > 0){
frag.inv.showFor(tile); frag.inv.showFor(tile);
consumed = true; consumed = true;
showedInventory = true; showedInventory = true;
@@ -953,7 +953,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
ItemStack stack = player.unit().stack; ItemStack stack = player.unit().stack;
if(tile != null && tile.acceptStack(stack.item, stack.amount, player.unit()) > 0 && tile.interactable(player.team()) && tile.block().hasItems && player.unit().stack().amount > 0 && tile.interactable(player.team())){ if(tile != null && tile.acceptStack(stack.item, stack.amount, player.unit()) > 0 && tile.interactable(player.team()) && tile.block.hasItems && player.unit().stack().amount > 0 && tile.interactable(player.team())){
Call.transferInventory(player, tile); Call.transferInventory(player, tile);
}else{ }else{
Call.dropItem(player.angleTo(x, y)); Call.dropItem(player.angleTo(x, y));

View File

@@ -558,7 +558,7 @@ public class MobileInput extends InputHandler implements GestureListener{
//ignore off-screen taps //ignore off-screen taps
if(cursor == null || Core.scene.hasMouse(x, y)) return false; if(cursor == null || Core.scene.hasMouse(x, y)) return false;
Tile linked = cursor.build == null ? cursor : cursor.build.tile(); Tile linked = cursor.build == null ? cursor : cursor.build.tile;
if(!player.dead()){ if(!player.dead()){
checkTargets(worldx, worldy); checkTargets(worldx, worldy);

View File

@@ -42,7 +42,13 @@ public abstract class SaveFileReader{
"shalerocks", "shale-wall", "shalerocks", "shale-wall",
"snowrocks", "snow-wall", "snowrocks", "snow-wall",
"saltrocks", "salt-wall", "saltrocks", "salt-wall",
"dirtwall", "dirt-wall" "dirtwall", "dirt-wall",
"ignarock", "basalt",
"holostone", "dacite",
"holostone-wall", "dacite-wall",
"rock", "boulder",
"snowrock", "snow-boulder"
); );
protected final ReusableByteOutStream byteOutput = new ReusableByteOutStream(); protected final ReusableByteOutStream byteOutput = new ReusableByteOutStream();

View File

@@ -54,7 +54,7 @@ public abstract class LegacySaveVersion extends SaveVersion{
if(block == null) block = Blocks.air; if(block == null) block = Blocks.air;
//occupied by multiblock part //occupied by multiblock part
boolean occupied = tile.build != null && !tile.isCenter() && (tile.build.block() == block || block == Blocks.air); boolean occupied = tile.build != null && !tile.isCenter() && (tile.build.block == block || block == Blocks.air);
//do not override occupied cells //do not override occupied cells
if(!occupied){ if(!occupied){

View File

@@ -292,25 +292,29 @@ public class Maps{
if(str == null || str.isEmpty()){ if(str == null || str.isEmpty()){
//create default filters list //create default filters list
Seq<GenerateFilter> filters = Seq.with( Seq<GenerateFilter> filters = Seq.with(
new ScatterFilter(){{
flooronto = Blocks.stone;
block = Blocks.rock;
}},
new ScatterFilter(){{
flooronto = Blocks.shale;
block = Blocks.shaleBoulder;
}},
new ScatterFilter(){{ new ScatterFilter(){{
flooronto = Blocks.snow; flooronto = Blocks.snow;
block = Blocks.snowrock; block = Blocks.snowBoulder;
}}, }},
new ScatterFilter(){{ new ScatterFilter(){{
flooronto = Blocks.ice; flooronto = Blocks.ice;
block = Blocks.snowrock; block = Blocks.snowBoulder;
}}, }},
new ScatterFilter(){{ new ScatterFilter(){{
flooronto = Blocks.sand; flooronto = Blocks.sand;
block = Blocks.sandBoulder; block = Blocks.sandBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.dacite;
block = Blocks.daciteBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.stone;
block = Blocks.boulder;
}},
new ScatterFilter(){{
flooronto = Blocks.shale;
block = Blocks.shaleBoulder;
}} }}
); );

View File

@@ -75,7 +75,7 @@ public class BaseGenerator{
//fill core with every type of item (even non-material) //fill core with every type of item (even non-material)
Building entity = tile.build; Building entity = tile.build;
for(Item item : content.items()){ for(Item item : content.items()){
entity.items.add(item, entity.block().itemCapacity); entity.items.add(item, entity.block.itemCapacity);
} }
} }

View File

@@ -27,10 +27,10 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
{Blocks.water, Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.darksandTaintedWater, Blocks.stone, Blocks.stone, Blocks.stone}, {Blocks.water, Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.darksandTaintedWater, Blocks.stone, Blocks.stone, Blocks.stone},
{Blocks.water, Blocks.darksandWater, Blocks.darksand, Blocks.sand, Blocks.salt, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.darksandTaintedWater, Blocks.stone, Blocks.stone, Blocks.stone}, {Blocks.water, Blocks.darksandWater, Blocks.darksand, Blocks.sand, Blocks.salt, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.darksandTaintedWater, Blocks.stone, Blocks.stone, Blocks.stone},
{Blocks.water, Blocks.sandWater, Blocks.sand, Blocks.salt, Blocks.salt, Blocks.salt, Blocks.sand, Blocks.stone, Blocks.stone, Blocks.stone, Blocks.snow, Blocks.iceSnow, Blocks.ice}, {Blocks.water, Blocks.sandWater, Blocks.sand, Blocks.salt, Blocks.salt, Blocks.salt, Blocks.sand, Blocks.stone, Blocks.stone, Blocks.stone, Blocks.snow, Blocks.iceSnow, Blocks.ice},
{Blocks.deepwater, Blocks.water, Blocks.sandWater, Blocks.sand, Blocks.salt, Blocks.sand, Blocks.sand, Blocks.ignarock, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice}, {Blocks.deepwater, Blocks.water, Blocks.sandWater, Blocks.sand, Blocks.salt, Blocks.sand, Blocks.sand, Blocks.basalt, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice},
{Blocks.deepwater, Blocks.water, Blocks.sandWater, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.moss, Blocks.iceSnow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.snow, Blocks.ice}, {Blocks.deepwater, Blocks.water, Blocks.sandWater, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.moss, Blocks.iceSnow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.snow, Blocks.ice},
{Blocks.deepwater, Blocks.sandWater, Blocks.sand, Blocks.sand, Blocks.moss, Blocks.moss, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice, Blocks.snow, Blocks.ice}, {Blocks.deepwater, Blocks.sandWater, Blocks.sand, Blocks.sand, Blocks.moss, Blocks.moss, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice, Blocks.snow, Blocks.ice},
{Blocks.taintedWater, Blocks.darksandTaintedWater, Blocks.darksand, Blocks.darksand, Blocks.ignarock, Blocks.moss, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.snow, Blocks.ice, Blocks.ice}, {Blocks.taintedWater, Blocks.darksandTaintedWater, Blocks.darksand, Blocks.darksand, Blocks.basalt, Blocks.moss, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.snow, Blocks.ice, Blocks.ice},
{Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.darksand, Blocks.moss, Blocks.sporeMoss, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice}, {Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.darksand, Blocks.moss, Blocks.sporeMoss, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice},
{Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.sporeMoss, Blocks.ice, Blocks.ice, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice, Blocks.ice}, {Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.sporeMoss, Blocks.ice, Blocks.ice, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice, Blocks.ice},
{Blocks.taintedWater, Blocks.darksandTaintedWater, Blocks.darksand, Blocks.sporeMoss, Blocks.sporeMoss, Blocks.ice, Blocks.ice, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice, Blocks.ice, Blocks.ice}, {Blocks.taintedWater, Blocks.darksandTaintedWater, Blocks.darksand, Blocks.sporeMoss, Blocks.sporeMoss, Blocks.ice, Blocks.ice, Blocks.snow, Blocks.snow, Blocks.ice, Blocks.ice, Blocks.ice, Blocks.ice},

View File

@@ -61,7 +61,7 @@ public class BlockConfigFragment extends Fragment{
} }
table.setOrigin(Align.center); table.setOrigin(Align.center);
if(configTile == null || configTile.block() == Blocks.air || !configTile.isValid()){ if(configTile == null || configTile.block == Blocks.air || !configTile.isValid()){
hideConfig(); hideConfig();
}else{ }else{
configTile.updateTableAlign(table); configTile.updateTableAlign(table);

View File

@@ -79,7 +79,7 @@ public class BlockInventoryFragment extends Fragment{
return; return;
} }
this.tile = t; this.tile = t;
if(tile == null || !tile.block().isAccessible() || tile.items.total() == 0) if(tile == null || !tile.block.isAccessible() || tile.items.total() == 0)
return; return;
rebuild(true); rebuild(true);
} }
@@ -108,7 +108,7 @@ public class BlockInventoryFragment extends Fragment{
table.touchable = Touchable.enabled; table.touchable = Touchable.enabled;
table.update(() -> { table.update(() -> {
if(state.isMenu() || tile == null || !tile.isValid() || !tile.block().isAccessible() || emptyTime >= holdShrink){ if(state.isMenu() || tile == null || !tile.isValid() || !tile.block.isAccessible() || emptyTime >= holdShrink){
hide(); hide();
}else{ }else{
if(tile.items.total() == 0){ if(tile.items.total() == 0){
@@ -131,7 +131,7 @@ public class BlockInventoryFragment extends Fragment{
} }
updateTablePosition(); updateTablePosition();
if(tile.block().hasItems){ if(tile.block.hasItems){
boolean dirty = false; boolean dirty = false;
if(shrinkHoldTimes.length != content.items().size) shrinkHoldTimes = new float[content.items().size]; if(shrinkHoldTimes.length != content.items().size) shrinkHoldTimes = new float[content.items().size];
@@ -157,7 +157,7 @@ public class BlockInventoryFragment extends Fragment{
table.margin(4f); table.margin(4f);
table.defaults().size(8 * 5).pad(4f); table.defaults().size(8 * 5).pad(4f);
if(tile.block().hasItems){ if(tile.block.hasItems){
for(int i = 0; i < content.items().size; i++){ for(int i = 0; i < content.items().size; i++){
Item item = content.item(i); Item item = content.item(i);
@@ -233,7 +233,7 @@ public class BlockInventoryFragment extends Fragment{
} }
private void updateTablePosition(){ private void updateTablePosition(){
Vec2 v = Core.input.mouseScreen(tile.x + tile.block().size * tilesize / 2f, tile.y + tile.block().size * tilesize / 2f); Vec2 v = Core.input.mouseScreen(tile.x + tile.block.size * tilesize / 2f, tile.y + tile.block.size * tilesize / 2f);
table.pack(); table.pack();
table.setPosition(v.x, v.y, Align.topLeft); table.setPosition(v.x, v.y, Align.topLeft);
} }

View File

@@ -95,7 +95,7 @@ public class PlacementFragment extends Fragment{
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
Building tile = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y); Building tile = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
Block tryRecipe = tile == null ? null : tile.block() instanceof ConstructBlock ? ((ConstructBuild)tile).cblock : tile.block; Block tryRecipe = tile == null ? null : tile.block instanceof ConstructBlock ? ((ConstructBuild)tile).cblock : tile.block;
Object tryConfig = tile == null ? null : tile.config(); Object tryConfig = tile == null ? null : tile.config();
for(BuildPlan req : player.builder().plans()){ for(BuildPlan req : player.builder().plans()){

View File

@@ -51,7 +51,7 @@ public class Edges{
} }
public static Tile getFacingEdge(Building tile, Building other){ public static Tile getFacingEdge(Building tile, Building other){
return getFacingEdge(tile.block(), tile.tileX(), tile.tileY(), other.tile()); return getFacingEdge(tile.block, tile.tileX(), tile.tileY(), other.tile());
} }
public static Tile getFacingEdge(Tile tile, Tile other){ public static Tile getFacingEdge(Tile tile, Tile other){

View File

@@ -456,7 +456,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
build.removeFromProximity(); build.removeFromProximity();
//remove this tile's dangling entities //remove this tile's dangling entities
if(build.block().isMultiblock()){ if(build.block.isMultiblock()){
int cx = build.tileX(), cy = build.tileY(); int cx = build.tileX(), cy = build.tileY();
int size = build.block.size; int size = build.block.size;
int offsetx = -(size - 1) / 2; int offsetx = -(size - 1) / 2;
@@ -521,7 +521,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
//since the entity won't update proximity for us, update proximity for all nearby tiles manually //since the entity won't update proximity for us, update proximity for all nearby tiles manually
for(Point2 p : Geometry.d4){ for(Point2 p : Geometry.d4){
Building tile = world.build(x + p.x, y + p.y); Building tile = world.build(x + p.x, y + p.y);
if(tile != null && !tile.tile().changing){ if(tile != null && !tile.tile.changing){
tile.onProximityUpdate(); tile.onProximityUpdate();
} }
} }

View File

@@ -104,7 +104,7 @@ public interface Autotiler{
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
int realDir = Mathf.mod(rotation - i, 4); int realDir = Mathf.mod(rotation - i, 4);
if(blends(tile, rotation, directional, i, world) && (tile != null && tile.getNearbyEntity(realDir) != null && !tile.getNearbyEntity(realDir).block().squareSprite)){ if(blends(tile, rotation, directional, i, world) && (tile != null && tile.getNearbyEntity(realDir) != null && !tile.getNearbyEntity(realDir).block.squareSprite)){
blendresult[4] |= (1 << i); blendresult[4] |= (1 << i);
} }
} }
@@ -147,7 +147,7 @@ public interface Autotiler{
default boolean blends(Tile tile, int rotation, int direction){ default boolean blends(Tile tile, int rotation, int direction){
Building other = tile.getNearbyEntity(Mathf.mod(rotation - direction, 4)); Building other = tile.getNearbyEntity(Mathf.mod(rotation - direction, 4));
return other != null && other.team == tile.team() && blends(tile, rotation, other.tileX(), other.tileY(), other.rotation, other.block()); return other != null && other.team == tile.team() && blends(tile, rotation, other.tileX(), other.tileY(), other.rotation, other.block);
} }
default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){

View File

@@ -77,7 +77,7 @@ public class MendProjector extends Block{
indexer.eachBlock(this, realRange, other -> other.damaged(), other -> { indexer.eachBlock(this, realRange, other -> other.damaged(), other -> {
other.heal(other.maxHealth() * (healPercent + phaseHeat * phaseBoost) / 100f * efficiency()); other.heal(other.maxHealth() * (healPercent + phaseHeat * phaseBoost) / 100f * efficiency());
Fx.healBlockFull.at(other.x, other.y, other.block().size, Tmp.c1.set(baseColor).lerp(phaseColor, phaseHeat)); Fx.healBlockFull.at(other.x, other.y, other.block.size, Tmp.c1.set(baseColor).lerp(phaseColor, phaseHeat));
}); });
} }
} }

View File

@@ -96,7 +96,7 @@ public class OverdriveProjector extends Block{
public void drawSelect(){ public void drawSelect(){
float realRange = range + phaseHeat * phaseRangeBoost; float realRange = range + phaseHeat * phaseRangeBoost;
indexer.eachBlock(this, realRange, other -> other.block().canOverdrive, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); indexer.eachBlock(this, realRange, other -> other.block.canOverdrive, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f))));
Drawf.dashCircle(x, y, realRange, baseColor); Drawf.dashCircle(x, y, realRange, baseColor);
} }

View File

@@ -18,7 +18,7 @@ public class ArmoredConveyor extends Conveyor{
public class ArmoredConveyorBuild extends ConveyorBuild{ public class ArmoredConveyorBuild extends ConveyorBuild{
@Override @Override
public boolean acceptItem(Building source, Item item){ public boolean acceptItem(Building source, Item item){
return super.acceptItem(source, item) && (source.block() instanceof Conveyor || Edges.getFacingEdge(source.tile(), tile).relativeTo(tile) == rotation); return super.acceptItem(source, item) && (source.block instanceof Conveyor || Edges.getFacingEdge(source.tile(), tile).relativeTo(tile) == rotation);
} }
} }
} }

View File

@@ -289,9 +289,9 @@ public class Conveyor extends Block implements Autotiler{
@Override @Override
public boolean acceptItem(Building source, Item item){ public boolean acceptItem(Building source, Item item){
if(len >= capacity) return false; if(len >= capacity) return false;
Tile facing = Edges.getFacingEdge(source.tile(), tile); Tile facing = Edges.getFacingEdge(source.tile, tile);
int direction = Math.abs(facing.relativeTo(tile.x, tile.y) - rotation); int direction = Math.abs(facing.relativeTo(tile.x, tile.y) - rotation);
return (((direction == 0) && minitem >= itemSpace) || ((direction % 2 == 1) && minitem > 0.7f)) && !(source.block().rotate && (source.rotation + 2) % 4 == rotation); return (((direction == 0) && minitem >= itemSpace) || ((direction % 2 == 1) && minitem > 0.7f)) && !(source.block.rotate && (source.rotation + 2) % 4 == rotation);
} }
@Override @Override
@@ -299,7 +299,7 @@ public class Conveyor extends Block implements Autotiler{
if(len >= capacity) return; if(len >= capacity) return;
int r = rotation; int r = rotation;
Tile facing = Edges.getFacingEdge(source.tile(), tile); Tile facing = Edges.getFacingEdge(source.tile, tile);
int ang = ((facing.relativeTo(tile.x, tile.y) - r)); int ang = ((facing.relativeTo(tile.x, tile.y) - r));
float x = (ang == -1 || ang == 3) ? 1 : (ang == 1 || ang == -3) ? -1 : 0; float x = (ang == -1 || ang == 3) ? 1 : (ang == 1 || ang == -3) ? -1 : 0;

View File

@@ -214,7 +214,7 @@ public class ItemBridge extends Block{
return true; return true;
} }
if(linkValid(tile, other.tile())){ if(linkValid(tile, other.tile)){
if(link == other.pos()){ if(link == other.pos()){
configure(-1); configure(-1);
}else{ }else{
@@ -358,7 +358,7 @@ public class ItemBridge extends Block{
} }
protected boolean linked(Building source){ protected boolean linked(Building source){
return source instanceof ItemBridgeBuild && linkValid(source.tile(), tile) && ((ItemBridgeBuild)source).link == pos(); return source instanceof ItemBridgeBuild && linkValid(source.tile, tile) && ((ItemBridgeBuild)source).link == pos();
} }
@Override @Override
@@ -369,7 +369,7 @@ public class ItemBridge extends Block{
protected boolean checkDump(Building to){ protected boolean checkDump(Building to){
Tile other = world.tile(link); Tile other = world.tile(link);
if(!linkValid(tile, other)){ if(!linkValid(tile, other)){
Tile edge = Edges.getFacingEdge(to.tile(), tile); Tile edge = Edges.getFacingEdge(to.tile, tile);
int i = relativeTo(edge.x, edge.y); int i = relativeTo(edge.x, edge.y);
IntSetIterator it = incoming.iterator(); IntSetIterator it = incoming.iterator();

View File

@@ -62,7 +62,7 @@ public class MassDriver extends Block{
//check if a mass driver is selected while placing this driver //check if a mass driver is selected while placing this driver
if(!control.input.frag.config.isShown()) return; if(!control.input.frag.config.isShown()) return;
Building selected = control.input.frag.config.getSelectedTile(); Building selected = control.input.frag.config.getSelectedTile();
if(selected == null || !(selected.block() instanceof MassDriver) || !(selected.within(x * tilesize, y * tilesize, range))) return; if(selected == null || !(selected.block instanceof MassDriver) || !(selected.within(x * tilesize, y * tilesize, range))) return;
//if so, draw a dotted line towards it while it is in range //if so, draw a dotted line towards it while it is in range
float sin = Mathf.absin(Time.time(), 6f, 1f); float sin = Mathf.absin(Time.time(), 6f, 1f);
@@ -155,7 +155,7 @@ public class MassDriver extends Block{
if( if(
items.total() >= minDistribute && //must shoot minimum amount of items items.total() >= minDistribute && //must shoot minimum amount of items
link.block().itemCapacity - link.items.total() >= minDistribute //must have minimum amount of space link.block.itemCapacity - link.items.total() >= minDistribute //must have minimum amount of space
){ ){
MassDriverBuild other = (MassDriverBuild)link; MassDriverBuild other = (MassDriverBuild)link;
other.waitingShooters.add(tile); other.waitingShooters.add(tile);
@@ -225,7 +225,7 @@ public class MassDriver extends Block{
if(link == other.pos()){ if(link == other.pos()){
configure(-1); configure(-1);
return false; return false;
}else if(other.block() instanceof MassDriver && other.dst(tile) <= range && other.team == team){ }else if(other.block instanceof MassDriver && other.dst(tile) <= range && other.team == team){
configure(other.pos()); configure(other.pos());
return false; return false;
} }

View File

@@ -91,14 +91,14 @@ public class OverflowGate extends Block{
int from = relativeToEdge(src); int from = relativeToEdge(src);
if(from == -1) return null; if(from == -1) return null;
Building to = nearby((from + 2) % 4); Building to = nearby((from + 2) % 4);
boolean canForward = to != null && to.acceptItem(this, item) && to.team == team && !(to.block() instanceof OverflowGate); boolean canForward = to != null && to.acceptItem(this, item) && to.team == team && !(to.block instanceof OverflowGate);
boolean inv = invert == enabled; boolean inv = invert == enabled;
if(!canForward || inv){ if(!canForward || inv){
Building a = nearby(Mathf.mod(from - 1, 4)); Building a = nearby(Mathf.mod(from - 1, 4));
Building b = nearby(Mathf.mod(from + 1, 4)); Building b = nearby(Mathf.mod(from + 1, 4));
boolean ac = a != null && a.acceptItem(this, item) && !(a.block() instanceof OverflowGate) && a.team == team; boolean ac = a != null && a.acceptItem(this, item) && !(a.block instanceof OverflowGate) && a.team == team;
boolean bc = b != null && b.acceptItem(this, item) && !(b.block() instanceof OverflowGate) && b.team == team; boolean bc = b != null && b.acceptItem(this, item) && !(b.block instanceof OverflowGate) && b.team == team;
if(!ac && !bc){ if(!ac && !bc){
return inv && canForward ? to : null; return inv && canForward ? to : null;

View File

@@ -43,8 +43,8 @@ public class PayloadConveyor extends Block{
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
Building other = world.build(x + Geometry.d4x[i] * size, y + Geometry.d4y[i] * size); Building other = world.build(x + Geometry.d4x[i] * size, y + Geometry.d4y[i] * size);
if(other != null && other.block().outputsPayload && other.block().size == size){ if(other != null && other.block.outputsPayload && other.block.size == size){
Drawf.selected(other.tileX(), other.tileY(), other.block(), Pal.accent); Drawf.selected(other.tileX(), other.tileY(), other.block, Pal.accent);
} }
} }
} }
@@ -71,13 +71,13 @@ public class PayloadConveyor extends Block{
//next block must be aligned and of the same size //next block must be aligned and of the same size
if(accept != null && ( if(accept != null && (
//same size //same size
(accept.block().size == size && tileX() + Geometry.d4(rotation).x * size == accept.tileX() && tileY() + Geometry.d4(rotation).y * size == accept.tileY()) || (accept.block.size == size && tileX() + Geometry.d4(rotation).x * size == accept.tileX() && tileY() + Geometry.d4(rotation).y * size == accept.tileY()) ||
//differing sizes //differing sizes
(accept.block().size > size && (accept.block.size > size &&
(rotation % 2 == 0 ? //check orientation (rotation % 2 == 0 ? //check orientation
Math.abs(accept.y - y) <= (accept.block().size * tilesize - size * tilesize)/2f : //check Y alignment Math.abs(accept.y - y) <= (accept.block.size * tilesize - size * tilesize)/2f : //check Y alignment
Math.abs(accept.x - x) <= (accept.block().size * tilesize - size * tilesize)/2f //check X alignment Math.abs(accept.x - x) <= (accept.block.size * tilesize - size * tilesize)/2f //check X alignment
)))){ )))){
next = accept; next = accept;
}else{ }else{

View File

@@ -35,7 +35,7 @@ public class Router extends Block{
time += 1f / speed * delta(); time += 1f / speed * delta();
Building target = getTileTarget(lastItem, lastInput, false); Building target = getTileTarget(lastItem, lastInput, false);
if(target != null && (time >= 1f || !(target.block() instanceof Router || target.block().instantTransfer))){ if(target != null && (time >= 1f || !(target.block instanceof Router || target.block.instantTransfer))){
getTileTarget(lastItem, lastInput, true); getTileTarget(lastItem, lastInput, true);
target.handleItem(this, lastItem); target.handleItem(this, lastItem);
items.remove(lastItem, 1); items.remove(lastItem, 1);

View File

@@ -88,7 +88,7 @@ public class Sorter extends Block{
public boolean isSame(Building other){ public boolean isSame(Building other){
// comment code below to allow sorter/gate chaining // comment code below to allow sorter/gate chaining
return other != null && other.block().instantTransfer; return other != null && other.block.instantTransfer;
} }
public Building getTileTarget(Item item, Building source, boolean flip){ public Building getTileTarget(Item item, Building source, boolean flip){
@@ -105,9 +105,9 @@ public class Sorter extends Block{
}else{ }else{
Building a = nearby(Mathf.mod(dir - 1, 4)); Building a = nearby(Mathf.mod(dir - 1, 4));
Building b = nearby(Mathf.mod(dir + 1, 4)); Building b = nearby(Mathf.mod(dir + 1, 4));
boolean ac = a != null && !(a.block().instantTransfer && source.block().instantTransfer) && boolean ac = a != null && !(a.block.instantTransfer && source.block.instantTransfer) &&
a.acceptItem(this, item); a.acceptItem(this, item);
boolean bc = b != null && !(b.block().instantTransfer && source.block().instantTransfer) && boolean bc = b != null && !(b.block.instantTransfer && source.block.instantTransfer) &&
b.acceptItem(this, item); b.acceptItem(this, item);
if(ac && !bc){ if(ac && !bc){

View File

@@ -7,10 +7,10 @@ import arc.math.Mathf;
import mindustry.world.Block; import mindustry.world.Block;
import mindustry.world.Tile; import mindustry.world.Tile;
public class Rock extends Block{ public class Boulder extends Block{
protected int variants; protected int variants;
public Rock(String name){ public Boulder(String name){
super(name); super(name);
breakable = true; breakable = true;
alwaysReplace = true; alwaysReplace = true;

View File

@@ -112,7 +112,7 @@ public class Floor extends Block{
if(wall == null) wall = Blocks.air; if(wall == null) wall = Blocks.air;
if(decoration == Blocks.air){ if(decoration == Blocks.air){
decoration = content.blocks().min(b -> b instanceof Rock && b.breakable ? mapColor.diff(b.mapColor) : Float.POSITIVE_INFINITY); decoration = content.blocks().min(b -> b instanceof Boulder && b.breakable ? mapColor.diff(b.mapColor) : Float.POSITIVE_INFINITY);
} }
} }

View File

@@ -10,7 +10,7 @@ import mindustry.world.*;
import static mindustry.Vars.world; import static mindustry.Vars.world;
public class StaticWall extends Rock{ public class StaticWall extends Boulder{
public @Load("@-large") TextureRegion large; public @Load("@-large") TextureRegion large;
public TextureRegion[][] split; public TextureRegion[][] split;

View File

@@ -56,7 +56,7 @@ public class BlockLoader extends PayloadAcceptor{
public boolean acceptPayload(Building source, Payload payload){ public boolean acceptPayload(Building source, Payload payload){
return super.acceptPayload(source, payload) && return super.acceptPayload(source, payload) &&
(payload instanceof BlockPayload) && (payload instanceof BlockPayload) &&
((((BlockPayload)payload).entity.block().hasItems && ((BlockPayload)payload).block().unloadable && ((BlockPayload)payload).block().itemCapacity >= 10)/* || ((((BlockPayload)payload).entity.block.hasItems && ((BlockPayload)payload).block().unloadable && ((BlockPayload)payload).block().itemCapacity >= 10)/* ||
((BlockPayload)payload).entity.block().hasLiquids && ((BlockPayload)payload).block().liquidCapacity >= 10f)*/); ((BlockPayload)payload).entity.block().hasLiquids && ((BlockPayload)payload).block().liquidCapacity >= 10f)*/);
} }
@@ -127,7 +127,7 @@ public class BlockLoader extends PayloadAcceptor{
} }
public float fraction(){ public float fraction(){
return payload == null ? 0f : payload.entity.items.total() / (float)payload.entity.block().itemCapacity; return payload == null ? 0f : payload.entity.items.total() / (float)payload.entity.block.itemCapacity;
} }
public boolean shouldExport(){ public boolean shouldExport(){

View File

@@ -56,7 +56,7 @@ public class BlockUnloader extends BlockLoader{
@Override @Override
public float fraction(){ public float fraction(){
return payload == null ? 0f : 1f - payload.entity.items.total() / (float)payload.entity.block().itemCapacity; return payload == null ? 0f : 1f - payload.entity.items.total() / (float)payload.entity.block.itemCapacity;
} }
@Override @Override

View File

@@ -26,14 +26,14 @@ public class ArmoredConduit extends Conduit{
// draw the cap when a conduit would normally leak // draw the cap when a conduit would normally leak
Building next = front(); Building next = front();
if(next != null && next.team == team && next.block().hasLiquids) return; if(next != null && next.team == team && next.block.hasLiquids) return;
Draw.rect(capRegion, x, y, rotdeg()); Draw.rect(capRegion, x, y, rotdeg());
} }
@Override @Override
public boolean acceptLiquid(Building source, Liquid liquid, float amount){ public boolean acceptLiquid(Building source, Liquid liquid, float amount){
return super.acceptLiquid(source, liquid, amount) && (source.block() instanceof Conduit) || return super.acceptLiquid(source, liquid, amount) && (source.block instanceof Conduit) ||
Edges.getFacingEdge(source.tile(), tile).absoluteRelativeTo(tile.x, tile.y) == rotation; Edges.getFacingEdge(source.tile(), tile).absoluteRelativeTo(tile.x, tile.y) == rotation;
} }
} }

View File

@@ -41,7 +41,7 @@ public class LiquidJunction extends LiquidBlock{
int dir = source.relativeTo(tile.x, tile.y); int dir = source.relativeTo(tile.x, tile.y);
dir = (dir + 4) % 4; dir = (dir + 4) % 4;
Building next = nearby(dir); Building next = nearby(dir);
if(next == null || (!next.acceptLiquid(this, liquid, 0f) && !(next.block() instanceof LiquidJunction))){ if(next == null || (!next.acceptLiquid(this, liquid, 0f) && !(next.block instanceof LiquidJunction))){
return this; return this;
} }
return next.getLiquidDestination(this, liquid); return next.getLiquidDestination(this, liquid);

View File

@@ -22,7 +22,7 @@ public class BlockPayload implements Payload{
} }
public Block block(){ public Block block(){
return entity.block(); return entity.block;
} }
public void place(Tile tile){ public void place(Tile tile){
@@ -30,7 +30,7 @@ public class BlockPayload implements Payload{
} }
public void place(Tile tile, int rotation){ public void place(Tile tile, int rotation){
tile.setBlock(entity.block(), entity.team, rotation, () -> entity); tile.setBlock(entity.block, entity.team, rotation, () -> entity);
entity.dropped(); entity.dropped();
} }
@@ -42,7 +42,7 @@ public class BlockPayload implements Payload{
@Override @Override
public void write(Writes write){ public void write(Writes write){
write.b(payloadBlock); write.b(payloadBlock);
write.s(entity.block().id); write.s(entity.block.id);
write.b(entity.version()); write.b(entity.version());
entity.writeAll(write); entity.writeAll(write);
} }
@@ -54,7 +54,7 @@ public class BlockPayload implements Payload{
@Override @Override
public void draw(){ public void draw(){
Drawf.shadow(entity.x, entity.y, entity.block().size * tilesize * 2f); Drawf.shadow(entity.x, entity.y, entity.block.size * tilesize * 2f);
Draw.rect(entity.block().icon(Cicon.full), entity.x, entity.y); Draw.rect(entity.block.icon(Cicon.full), entity.x, entity.y);
} }
} }

View File

@@ -40,7 +40,7 @@ public class PowerDiode extends Block{
// battery % of the graph on either side, defaults to zero // battery % of the graph on either side, defaults to zero
public float bar(Building tile){ public float bar(Building tile){
return (tile != null && tile.block().hasPower) ? tile.power.graph.getLastPowerStored() / tile.power.graph.getTotalBatteryCapacity() : 0f; return (tile != null && tile.block.hasPower) ? tile.power.graph.getLastPowerStored() / tile.power.graph.getTotalBatteryCapacity() : 0f;
} }
public class PowerDiodeBuild extends Building{ public class PowerDiodeBuild extends Building{
@@ -54,7 +54,7 @@ public class PowerDiode extends Block{
public void updateTile(){ public void updateTile(){
super.updateTile(); super.updateTile();
if(front() == null || back() == null || !back().block().hasPower || !front().block().hasPower || back().team != front().team) return; if(front() == null || back() == null || !back().block.hasPower || !front().block.hasPower || back().team != front().team) return;
PowerGraph backGraph = back().power.graph; PowerGraph backGraph = back().power.graph;
PowerGraph frontGraph = front().power.graph; PowerGraph frontGraph = front().power.graph;

View File

@@ -74,7 +74,7 @@ public class PowerGraph{
public float getPowerNeeded(){ public float getPowerNeeded(){
float powerNeeded = 0f; float powerNeeded = 0f;
for(Building consumer : consumers){ for(Building consumer : consumers){
Consumers consumes = consumer.block().consumes; Consumers consumes = consumer.block.consumes;
if(consumes.hasPower()){ if(consumes.hasPower()){
ConsumePower consumePower = consumes.getPower(); ConsumePower consumePower = consumes.getPower();
if(otherConsumersAreValid(consumer, consumePower)){ if(otherConsumersAreValid(consumer, consumePower)){
@@ -88,7 +88,7 @@ public class PowerGraph{
public float getBatteryStored(){ public float getBatteryStored(){
float totalAccumulator = 0f; float totalAccumulator = 0f;
for(Building battery : batteries){ for(Building battery : batteries){
Consumers consumes = battery.block().consumes; Consumers consumes = battery.block.consumes;
if(consumes.hasPower()){ if(consumes.hasPower()){
totalAccumulator += battery.power.status * consumes.getPower().capacity; totalAccumulator += battery.power.status * consumes.getPower().capacity;
} }
@@ -99,8 +99,8 @@ public class PowerGraph{
public float getBatteryCapacity(){ public float getBatteryCapacity(){
float totalCapacity = 0f; float totalCapacity = 0f;
for(Building battery : batteries){ for(Building battery : batteries){
if(battery.block().consumes.hasPower()){ if(battery.block.consumes.hasPower()){
ConsumePower power = battery.block().consumes.getPower(); ConsumePower power = battery.block.consumes.getPower();
totalCapacity += (1f - battery.power.status) * power.capacity; totalCapacity += (1f - battery.power.status) * power.capacity;
} }
} }
@@ -110,8 +110,8 @@ public class PowerGraph{
public float getTotalBatteryCapacity(){ public float getTotalBatteryCapacity(){
float totalCapacity = 0f; float totalCapacity = 0f;
for(Building battery : batteries){ for(Building battery : batteries){
if(battery.block().consumes.hasPower()){ if(battery.block.consumes.hasPower()){
totalCapacity += battery.block().consumes.getPower().capacity; totalCapacity += battery.block.consumes.getPower().capacity;
} }
} }
return totalCapacity; return totalCapacity;
@@ -124,7 +124,7 @@ public class PowerGraph{
float used = Math.min(stored, needed); float used = Math.min(stored, needed);
float consumedPowerPercentage = Math.min(1.0f, needed / stored); float consumedPowerPercentage = Math.min(1.0f, needed / stored);
for(Building battery : batteries){ for(Building battery : batteries){
Consumers consumes = battery.block().consumes; Consumers consumes = battery.block.consumes;
if(consumes.hasPower()){ if(consumes.hasPower()){
battery.power.status *= (1f-consumedPowerPercentage); battery.power.status *= (1f-consumedPowerPercentage);
} }
@@ -139,7 +139,7 @@ public class PowerGraph{
if(Mathf.equal(capacity, 0f)) return 0f; if(Mathf.equal(capacity, 0f)) return 0f;
for(Building battery : batteries){ for(Building battery : batteries){
Consumers consumes = battery.block().consumes; Consumers consumes = battery.block.consumes;
if(consumes.hasPower()){ if(consumes.hasPower()){
ConsumePower consumePower = consumes.getPower(); ConsumePower consumePower = consumes.getPower();
if(consumePower.capacity > 0f){ if(consumePower.capacity > 0f){
@@ -154,7 +154,7 @@ public class PowerGraph{
//distribute even if not needed. this is because some might be requiring power but not using it; it updates consumers //distribute even if not needed. this is because some might be requiring power but not using it; it updates consumers
float coverage = Mathf.zero(needed) && Mathf.zero(produced) ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed); float coverage = Mathf.zero(needed) && Mathf.zero(produced) ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed);
for(Building consumer : consumers){ for(Building consumer : consumers){
Consumers consumes = consumer.block().consumes; Consumers consumes = consumer.block.consumes;
if(consumes.hasPower()){ if(consumes.hasPower()){
ConsumePower consumePower = consumes.getPower(); ConsumePower consumePower = consumes.getPower();
if(consumePower.buffered){ if(consumePower.buffered){
@@ -237,14 +237,14 @@ public class PowerGraph{
tile.power.graph = this; tile.power.graph = this;
all.add(tile); all.add(tile);
if(tile.block().outputsPower && tile.block().consumesPower && !tile.block().consumes.getPower().buffered){ if(tile.block.outputsPower && tile.block.consumesPower && !tile.block.consumes.getPower().buffered){
producers.add(tile); producers.add(tile);
consumers.add(tile); consumers.add(tile);
}else if(tile.block().outputsPower && tile.block().consumesPower){ }else if(tile.block.outputsPower && tile.block.consumesPower){
batteries.add(tile); batteries.add(tile);
}else if(tile.block().outputsPower){ }else if(tile.block.outputsPower){
producers.add(tile); producers.add(tile);
}else if(tile.block().consumesPower){ }else if(tile.block.consumesPower){
consumers.add(tile); consumers.add(tile);
} }
} }
@@ -311,7 +311,7 @@ public class PowerGraph{
} }
private boolean otherConsumersAreValid(Building tile, Consume consumePower){ private boolean otherConsumersAreValid(Building tile, Consume consumePower){
for(Consume cons : tile.block().consumes.all()){ for(Consume cons : tile.block.consumes.all()){
if(cons != consumePower && !cons.isOptional() && !cons.valid(tile)){ if(cons != consumePower && !cons.isOptional() && !cons.valid(tile)){
return false; return false;
} }

View File

@@ -135,10 +135,10 @@ public class PowerNode extends PowerBlock{
Drawf.circles(x * tilesize + offset, y * tilesize + offset, laserRange * tilesize); Drawf.circles(x * tilesize + offset, y * tilesize + offset, laserRange * tilesize);
getPotentialLinks(tile, other -> { getPotentialLinks(tile, other -> {
Drawf.square(other.x, other.y, other.block().size * tilesize / 2f + 2f, Pal.place); Drawf.square(other.x, other.y, other.block.size * tilesize / 2f + 2f, Pal.place);
insulators(tile.x, tile.y, other.tileX(), other.tileY(), cause -> { insulators(tile.x, tile.y, other.tileX(), other.tileY(), cause -> {
Drawf.square(cause.x, cause.y, cause.block().size * tilesize / 2f + 2f, Pal.plastanium); Drawf.square(cause.x, cause.y, cause.block.size * tilesize / 2f + 2f, Pal.plastanium);
}); });
}); });
@@ -185,9 +185,9 @@ public class PowerNode extends PowerBlock{
protected void getPotentialLinks(Tile tile, Cons<Building> others){ protected void getPotentialLinks(Tile tile, Cons<Building> others){
Boolf<Building> valid = other -> other != null && other.tile() != tile && other.power != null && Boolf<Building> valid = other -> other != null && other.tile() != tile && other.power != null &&
((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower) || other.block() instanceof PowerNode) && ((!other.block.outputsPower && other.block.consumesPower) || (other.block.outputsPower && !other.block.consumesPower) || other.block instanceof PowerNode) &&
overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == player.team() overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == player.team()
&& !other.proximity().contains(e -> e.tile() == tile) && !graphs.contains(other.power.graph); && !other.proximity.contains(e -> e.tile == tile) && !graphs.contains(other.power.graph);
tempTileEnts.clear(); tempTileEnts.clear();
graphs.clear(); graphs.clear();
@@ -203,7 +203,7 @@ public class PowerNode extends PowerBlock{
}); });
tempTileEnts.sort((a, b) -> { tempTileEnts.sort((a, b) -> {
int type = -Boolean.compare(a.block() instanceof PowerNode, b.block() instanceof PowerNode); int type = -Boolean.compare(a.block instanceof PowerNode, b.block instanceof PowerNode);
if(type != 0) return type; if(type != 0) return type;
return Float.compare(a.dst2(tile), b.dst2(tile)); return Float.compare(a.dst2(tile), b.dst2(tile));
}); });
@@ -237,11 +237,11 @@ public class PowerNode extends PowerBlock{
} }
public boolean linkValid(Building tile, Building link, boolean checkMaxNodes){ public boolean linkValid(Building tile, Building link, boolean checkMaxNodes){
if(tile == link || link == null || !link.block().hasPower || tile.team != link.team) return false; if(tile == link || link == null || !link.block.hasPower || tile.team != link.team) return false;
if(overlaps(tile, link, laserRange * tilesize) || (link.block() instanceof PowerNode && overlaps(link, tile, ((PowerNode)link.block()).laserRange * tilesize))){ if(overlaps(tile, link, laserRange * tilesize) || (link.block instanceof PowerNode && overlaps(link, tile, ((PowerNode)link.block).laserRange * tilesize))){
if(checkMaxNodes && link.block() instanceof PowerNode){ if(checkMaxNodes && link.block instanceof PowerNode){
return link.power.links.size < ((PowerNode)link.block()).maxNodes || link.power.links.contains(tile.pos()); return link.power.links.size < ((PowerNode)link.block).maxNodes || link.power.links.contains(tile.pos());
} }
return true; return true;
} }
@@ -266,7 +266,7 @@ public class PowerNode extends PowerBlock{
world.raycastEach(x, y, x2, y2, (wx, wy) -> { world.raycastEach(x, y, x2, y2, (wx, wy) -> {
Building tile = world.build(wx, wy); Building tile = world.build(wx, wy);
if(tile != null && tile.block().insulated){ if(tile != null && tile.block.insulated){
iterator.get(tile); iterator.get(tile);
} }
@@ -280,8 +280,8 @@ public class PowerNode extends PowerBlock{
public void placed(){ public void placed(){
if(net.client()) return; if(net.client()) return;
Boolf<Building> valid = other -> other != null && other != this && ((!other.block().outputsPower && other.block().consumesPower) || Boolf<Building> valid = other -> other != null && other != this && ((!other.block.outputsPower && other.block.consumesPower) ||
(other.block().outputsPower && !other.block().consumesPower) || other.block() instanceof PowerNode) && linkValid(this, other) (other.block.outputsPower && !other.block.consumesPower) || other.block instanceof PowerNode) && linkValid(this, other)
&& !other.proximity().contains(this) && other.power.graph != power.graph; && !other.proximity().contains(this) && other.power.graph != power.graph;
tempTileEnts.clear(); tempTileEnts.clear();
@@ -295,7 +295,7 @@ public class PowerNode extends PowerBlock{
}); });
tempTileEnts.sort((a, b) -> { tempTileEnts.sort((a, b) -> {
int type = -Boolean.compare(a.block() instanceof PowerNode, b.block() instanceof PowerNode); int type = -Boolean.compare(a.block instanceof PowerNode, b.block instanceof PowerNode);
if(type != 0) return type; if(type != 0) return type;
return Float.compare(a.dst2(tile), b.dst2(tile)); return Float.compare(a.dst2(tile), b.dst2(tile));
}); });
@@ -373,7 +373,7 @@ public class PowerNode extends PowerBlock{
boolean linked = linked(link); boolean linked = linked(link);
if(linked){ if(linked){
Drawf.square(link.x, link.y, link.block().size * tilesize / 2f + 1f, Pal.place); Drawf.square(link.x, link.y, link.block.size * tilesize / 2f + 1f, Pal.place);
} }
} }
} }
@@ -395,7 +395,7 @@ public class PowerNode extends PowerBlock{
if(!linkValid(this, link)) continue; if(!linkValid(this, link)) continue;
if(link.block() instanceof PowerNode && !(link.pos() < tile.pos())) continue; if(link.block instanceof PowerNode && !(link.pos() < tile.pos())) continue;
drawLaserTo(link); drawLaserTo(link);
} }
@@ -408,7 +408,7 @@ public class PowerNode extends PowerBlock{
} }
protected void drawLaserTo(Building target){ protected void drawLaserTo(Building target){
drawLaser(team, x, y, target.x, target.y, power.graph.getSatisfaction(), size, target.block().size); drawLaser(team, x, y, target.x, target.y, power.graph.getSatisfaction(), size, target.block.size);
} }
@Override @Override

View File

@@ -28,22 +28,22 @@ public class PayloadAcceptor extends Block{
} }
public static boolean blends(Building tile, int direction){ public static boolean blends(Building tile, int direction){
int size = tile.block().size; int size = tile.block.size;
Building accept = tile.nearby(Geometry.d4(direction).x * size, Geometry.d4(direction).y * size); Building accept = tile.nearby(Geometry.d4(direction).x * size, Geometry.d4(direction).y * size);
return accept != null && return accept != null &&
accept.block().outputsPayload && accept.block.outputsPayload &&
//if size is the same, block must either be facing this one, or not be rotating //if size is the same, block must either be facing this one, or not be rotating
((accept.block().size == size && ((accept.block.size == size &&
((accept.tileX() + Geometry.d4(accept.rotation).x * size == tile.tileX() && accept.tileY() + Geometry.d4(accept.rotation).y * size == tile.tileY()) ((accept.tileX() + Geometry.d4(accept.rotation).x * size == tile.tileX() && accept.tileY() + Geometry.d4(accept.rotation).y * size == tile.tileY())
|| !accept.block().rotate || (accept.block().rotate && !accept.block().outputFacing))) || || !accept.block.rotate || (accept.block.rotate && !accept.block.outputFacing))) ||
//if the other block is smaller, check alignment //if the other block is smaller, check alignment
(accept.block().size < size && (accept.block.size < size &&
(accept.rotation % 2 == 0 ? //check orientation; make sure it's aligned properly with this block. (accept.rotation % 2 == 0 ? //check orientation; make sure it's aligned properly with this block.
Math.abs(accept.y - tile.y) <= (size * tilesize - accept.block().size * tilesize)/2f : //check Y alignment Math.abs(accept.y - tile.y) <= (size * tilesize - accept.block.size * tilesize)/2f : //check Y alignment
Math.abs(accept.x - tile.x) <= (size * tilesize - accept.block().size * tilesize)/2f //check X alignment Math.abs(accept.x - tile.x) <= (size * tilesize - accept.block.size * tilesize)/2f //check X alignment
)) && (!accept.block().rotate || accept.front() == tile || !accept.block().outputFacing) //make sure it's facing this block )) && (!accept.block.rotate || accept.front() == tile || !accept.block.outputFacing) //make sure it's facing this block
); );
} }
@@ -112,7 +112,7 @@ public class PayloadAcceptor extends Block{
payVector.clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f); payVector.clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f);
Building front = front(); Building front = front();
if(front != null && front.block().outputsPayload){ if(front != null && front.block.outputsPayload){
if(movePayload(payload)){ if(movePayload(payload)){
payload = null; payload = null;
} }

View File

@@ -210,7 +210,7 @@ public class CoreBlock extends StorageBlock{
} }
state.teams.registerCore(this); state.teams.registerCore(this);
storageCapacity = itemCapacity + proximity().sum(e -> isContainer(e) && owns(e) ? e.block().itemCapacity : 0); storageCapacity = itemCapacity + proximity().sum(e -> isContainer(e) && owns(e) ? e.block.itemCapacity : 0);
proximity.each(e -> isContainer(e) && owns(e), t -> { proximity.each(e -> isContainer(e) && owns(e), t -> {
t.items = items; t.items = items;
((StorageBuild)t).linkedCore = this; ((StorageBuild)t).linkedCore = this;
@@ -218,7 +218,7 @@ public class CoreBlock extends StorageBlock{
for(Building other : state.teams.cores(team)){ for(Building other : state.teams.cores(team)){
if(other.tile() == tile) continue; if(other.tile() == tile) continue;
storageCapacity += other.block().itemCapacity + other.proximity().sum(e -> isContainer(e) && owns(other, e) ? e.block().itemCapacity : 0); storageCapacity += other.block.itemCapacity + other.proximity().sum(e -> isContainer(e) && owns(other, e) ? e.block.itemCapacity : 0);
} }
if(!world.isGenerating()){ if(!world.isGenerating()){
@@ -238,7 +238,7 @@ public class CoreBlock extends StorageBlock{
Cons<Building> outline = t -> { Cons<Building> outline = t -> {
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
Point2 p = Geometry.d8edge[i]; Point2 p = Geometry.d8edge[i];
float offset = -Math.max(t.block().size - 1, 0) / 2f * tilesize; float offset = -Math.max(t.block.size - 1, 0) / 2f * tilesize;
Draw.rect("block-select", t.x + offset * p.x, t.y + offset * p.y, i * 90); Draw.rect("block-select", t.x + offset * p.x, t.y + offset * p.y, i * 90);
} }
}; };

View File

@@ -51,7 +51,7 @@ public class Unloader extends Block{
public void updateTile(){ public void updateTile(){
if(timer(timerUnload, speed / timeScale())){ if(timer(timerUnload, speed / timeScale())){
for(Building other : proximity){ for(Building other : proximity){
if(other.interactable(team) && other.block().unloadable && other.block().hasItems if(other.interactable(team) && other.block.unloadable && other.block.hasItems
&& ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){ && ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){
//make sure the item can't be dumped back into this block //make sure the item can't be dumped back into this block
dumpingTo = other; dumpingTo = other;
@@ -99,7 +99,7 @@ public class Unloader extends Block{
@Override @Override
public boolean canDump(Building to, Item item){ public boolean canDump(Building to, Item item){
return !(to.block() instanceof StorageBlock) && to != dumpingTo; return !(to.block instanceof StorageBlock) && to != dumpingTo;
} }
@Override @Override

View File

@@ -23,6 +23,6 @@ public abstract class ConsumeLiquidBase extends Consume{
} }
protected float use(Building entity){ protected float use(Building entity){
return Math.min(amount * entity.delta(), entity.block().liquidCapacity); return Math.min(amount * entity.delta(), entity.block.liquidCapacity);
} }
} }

View File

@@ -37,7 +37,7 @@ public class ConsumeModule extends BlockModule{
optionalValid = true; optionalValid = true;
boolean docons = entity.shouldConsume() && entity.productionValid(); boolean docons = entity.shouldConsume() && entity.productionValid();
for(Consume cons : entity.block().consumes.all()){ for(Consume cons : entity.block.consumes.all()){
if(cons.isOptional()) continue; if(cons.isOptional()) continue;
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){ if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
@@ -47,7 +47,7 @@ public class ConsumeModule extends BlockModule{
valid &= cons.valid(entity); valid &= cons.valid(entity);
} }
for(Consume cons : entity.block().consumes.optionals()){ for(Consume cons : entity.block.consumes.optionals()){
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){ if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
cons.update(entity); cons.update(entity);
} }
@@ -57,7 +57,7 @@ public class ConsumeModule extends BlockModule{
} }
public void trigger(){ public void trigger(){
for(Consume cons : entity.block().consumes.all()){ for(Consume cons : entity.block.consumes.all()){
cons.trigger(entity); cons.trigger(entity);
} }
} }

View File

@@ -65,7 +65,7 @@ public class SStats implements SteamUserStatsCallback{
} }
for(Building entity : player.team().cores()){ for(Building entity : player.team().cores()){
if(!content.items().contains(i -> entity.items.get(i) < entity.block().itemCapacity)){ if(!content.items().contains(i -> entity.items.get(i) < entity.block.itemCapacity)){
fillCoreAllCampaign.complete(); fillCoreAllCampaign.complete();
break; break;
} }
@@ -109,7 +109,7 @@ public class SStats implements SteamUserStatsCallback{
if(campaign() && e.unit != null && e.unit.isLocal() && !e.breaking){ if(campaign() && e.unit != null && e.unit.isLocal() && !e.breaking){
SStat.blocksBuilt.add(); SStat.blocksBuilt.add();
if(e.tile.block() == Blocks.router && e.tile.build.proximity().contains(t -> t.block() == Blocks.router)){ if(e.tile.block() == Blocks.router && e.tile.build.proximity().contains(t -> t.block == Blocks.router)){
chainRouters.complete(); chainRouters.complete();
} }

View File

@@ -491,7 +491,7 @@ public class ServerControl implements ApplicationListener{
} }
for(Item item : content.items()){ for(Item item : content.items()){
state.teams.cores(team).first().items.set(item, state.teams.cores(team).first().block().itemCapacity); state.teams.cores(team).first().items.set(item, state.teams.cores(team).first().block.itemCapacity);
} }
info("Core filled."); info("Core filled.");

View File

@@ -574,7 +574,7 @@ public class ApplicationTests{
}catch(Throwable t){ }catch(Throwable t){
fail("Failed to update block '" + tile.block() + "'.", t); fail("Failed to update block '" + tile.block() + "'.", t);
} }
assertEquals(tile.block(), tile.build.block()); assertEquals(tile.block(), tile.build.block);
assertEquals(tile.block().health, tile.build.health()); assertEquals(tile.block().health, tile.build.health());
} }
} }