Dacite decoration block / Environmental renaming
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
BIN
core/assets-raw/sprites/blocks/environment/dacite-wall-large.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
core/assets-raw/sprites/blocks/environment/dacite-wall1.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
core/assets-raw/sprites/blocks/environment/dacite-wall2.png
Normal file
After Width: | Height: | Size: 354 B |
BIN
core/assets-raw/sprites/blocks/environment/dacite1.png
Normal file
After Width: | Height: | Size: 283 B |
BIN
core/assets-raw/sprites/blocks/environment/dacite2.png
Normal file
After Width: | Height: | Size: 236 B |
BIN
core/assets-raw/sprites/blocks/environment/dacite3.png
Normal file
After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
BIN
core/assets-raw/sprites/blocks/props/dacite-boulder1.png
Normal file
After Width: | Height: | Size: 697 B |
BIN
core/assets-raw/sprites/blocks/props/dacite-boulder2.png
Normal file
After Width: | Height: | Size: 717 B |
Before Width: | Height: | Size: 411 B After Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 410 B |
@ -916,21 +916,21 @@ block.sand-boulder.name = Sand Boulder
|
||||
block.grass.name = Grass
|
||||
block.slag.name = Slag
|
||||
block.salt.name = Salt
|
||||
block.saltrocks.name = Salt Rocks
|
||||
block.salt-wall.name = Salt Wall
|
||||
block.pebbles.name = Pebbles
|
||||
block.tendrils.name = Tendrils
|
||||
block.sandrocks.name = Sand Rocks
|
||||
block.sand-wall.name = Sand Wall
|
||||
block.spore-pine.name = Spore Pine
|
||||
block.sporerocks.name = Spore Rocks
|
||||
block.rock.name = Rock
|
||||
block.snowrock.name = Snow Rock
|
||||
block.spore-wall.name = Spore Wall
|
||||
block.boulder.name = Boulder
|
||||
block.snow-boulder.name = Snow Boulder
|
||||
block.snow-pine.name = Snow Pine
|
||||
block.shale.name = Shale
|
||||
block.shale-boulder.name = Shale Boulder
|
||||
block.moss.name = Moss
|
||||
block.shrubs.name = Shrubs
|
||||
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-large.name = Large 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.darksand-water.name = Dark Sand Water
|
||||
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.rocks.name = Rocks
|
||||
block.icerocks.name = Ice rocks
|
||||
block.snowrocks.name = Snow Rocks
|
||||
block.dunerocks.name = Dune Rocks
|
||||
block.stone-wall.name = Stone Wall
|
||||
block.ice-wall.name = Ice Wall
|
||||
block.snow-wall.name = Snow Wall
|
||||
block.dune-wall.name = Dune Wall
|
||||
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.name = White Tree
|
||||
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-6.name = Dark Panel 6
|
||||
block.dark-metal.name = Dark Metal
|
||||
block.ignarock.name = Igna Rock
|
||||
block.basalt.name = Basalt
|
||||
block.hotrock.name = Hot Rock
|
||||
block.magmarock.name = Magma Rock
|
||||
block.cliffs.name = Cliffs
|
||||
|
@ -303,3 +303,10 @@
|
||||
63441=salt-wall|block-salt-wall-medium
|
||||
63440=shale-wall|block-shale-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
|
||||
|
Before Width: | Height: | Size: 803 B After Width: | Height: | Size: 811 B |
Before Width: | Height: | Size: 368 KiB After Width: | Height: | Size: 378 KiB |
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 318 KiB |
Before Width: | Height: | Size: 407 KiB After Width: | Height: | Size: 408 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 315 KiB |
Before Width: | Height: | Size: 418 KiB After Width: | Height: | Size: 415 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
@ -255,15 +255,15 @@ public class BlockIndexer{
|
||||
|
||||
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;
|
||||
|
||||
float ndst = e.dst2(x, y);
|
||||
if(ndst < range2 && (closest == null ||
|
||||
//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
|
||||
(usePriority && closest.block().priority.ordinal() < e.block().priority.ordinal()))){
|
||||
(usePriority && closest.block.priority.ordinal() < e.block.priority.ordinal()))){
|
||||
dst = ndst;
|
||||
closest = e;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class WaveSpawner{
|
||||
if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam) && !state.teams.playerCores().isEmpty()){
|
||||
Building firstCore = state.teams.playerCores().first();
|
||||
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;
|
||||
int steps = 0;
|
||||
|
@ -29,7 +29,7 @@ public class SuicideAI extends GroundAI{
|
||||
if(!Units.invalidateTarget(target, unit, unit.range())){
|
||||
rotate = true;
|
||||
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()){
|
||||
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
|
||||
|
@ -35,9 +35,9 @@ public class Blocks implements ContentList{
|
||||
|
||||
//environment
|
||||
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,
|
||||
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, grass, salt,
|
||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowWall, rock, snowrock, saltWall,
|
||||
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, daciteBoulder, grass, salt,
|
||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, basalt, magmarock, hotrock, snowWall, boulder, snowBoulder, saltWall,
|
||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||
pebbles, tendrils,
|
||||
|
||||
@ -221,14 +221,14 @@ public class Blocks implements ContentList{
|
||||
blendGroup = stone;
|
||||
}};
|
||||
|
||||
ignarock = new Floor("ignarock"){{
|
||||
basalt = new Floor("basalt"){{
|
||||
attributes.set(Attribute.water, -0.25f);
|
||||
}};
|
||||
|
||||
hotrock = new Floor("hotrock"){{
|
||||
attributes.set(Attribute.heat, 0.5f);
|
||||
attributes.set(Attribute.water, -0.5f);
|
||||
blendGroup = ignarock;
|
||||
blendGroup = basalt;
|
||||
|
||||
emitLight = true;
|
||||
lightRadius = 30f;
|
||||
@ -239,7 +239,7 @@ public class Blocks implements ContentList{
|
||||
attributes.set(Attribute.heat, 0.75f);
|
||||
attributes.set(Attribute.water, -0.75f);
|
||||
updateEffect = Fx.magmasmoke;
|
||||
blendGroup = ignarock;
|
||||
blendGroup = basalt;
|
||||
|
||||
emitLight = true;
|
||||
lightRadius = 60f;
|
||||
@ -264,7 +264,7 @@ public class Blocks implements ContentList{
|
||||
((ShallowLiquid)sandWater).set(Blocks.water, Blocks.sand);
|
||||
((ShallowLiquid)darksandWater).set(Blocks.water, Blocks.darksand);
|
||||
|
||||
holostone = new Floor("holostone");
|
||||
dacite = new Floor("dacite");
|
||||
|
||||
grass = new Floor("grass"){{
|
||||
attributes.set(Attribute.water, 0.1f);
|
||||
@ -305,11 +305,11 @@ public class Blocks implements ContentList{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
rock = new Rock("rock"){{
|
||||
boulder = new Boulder("boulder"){{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
snowrock = new Rock("snowrock"){{
|
||||
snowBoulder = new Boulder("snow-boulder"){{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
@ -317,6 +317,10 @@ public class Blocks implements ContentList{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
daciteWall = new StaticWall("dacite-wall"){{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
iceWall = new StaticWall("ice-wall"){{
|
||||
variants = 2;
|
||||
iceSnow.asFloor().wall = this;
|
||||
@ -328,7 +332,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
duneWall = new StaticWall("dune-wall"){{
|
||||
variants = 2;
|
||||
ignarock.asFloor().wall = this;
|
||||
basalt.asFloor().wall = this;
|
||||
}};
|
||||
|
||||
sandWall = new StaticWall("sand-wall"){{
|
||||
@ -355,7 +359,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
whiteTree = new TreeBlock("white-tree");
|
||||
|
||||
sporeCluster = new Rock("spore-cluster"){{
|
||||
sporeCluster = new Boulder("spore-cluster"){{
|
||||
variants = 3;
|
||||
}};
|
||||
|
||||
@ -368,11 +372,15 @@ public class Blocks implements ContentList{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
shaleBoulder = new Rock("shale-boulder"){{
|
||||
shaleBoulder = new Boulder("shale-boulder"){{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
sandBoulder = new Rock("sand-boulder"){{
|
||||
sandBoulder = new Boulder("sand-boulder"){{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
daciteBoulder = new Boulder("dacite-boulder"){{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
@ -513,7 +521,7 @@ public class Blocks implements ContentList{
|
||||
itemCapacity = 30;
|
||||
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);
|
||||
}};
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
|
||||
app.post(() -> ui.hudfrag.showLand());
|
||||
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, () -> {
|
||||
Fx.launch.at(core);
|
||||
Effect.shake(5f, 5f, core);
|
||||
|
@ -809,7 +809,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
short sent = 0;
|
||||
for(Building entity : Groups.build){
|
||||
if(!entity.block().sync) continue;
|
||||
if(!entity.block.sync) continue;
|
||||
sent ++;
|
||||
|
||||
dataStream.writeInt(entity.pos());
|
||||
@ -838,7 +838,7 @@ public class NetServer implements ApplicationListener{
|
||||
dataStream.writeByte(cores.size);
|
||||
|
||||
for(CoreBuild entity : cores){
|
||||
dataStream.writeInt(entity.tile().pos());
|
||||
dataStream.writeInt(entity.tile.pos());
|
||||
entity.items.write(Writes.get(dataStream));
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ public class Renderer implements ApplicationListener{
|
||||
float fract = landTime / Fx.coreLand.lifetime;
|
||||
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 s = reg.getWidth() * Draw.scl * scl * 4f * fract;
|
||||
|
||||
|
@ -105,7 +105,9 @@ public class World{
|
||||
public Tile tileBuilding(int x, int y){
|
||||
Tile tile = tiles.get(x, y);
|
||||
if(tile == null) return null;
|
||||
if(tile.build != null) return tile.build.tile();
|
||||
if(tile.build != null){
|
||||
return tile.build.tile();
|
||||
}
|
||||
return tile;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mindustry.editor;
|
||||
|
||||
import arc.func.*;
|
||||
import arc.input.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
@ -10,8 +11,8 @@ import mindustry.game.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public enum EditorTool{
|
||||
zoom,
|
||||
pick{
|
||||
zoom(KeyCode.v),
|
||||
pick(KeyCode.i){
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
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();
|
||||
}
|
||||
},
|
||||
line("replace", "orthogonal"){
|
||||
line(KeyCode.l, "replace", "orthogonal"){
|
||||
|
||||
@Override
|
||||
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;
|
||||
draggable = true;
|
||||
@ -67,7 +68,7 @@ public enum EditorTool{
|
||||
|
||||
}
|
||||
},
|
||||
eraser("eraseores"){
|
||||
eraser(KeyCode.e, "eraseores"){
|
||||
{
|
||||
edit = true;
|
||||
draggable = true;
|
||||
@ -86,7 +87,7 @@ public enum EditorTool{
|
||||
});
|
||||
}
|
||||
},
|
||||
fill("replaceall", "fillteams"){
|
||||
fill(KeyCode.g, "replaceall", "fillteams"){
|
||||
{
|
||||
edit = true;
|
||||
}
|
||||
@ -205,7 +206,7 @@ public enum EditorTool{
|
||||
}
|
||||
}
|
||||
},
|
||||
spray("replace"){
|
||||
spray(KeyCode.r, "replace"){
|
||||
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. */
|
||||
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.*/
|
||||
public int mode = -1;
|
||||
/** Whether this tool causes canvas changes when touched.*/
|
||||
@ -244,10 +249,20 @@ public enum EditorTool{
|
||||
this(new String[]{});
|
||||
}
|
||||
|
||||
EditorTool(KeyCode code){
|
||||
this(new String[]{});
|
||||
this.key = code;
|
||||
}
|
||||
|
||||
EditorTool(String... 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 touchedLine(MapEditor editor, int x1, int y1, int x2, int y2){}
|
||||
|
@ -576,22 +576,20 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
|
||||
if(Core.input.ctrl()){
|
||||
//alt mode select
|
||||
for(int i = 0; i < view.getTool().altModes.length + 1; i++){
|
||||
if(Core.input.keyTap(KeyCode.valueOf("num" + (i + 1)))){
|
||||
view.getTool().mode = i - 1;
|
||||
for(int i = 0; i < view.getTool().altModes.length; i++){
|
||||
if(i + 1 < KeyCode.numbers.length && Core.input.keyTap(KeyCode.numbers[i + 1])){
|
||||
view.getTool().mode = i;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//tool select
|
||||
for(int i = 0; i < EditorTool.values().length; i++){
|
||||
if(Core.input.keyTap(KeyCode.valueOf("num" + (i + 1)))){
|
||||
view.setTool(EditorTool.values()[i]);
|
||||
for(EditorTool tool : EditorTool.all){
|
||||
if(Core.input.keyTap(tool.key)){
|
||||
view.setTool(tool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(Core.input.keyTap(KeyCode.escape)){
|
||||
if(!menu.isShown()){
|
||||
menu.show();
|
||||
@ -619,7 +617,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
for(int x = 0; x < editor.width(); x++){
|
||||
for(int y = 0; y < editor.height(); 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);
|
||||
editor.renderer().updatePoint(x, y);
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ public class HealBulletType extends BulletType{
|
||||
public void hitTile(Bullet b, Building tile){
|
||||
super.hit(b);
|
||||
|
||||
if(tile.team == b.team && !(tile.block() instanceof ConstructBlock)){
|
||||
Fx.healBlockFull.at(tile.x, tile.y, tile.block().size, Pal.heal);
|
||||
if(tile.team == b.team && !(tile.block instanceof ConstructBlock)){
|
||||
Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
|
||||
tile.heal(healPercent / 100f * tile.maxHealth());
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ abstract class BlockUnitComp implements Unitc{
|
||||
this.tile = tile;
|
||||
|
||||
//sets up block stats
|
||||
maxHealth(tile.block().health);
|
||||
maxHealth(tile.block.health);
|
||||
health(tile.health());
|
||||
hitSize(tile.block().size * tilesize * 0.7f);
|
||||
hitSize(tile.block.size * tilesize * 0.7f);
|
||||
set(tile);
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
&& !other.proximity().contains(this.<Building>base()) &&
|
||||
!(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)));
|
||||
|
@ -112,9 +112,9 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
/** @return whether the tile has been successfully placed. */
|
||||
boolean dropBlock(BlockPayload payload){
|
||||
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);
|
||||
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;
|
||||
payload.place(on, rot);
|
||||
|
||||
|
@ -347,9 +347,9 @@ public class Schematics implements Loadable{
|
||||
for(int cy = y; cy <= y2; cy++){
|
||||
Building linked = world.build(cx, cy);
|
||||
|
||||
if(linked != null &&linked.block().isVisible() && !(linked.block() instanceof ConstructBlock)){
|
||||
int top = linked.block().size/2;
|
||||
int bot = linked.block().size % 2 == 1 ? -linked.block().size/2 : -(linked.block().size - 1)/2;
|
||||
if(linked != null && linked.block.isVisible() && !(linked.block instanceof ConstructBlock)){
|
||||
int top = linked.block.size/2;
|
||||
int bot = linked.block.size % 2 == 1 ? -linked.block.size/2 : -(linked.block.size - 1)/2;
|
||||
minx = Math.min(linked.tileX() + bot, minx);
|
||||
miny = Math.min(linked.tileY() + bot, miny);
|
||||
maxx = Math.max(linked.tileX() + top, maxx);
|
||||
@ -375,11 +375,11 @@ public class Schematics implements Loadable{
|
||||
for(int cy = oy; cy <= oy2; cy++){
|
||||
Building tile = world.build(cx, cy);
|
||||
|
||||
if(tile != null && !counted.contains(tile.pos()) && !(tile.block() instanceof ConstructBlock)
|
||||
&& (tile.block().isVisible() || (tile.block() instanceof CoreBlock))){
|
||||
if(tile != null && !counted.contains(tile.pos()) && !(tile.block instanceof ConstructBlock)
|
||||
&& (tile.block.isVisible() || (tile.block instanceof CoreBlock))){
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public class Tutorial{
|
||||
Building core = state.teams.playerCores().first();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,9 @@ public class BlockRenderer implements Disposable{
|
||||
Tile tile = world.rawTile(x, y);
|
||||
Block block = tile.block();
|
||||
//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.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){
|
||||
for(Building other : tile.build.getPowerConnections(outArray2)){
|
||||
if(other.block() instanceof PowerNode){ //TODO need a generic way to render connections!
|
||||
tileview.add(other.tile());
|
||||
if(other.block instanceof PowerNode){ //TODO need a generic way to render connections!
|
||||
tileview.add(other.tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class Drawf{
|
||||
Draw.color(Pal.accent);
|
||||
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();
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ public class MenuRenderer implements Disposable{
|
||||
new Block[]{Blocks.moss, Blocks.sporePine}
|
||||
);
|
||||
Block[] selected2 = Structs.select(
|
||||
new Block[]{Blocks.ignarock, Blocks.duneWall},
|
||||
new Block[]{Blocks.ignarock, Blocks.duneWall},
|
||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||
new Block[]{Blocks.moss, Blocks.sporeWall},
|
||||
@ -113,7 +113,7 @@ public class MenuRenderer implements Disposable{
|
||||
if(heat > base){
|
||||
ore = Blocks.air;
|
||||
wall = Blocks.air;
|
||||
floor = Blocks.ignarock;
|
||||
floor = Blocks.basalt;
|
||||
|
||||
if(heat > base + 0.1){
|
||||
floor = Blocks.hotrock;
|
||||
|
@ -82,7 +82,7 @@ public class OverlayRenderer{
|
||||
|
||||
if(select instanceof BlockUnitc){
|
||||
//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{
|
||||
Draw.rect(select.type().icon(Cicon.full), select.x(), select.y(), select.rotation() - 90);
|
||||
}
|
||||
@ -140,10 +140,10 @@ public class OverlayRenderer{
|
||||
build.drawDisabled();
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -163,9 +163,9 @@ public class OverlayRenderer{
|
||||
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)){
|
||||
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.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();
|
||||
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(tile != null && tile.team == unit.team
|
||||
&& unit.within(tile, tilesize * tile.block.size * 1.2f)){
|
||||
//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);
|
||||
}else{ //pick up block payload
|
||||
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(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.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){
|
||||
if(tile == null) return;
|
||||
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);
|
||||
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;
|
||||
|
||||
//check if tapped block is configurable
|
||||
if(tile.block().configurable && tile.interactable(player.team())){
|
||||
if(tile.block.configurable && tile.interactable(player.team())){
|
||||
consumed = true;
|
||||
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
|
||||
@ -780,10 +780,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
//consume tap event if necessary
|
||||
if(tile.interactable(player.team()) && tile.block().consumesTap){
|
||||
if(tile.interactable(player.team()) && tile.block.consumesTap){
|
||||
consumed = true;
|
||||
}else if(tile.interactable(player.team()) && tile.block().synthetic() && !consumed){
|
||||
if(tile.block().hasItems && tile.items.total() > 0){
|
||||
}else if(tile.interactable(player.team()) && tile.block.synthetic() && !consumed){
|
||||
if(tile.block.hasItems && tile.items.total() > 0){
|
||||
frag.inv.showFor(tile);
|
||||
consumed = true;
|
||||
showedInventory = true;
|
||||
@ -953,7 +953,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
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);
|
||||
}else{
|
||||
Call.dropItem(player.angleTo(x, y));
|
||||
|
@ -558,7 +558,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
//ignore off-screen taps
|
||||
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()){
|
||||
checkTargets(worldx, worldy);
|
||||
|
@ -42,7 +42,13 @@ public abstract class SaveFileReader{
|
||||
"shalerocks", "shale-wall",
|
||||
"snowrocks", "snow-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();
|
||||
|
@ -54,7 +54,7 @@ public abstract class LegacySaveVersion extends SaveVersion{
|
||||
if(block == null) block = Blocks.air;
|
||||
|
||||
//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
|
||||
if(!occupied){
|
||||
|
@ -292,25 +292,29 @@ public class Maps{
|
||||
if(str == null || str.isEmpty()){
|
||||
//create default filters list
|
||||
Seq<GenerateFilter> filters = Seq.with(
|
||||
new ScatterFilter(){{
|
||||
flooronto = Blocks.stone;
|
||||
block = Blocks.rock;
|
||||
}},
|
||||
new ScatterFilter(){{
|
||||
flooronto = Blocks.shale;
|
||||
block = Blocks.shaleBoulder;
|
||||
}},
|
||||
new ScatterFilter(){{
|
||||
flooronto = Blocks.snow;
|
||||
block = Blocks.snowrock;
|
||||
block = Blocks.snowBoulder;
|
||||
}},
|
||||
new ScatterFilter(){{
|
||||
flooronto = Blocks.ice;
|
||||
block = Blocks.snowrock;
|
||||
block = Blocks.snowBoulder;
|
||||
}},
|
||||
new ScatterFilter(){{
|
||||
flooronto = Blocks.sand;
|
||||
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;
|
||||
}}
|
||||
);
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class BaseGenerator{
|
||||
//fill core with every type of item (even non-material)
|
||||
Building entity = tile.build;
|
||||
for(Item item : content.items()){
|
||||
entity.items.add(item, entity.block().itemCapacity);
|
||||
entity.items.add(item, entity.block.itemCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.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.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.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.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},
|
||||
|
@ -61,7 +61,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
}
|
||||
|
||||
table.setOrigin(Align.center);
|
||||
if(configTile == null || configTile.block() == Blocks.air || !configTile.isValid()){
|
||||
if(configTile == null || configTile.block == Blocks.air || !configTile.isValid()){
|
||||
hideConfig();
|
||||
}else{
|
||||
configTile.updateTableAlign(table);
|
||||
|
@ -79,7 +79,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
return;
|
||||
}
|
||||
this.tile = t;
|
||||
if(tile == null || !tile.block().isAccessible() || tile.items.total() == 0)
|
||||
if(tile == null || !tile.block.isAccessible() || tile.items.total() == 0)
|
||||
return;
|
||||
rebuild(true);
|
||||
}
|
||||
@ -108,7 +108,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
table.touchable = Touchable.enabled;
|
||||
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();
|
||||
}else{
|
||||
if(tile.items.total() == 0){
|
||||
@ -131,7 +131,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
}
|
||||
|
||||
updateTablePosition();
|
||||
if(tile.block().hasItems){
|
||||
if(tile.block.hasItems){
|
||||
boolean dirty = false;
|
||||
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.defaults().size(8 * 5).pad(4f);
|
||||
|
||||
if(tile.block().hasItems){
|
||||
if(tile.block.hasItems){
|
||||
|
||||
for(int i = 0; i < content.items().size; i++){
|
||||
Item item = content.item(i);
|
||||
@ -233,7 +233,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
}
|
||||
|
||||
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.setPosition(v.x, v.y, Align.topLeft);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class PlacementFragment extends Fragment{
|
||||
|
||||
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
|
||||
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();
|
||||
|
||||
for(BuildPlan req : player.builder().plans()){
|
||||
|
@ -51,7 +51,7 @@ public class Edges{
|
||||
}
|
||||
|
||||
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){
|
||||
|
@ -456,7 +456,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
build.removeFromProximity();
|
||||
|
||||
//remove this tile's dangling entities
|
||||
if(build.block().isMultiblock()){
|
||||
if(build.block.isMultiblock()){
|
||||
int cx = build.tileX(), cy = build.tileY();
|
||||
int size = build.block.size;
|
||||
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
|
||||
for(Point2 p : Geometry.d4){
|
||||
Building tile = world.build(x + p.x, y + p.y);
|
||||
if(tile != null && !tile.tile().changing){
|
||||
if(tile != null && !tile.tile.changing){
|
||||
tile.onProximityUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public interface Autotiler{
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ public interface Autotiler{
|
||||
|
||||
default boolean blends(Tile tile, int rotation, int direction){
|
||||
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){
|
||||
|
@ -77,7 +77,7 @@ public class MendProjector extends Block{
|
||||
|
||||
indexer.eachBlock(this, realRange, other -> other.damaged(), other -> {
|
||||
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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class OverdriveProjector extends Block{
|
||||
public void drawSelect(){
|
||||
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);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class ArmoredConveyor extends Conveyor{
|
||||
public class ArmoredConveyorBuild extends ConveyorBuild{
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,9 +289,9 @@ public class Conveyor extends Block implements Autotiler{
|
||||
@Override
|
||||
public boolean acceptItem(Building source, Item item){
|
||||
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);
|
||||
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
|
||||
@ -299,7 +299,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
if(len >= capacity) return;
|
||||
|
||||
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));
|
||||
float x = (ang == -1 || ang == 3) ? 1 : (ang == 1 || ang == -3) ? -1 : 0;
|
||||
|
||||
|
@ -214,7 +214,7 @@ public class ItemBridge extends Block{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(linkValid(tile, other.tile())){
|
||||
if(linkValid(tile, other.tile)){
|
||||
if(link == other.pos()){
|
||||
configure(-1);
|
||||
}else{
|
||||
@ -358,7 +358,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
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
|
||||
@ -369,7 +369,7 @@ public class ItemBridge extends Block{
|
||||
protected boolean checkDump(Building to){
|
||||
Tile other = world.tile(link);
|
||||
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);
|
||||
|
||||
IntSetIterator it = incoming.iterator();
|
||||
|
@ -62,7 +62,7 @@ public class MassDriver extends Block{
|
||||
//check if a mass driver is selected while placing this driver
|
||||
if(!control.input.frag.config.isShown()) return;
|
||||
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
|
||||
float sin = Mathf.absin(Time.time(), 6f, 1f);
|
||||
@ -155,7 +155,7 @@ public class MassDriver extends Block{
|
||||
|
||||
if(
|
||||
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;
|
||||
other.waitingShooters.add(tile);
|
||||
@ -225,7 +225,7 @@ public class MassDriver extends Block{
|
||||
if(link == other.pos()){
|
||||
configure(-1);
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
|
@ -91,14 +91,14 @@ public class OverflowGate extends Block{
|
||||
int from = relativeToEdge(src);
|
||||
if(from == -1) return null;
|
||||
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;
|
||||
|
||||
if(!canForward || inv){
|
||||
Building a = 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 bc = b != null && b.acceptItem(this, item) && !(b.block() instanceof OverflowGate) && b.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;
|
||||
|
||||
if(!ac && !bc){
|
||||
return inv && canForward ? to : null;
|
||||
|
@ -43,8 +43,8 @@ public class PayloadConveyor extends Block{
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
Building other = world.build(x + Geometry.d4x[i] * size, y + Geometry.d4y[i] * size);
|
||||
if(other != null && other.block().outputsPayload && other.block().size == size){
|
||||
Drawf.selected(other.tileX(), other.tileY(), other.block(), Pal.accent);
|
||||
if(other != null && other.block.outputsPayload && other.block.size == size){
|
||||
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
|
||||
if(accept != null && (
|
||||
//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
|
||||
(accept.block().size > size &&
|
||||
(accept.block.size > size &&
|
||||
(rotation % 2 == 0 ? //check orientation
|
||||
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.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
|
||||
)))){
|
||||
next = accept;
|
||||
}else{
|
||||
|
@ -35,7 +35,7 @@ public class Router extends Block{
|
||||
time += 1f / speed * delta();
|
||||
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);
|
||||
target.handleItem(this, lastItem);
|
||||
items.remove(lastItem, 1);
|
||||
|
@ -88,7 +88,7 @@ public class Sorter extends Block{
|
||||
|
||||
public boolean isSame(Building other){
|
||||
// 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){
|
||||
@ -105,9 +105,9 @@ public class Sorter extends Block{
|
||||
}else{
|
||||
Building a = 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);
|
||||
boolean bc = b != null && !(b.block().instantTransfer && source.block().instantTransfer) &&
|
||||
boolean bc = b != null && !(b.block.instantTransfer && source.block.instantTransfer) &&
|
||||
b.acceptItem(this, item);
|
||||
|
||||
if(ac && !bc){
|
||||
|
@ -7,10 +7,10 @@ import arc.math.Mathf;
|
||||
import mindustry.world.Block;
|
||||
import mindustry.world.Tile;
|
||||
|
||||
public class Rock extends Block{
|
||||
public class Boulder extends Block{
|
||||
protected int variants;
|
||||
|
||||
public Rock(String name){
|
||||
public Boulder(String name){
|
||||
super(name);
|
||||
breakable = true;
|
||||
alwaysReplace = true;
|
@ -112,7 +112,7 @@ public class Floor extends Block{
|
||||
if(wall == null) wall = 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.world;
|
||||
|
||||
public class StaticWall extends Rock{
|
||||
public class StaticWall extends Boulder{
|
||||
public @Load("@-large") TextureRegion large;
|
||||
public TextureRegion[][] split;
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class BlockLoader extends PayloadAcceptor{
|
||||
public boolean acceptPayload(Building source, Payload payload){
|
||||
return super.acceptPayload(source, payload) &&
|
||||
(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)*/);
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public class BlockLoader extends PayloadAcceptor{
|
||||
}
|
||||
|
||||
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(){
|
||||
|
@ -56,7 +56,7 @@ public class BlockUnloader extends BlockLoader{
|
||||
|
||||
@Override
|
||||
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
|
||||
|
@ -26,14 +26,14 @@ public class ArmoredConduit extends Conduit{
|
||||
|
||||
// draw the cap when a conduit would normally leak
|
||||
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());
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class LiquidJunction extends LiquidBlock{
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir + 4) % 4;
|
||||
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 next.getLiquidDestination(this, liquid);
|
||||
|
@ -22,7 +22,7 @@ public class BlockPayload implements Payload{
|
||||
}
|
||||
|
||||
public Block block(){
|
||||
return entity.block();
|
||||
return entity.block;
|
||||
}
|
||||
|
||||
public void place(Tile tile){
|
||||
@ -30,7 +30,7 @@ public class BlockPayload implements Payload{
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class BlockPayload implements Payload{
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
write.b(payloadBlock);
|
||||
write.s(entity.block().id);
|
||||
write.s(entity.block.id);
|
||||
write.b(entity.version());
|
||||
entity.writeAll(write);
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class BlockPayload implements Payload{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Drawf.shadow(entity.x, entity.y, entity.block().size * tilesize * 2f);
|
||||
Draw.rect(entity.block().icon(Cicon.full), entity.x, entity.y);
|
||||
Drawf.shadow(entity.x, entity.y, entity.block.size * tilesize * 2f);
|
||||
Draw.rect(entity.block.icon(Cicon.full), entity.x, entity.y);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class PowerDiode extends Block{
|
||||
|
||||
// battery % of the graph on either side, defaults to zero
|
||||
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{
|
||||
@ -54,7 +54,7 @@ public class PowerDiode extends Block{
|
||||
public void 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 frontGraph = front().power.graph;
|
||||
|
@ -74,7 +74,7 @@ public class PowerGraph{
|
||||
public float getPowerNeeded(){
|
||||
float powerNeeded = 0f;
|
||||
for(Building consumer : consumers){
|
||||
Consumers consumes = consumer.block().consumes;
|
||||
Consumers consumes = consumer.block.consumes;
|
||||
if(consumes.hasPower()){
|
||||
ConsumePower consumePower = consumes.getPower();
|
||||
if(otherConsumersAreValid(consumer, consumePower)){
|
||||
@ -88,7 +88,7 @@ public class PowerGraph{
|
||||
public float getBatteryStored(){
|
||||
float totalAccumulator = 0f;
|
||||
for(Building battery : batteries){
|
||||
Consumers consumes = battery.block().consumes;
|
||||
Consumers consumes = battery.block.consumes;
|
||||
if(consumes.hasPower()){
|
||||
totalAccumulator += battery.power.status * consumes.getPower().capacity;
|
||||
}
|
||||
@ -99,8 +99,8 @@ public class PowerGraph{
|
||||
public float getBatteryCapacity(){
|
||||
float totalCapacity = 0f;
|
||||
for(Building battery : batteries){
|
||||
if(battery.block().consumes.hasPower()){
|
||||
ConsumePower power = battery.block().consumes.getPower();
|
||||
if(battery.block.consumes.hasPower()){
|
||||
ConsumePower power = battery.block.consumes.getPower();
|
||||
totalCapacity += (1f - battery.power.status) * power.capacity;
|
||||
}
|
||||
}
|
||||
@ -110,8 +110,8 @@ public class PowerGraph{
|
||||
public float getTotalBatteryCapacity(){
|
||||
float totalCapacity = 0f;
|
||||
for(Building battery : batteries){
|
||||
if(battery.block().consumes.hasPower()){
|
||||
totalCapacity += battery.block().consumes.getPower().capacity;
|
||||
if(battery.block.consumes.hasPower()){
|
||||
totalCapacity += battery.block.consumes.getPower().capacity;
|
||||
}
|
||||
}
|
||||
return totalCapacity;
|
||||
@ -124,7 +124,7 @@ public class PowerGraph{
|
||||
float used = Math.min(stored, needed);
|
||||
float consumedPowerPercentage = Math.min(1.0f, needed / stored);
|
||||
for(Building battery : batteries){
|
||||
Consumers consumes = battery.block().consumes;
|
||||
Consumers consumes = battery.block.consumes;
|
||||
if(consumes.hasPower()){
|
||||
battery.power.status *= (1f-consumedPowerPercentage);
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class PowerGraph{
|
||||
if(Mathf.equal(capacity, 0f)) return 0f;
|
||||
|
||||
for(Building battery : batteries){
|
||||
Consumers consumes = battery.block().consumes;
|
||||
Consumers consumes = battery.block.consumes;
|
||||
if(consumes.hasPower()){
|
||||
ConsumePower consumePower = consumes.getPower();
|
||||
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
|
||||
float coverage = Mathf.zero(needed) && Mathf.zero(produced) ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed);
|
||||
for(Building consumer : consumers){
|
||||
Consumers consumes = consumer.block().consumes;
|
||||
Consumers consumes = consumer.block.consumes;
|
||||
if(consumes.hasPower()){
|
||||
ConsumePower consumePower = consumes.getPower();
|
||||
if(consumePower.buffered){
|
||||
@ -237,14 +237,14 @@ public class PowerGraph{
|
||||
tile.power.graph = this;
|
||||
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);
|
||||
consumers.add(tile);
|
||||
}else if(tile.block().outputsPower && tile.block().consumesPower){
|
||||
}else if(tile.block.outputsPower && tile.block.consumesPower){
|
||||
batteries.add(tile);
|
||||
}else if(tile.block().outputsPower){
|
||||
}else if(tile.block.outputsPower){
|
||||
producers.add(tile);
|
||||
}else if(tile.block().consumesPower){
|
||||
}else if(tile.block.consumesPower){
|
||||
consumers.add(tile);
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ public class PowerGraph{
|
||||
}
|
||||
|
||||
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)){
|
||||
return false;
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ public class PowerNode extends PowerBlock{
|
||||
Drawf.circles(x * tilesize + offset, y * tilesize + offset, laserRange * tilesize);
|
||||
|
||||
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 -> {
|
||||
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){
|
||||
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()
|
||||
&& !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();
|
||||
graphs.clear();
|
||||
@ -203,7 +203,7 @@ public class PowerNode extends PowerBlock{
|
||||
});
|
||||
|
||||
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;
|
||||
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){
|
||||
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(checkMaxNodes && link.block() instanceof PowerNode){
|
||||
return link.power.links.size < ((PowerNode)link.block()).maxNodes || link.power.links.contains(tile.pos());
|
||||
if(overlaps(tile, link, laserRange * tilesize) || (link.block instanceof PowerNode && overlaps(link, tile, ((PowerNode)link.block).laserRange * tilesize))){
|
||||
if(checkMaxNodes && link.block instanceof PowerNode){
|
||||
return link.power.links.size < ((PowerNode)link.block).maxNodes || link.power.links.contains(tile.pos());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -266,7 +266,7 @@ public class PowerNode extends PowerBlock{
|
||||
world.raycastEach(x, y, x2, y2, (wx, wy) -> {
|
||||
|
||||
Building tile = world.build(wx, wy);
|
||||
if(tile != null && tile.block().insulated){
|
||||
if(tile != null && tile.block.insulated){
|
||||
iterator.get(tile);
|
||||
}
|
||||
|
||||
@ -280,8 +280,8 @@ public class PowerNode extends PowerBlock{
|
||||
public void placed(){
|
||||
if(net.client()) return;
|
||||
|
||||
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)
|
||||
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.proximity().contains(this) && other.power.graph != power.graph;
|
||||
|
||||
tempTileEnts.clear();
|
||||
@ -295,7 +295,7 @@ public class PowerNode extends PowerBlock{
|
||||
});
|
||||
|
||||
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;
|
||||
return Float.compare(a.dst2(tile), b.dst2(tile));
|
||||
});
|
||||
@ -373,7 +373,7 @@ public class PowerNode extends PowerBlock{
|
||||
boolean linked = linked(link);
|
||||
|
||||
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(link.block() instanceof PowerNode && !(link.pos() < tile.pos())) continue;
|
||||
if(link.block instanceof PowerNode && !(link.pos() < tile.pos())) continue;
|
||||
|
||||
drawLaserTo(link);
|
||||
}
|
||||
@ -408,7 +408,7 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -28,22 +28,22 @@ public class PayloadAcceptor extends Block{
|
||||
}
|
||||
|
||||
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);
|
||||
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
|
||||
((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.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
|
||||
(accept.block().size < size &&
|
||||
(accept.block.size < size &&
|
||||
(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.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
|
||||
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
|
||||
)) && (!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);
|
||||
|
||||
Building front = front();
|
||||
if(front != null && front.block().outputsPayload){
|
||||
if(front != null && front.block.outputsPayload){
|
||||
if(movePayload(payload)){
|
||||
payload = null;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
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 -> {
|
||||
t.items = items;
|
||||
((StorageBuild)t).linkedCore = this;
|
||||
@ -218,7 +218,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
for(Building other : state.teams.cores(team)){
|
||||
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()){
|
||||
@ -238,7 +238,7 @@ public class CoreBlock extends StorageBlock{
|
||||
Cons<Building> outline = t -> {
|
||||
for(int i = 0; i < 4; 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);
|
||||
}
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ public class Unloader extends Block{
|
||||
public void updateTile(){
|
||||
if(timer(timerUnload, speed / timeScale())){
|
||||
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)))){
|
||||
//make sure the item can't be dumped back into this block
|
||||
dumpingTo = other;
|
||||
@ -99,7 +99,7 @@ public class Unloader extends Block{
|
||||
|
||||
@Override
|
||||
public boolean canDump(Building to, Item item){
|
||||
return !(to.block() instanceof StorageBlock) && to != dumpingTo;
|
||||
return !(to.block instanceof StorageBlock) && to != dumpingTo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,6 @@ public abstract class ConsumeLiquidBase extends Consume{
|
||||
}
|
||||
|
||||
protected float use(Building entity){
|
||||
return Math.min(amount * entity.delta(), entity.block().liquidCapacity);
|
||||
return Math.min(amount * entity.delta(), entity.block.liquidCapacity);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class ConsumeModule extends BlockModule{
|
||||
optionalValid = true;
|
||||
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(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
||||
@ -47,7 +47,7 @@ public class ConsumeModule extends BlockModule{
|
||||
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)){
|
||||
cons.update(entity);
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class ConsumeModule extends BlockModule{
|
||||
}
|
||||
|
||||
public void trigger(){
|
||||
for(Consume cons : entity.block().consumes.all()){
|
||||
for(Consume cons : entity.block.consumes.all()){
|
||||
cons.trigger(entity);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class SStats implements SteamUserStatsCallback{
|
||||
}
|
||||
|
||||
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();
|
||||
break;
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class SStats implements SteamUserStatsCallback{
|
||||
if(campaign() && e.unit != null && e.unit.isLocal() && !e.breaking){
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ public class ServerControl implements ApplicationListener{
|
||||
}
|
||||
|
||||
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.");
|
||||
|
@ -574,7 +574,7 @@ public class ApplicationTests{
|
||||
}catch(Throwable 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());
|
||||
}
|
||||
}
|
||||
|