Logic fixes / Bigger erekir sectors
This commit is contained in:
@@ -94,11 +94,12 @@ android{
|
|||||||
|
|
||||||
buildTypes{
|
buildTypes{
|
||||||
all{
|
all{
|
||||||
|
//TODO without these lines (r8 enabled), Mindustry crashes with missing default interface method errors.
|
||||||
|
//WHY THE HELL ARE DEFAULT INTERFACES NOT BEING DESUGARED? WHY DID UPDATING AGP MAKE THIS HAPPEN?
|
||||||
|
//When I ENABLE shrinking, r8 goes and REMOVES ALL DEFAULT INTERFACE CLASSES, which breaks mods. Why?
|
||||||
|
//-keep class mindustry.** { *; } should *keep the classes* - WHY IS R8 REMOVING THEM?
|
||||||
minifyEnabled = true
|
minifyEnabled = true
|
||||||
shrinkResources = true
|
shrinkResources = true
|
||||||
//this is the ONLY WAY I could find to force r8 to keep its filthy hands off of my default interfaces.
|
|
||||||
//may have undesirable side effects
|
|
||||||
debuggable = true
|
|
||||||
proguardFiles("proguard-rules.pro")
|
proguardFiles("proguard-rules.pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
core/assets-raw/sprites/blocks/logic/world-cell.png
Normal file
BIN
core/assets-raw/sprites/blocks/logic/world-cell.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 373 B |
@@ -17,6 +17,7 @@ import static mindustry.Vars.*;
|
|||||||
import static mindustry.ai.Pathfinder.*;
|
import static mindustry.ai.Pathfinder.*;
|
||||||
|
|
||||||
public class ControlPathfinder{
|
public class ControlPathfinder{
|
||||||
|
//TODO this FPS-based update system could be flawed.
|
||||||
private static final long maxUpdate = Time.millisToNanos(20);
|
private static final long maxUpdate = Time.millisToNanos(20);
|
||||||
private static final int updateFPS = 60;
|
private static final int updateFPS = 60;
|
||||||
private static final int updateInterval = 1000 / updateFPS;
|
private static final int updateInterval = 1000 / updateFPS;
|
||||||
@@ -316,7 +317,7 @@ public class ControlPathfinder{
|
|||||||
int ww = world.width(), wh = world.height();
|
int ww = world.width(), wh = world.height();
|
||||||
int x = x1, dx = Math.abs(x2 - x), sx = x < x2 ? 1 : -1;
|
int x = x1, dx = Math.abs(x2 - x), sx = x < x2 ? 1 : -1;
|
||||||
int y = y1, dy = Math.abs(y2 - y), sy = y < y2 ? 1 : -1;
|
int y = y1, dy = Math.abs(y2 - y), sy = y < y2 ? 1 : -1;
|
||||||
int e2, err = dx - dy;
|
int err = dx - dy;
|
||||||
|
|
||||||
while(x >= 0 && y >= 0 && x < ww && y < wh){
|
while(x >= 0 && y >= 0 && x < ww && y < wh){
|
||||||
if(solid(type, x + y * wwidth)) return true;
|
if(solid(type, x + y * wwidth)) return true;
|
||||||
@@ -455,7 +456,7 @@ public class ControlPathfinder{
|
|||||||
}
|
}
|
||||||
lastId = curId;
|
lastId = curId;
|
||||||
|
|
||||||
//re-do everything when world updates
|
//re-do everything when world updates, but keep the old path around
|
||||||
if(Time.timeSinceMillis(lastTime) > 1000 * 3 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f))){
|
if(Time.timeSinceMillis(lastTime) > 1000 * 3 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f))){
|
||||||
lastTime = Time.millis();
|
lastTime = Time.millis();
|
||||||
lastWorldUpdate = worldUpdateId;
|
lastWorldUpdate = worldUpdateId;
|
||||||
@@ -466,7 +467,6 @@ public class ControlPathfinder{
|
|||||||
|
|
||||||
long ns = Time.nanos();
|
long ns = Time.nanos();
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
//Log.info("running; @ in frontier", frontier.size);
|
|
||||||
|
|
||||||
while(frontier.size > 0){
|
while(frontier.size > 0){
|
||||||
int current = frontier.poll();
|
int current = frontier.poll();
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class Blocks{
|
|||||||
|
|
||||||
//logic
|
//logic
|
||||||
message, switchBlock, microProcessor, logicProcessor, hyperProcessor, largeLogicDisplay, logicDisplay, memoryCell, memoryBank,
|
message, switchBlock, microProcessor, logicProcessor, hyperProcessor, largeLogicDisplay, logicDisplay, memoryCell, memoryBank,
|
||||||
worldProcessor,
|
worldProcessor, worldCell,
|
||||||
|
|
||||||
//campaign
|
//campaign
|
||||||
//TODO launch pad on erekir, 5x5, uses nuclear(?) fuel
|
//TODO launch pad on erekir, 5x5, uses nuclear(?) fuel
|
||||||
@@ -3853,7 +3853,6 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
worldProcessor = new LogicBlock("world-processor"){{
|
worldProcessor = new LogicBlock("world-processor"){{
|
||||||
//currently incomplete, debugOnly for now
|
|
||||||
requirements(Category.logic, BuildVisibility.editorOnly, with());
|
requirements(Category.logic, BuildVisibility.editorOnly, with());
|
||||||
|
|
||||||
//TODO customizable IPT
|
//TODO customizable IPT
|
||||||
@@ -3864,6 +3863,13 @@ public class Blocks{
|
|||||||
size = 1;
|
size = 1;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
worldCell = new MemoryBlock("world-cell"){{
|
||||||
|
requirements(Category.logic, BuildVisibility.editorOnly, with());
|
||||||
|
|
||||||
|
privileged = true;
|
||||||
|
memoryCapacity = 128;
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,7 +504,7 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(state.hasSector() && state.getSector().preset == null){
|
if(state.hasSector() && state.getSector().preset == null){
|
||||||
int circleBlend = 14;
|
int circleBlend = 7;
|
||||||
//quantized angle
|
//quantized angle
|
||||||
float offset = state.getSector().rect.rotation + 90;
|
float offset = state.getSector().rect.rotation + 90;
|
||||||
float angle = Angles.angle(x, y, tiles.width/2, tiles.height/2) + offset;
|
float angle = Angles.angle(x, y, tiles.width/2, tiles.height/2) + offset;
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class MinimapRenderer{
|
|||||||
|
|
||||||
TextureRegion icon = Icon.units.getRegion();
|
TextureRegion icon = Icon.units.getRegion();
|
||||||
|
|
||||||
Lines.stroke(3f);
|
Lines.stroke(Scl.scl(3f));
|
||||||
|
|
||||||
Draw.color(state.rules.waveTeam.color, Tmp.c2.set(state.rules.waveTeam.color).value(1.2f), Mathf.absin(Time.time, 16f, 1f));
|
Draw.color(state.rules.waveTeam.color, Tmp.c2.set(state.rules.waveTeam.color).value(1.2f), Mathf.absin(Time.time, 16f, 1f));
|
||||||
|
|
||||||
|
|||||||
@@ -1208,19 +1208,21 @@ public class LExecutor{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(LExecutor exec){
|
public void run(LExecutor exec){
|
||||||
|
if(net.client()) return;
|
||||||
|
|
||||||
Tile tile = world.tile(exec.numi(x), exec.numi(y));
|
Tile tile = world.tile(exec.numi(x), exec.numi(y));
|
||||||
if(tile != null && exec.obj(block) instanceof Block b){
|
if(tile != null && exec.obj(block) instanceof Block b){
|
||||||
//TODO this can be quite laggy...
|
//TODO this can be quite laggy...
|
||||||
switch(layer){
|
switch(layer){
|
||||||
case ore -> {
|
case ore -> {
|
||||||
if(b instanceof OverlayFloor o) tile.setOverlay(o);
|
if(b instanceof OverlayFloor o) tile.setOverlayNet(o);
|
||||||
}
|
}
|
||||||
case floor -> {
|
case floor -> {
|
||||||
if(b instanceof Floor f) tile.setFloor(f);
|
if(b instanceof Floor f) tile.setFloorNet(f);
|
||||||
}
|
}
|
||||||
case block -> {
|
case block -> {
|
||||||
Team t = exec.obj(team) instanceof Team steam ? steam : Team.derelict;
|
Team t = exec.obj(team) instanceof Team steam ? steam : Team.derelict;
|
||||||
tile.setBlock(b, t, Mathf.clamp(exec.numi(rotation), 0, 3));
|
tile.setNet(b, t, Mathf.clamp(exec.numi(rotation), 0, 3));
|
||||||
}
|
}
|
||||||
//building case not allowed
|
//building case not allowed
|
||||||
}
|
}
|
||||||
@@ -1230,7 +1232,6 @@ public class LExecutor{
|
|||||||
|
|
||||||
public static class SpawnUnitI implements LInstruction{
|
public static class SpawnUnitI implements LInstruction{
|
||||||
public int type, x, y, rotation, team, result;
|
public int type, x, y, rotation, team, result;
|
||||||
public boolean effect;
|
|
||||||
|
|
||||||
public SpawnUnitI(int type, int x, int y, int rotation, int team, boolean effect, int result){
|
public SpawnUnitI(int type, int x, int y, int rotation, int team, boolean effect, int result){
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -1238,7 +1239,6 @@ public class LExecutor{
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
||||||
this.team = team;
|
this.team = team;
|
||||||
this.effect = effect;
|
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1247,13 +1247,13 @@ public class LExecutor{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(LExecutor exec){
|
public void run(LExecutor exec){
|
||||||
|
if(net.client()) return;
|
||||||
|
|
||||||
if(exec.obj(type) instanceof UnitType type && !type.hidden && exec.obj(team) instanceof Team team && Units.canCreate(team, type)){
|
if(exec.obj(type) instanceof UnitType type && !type.hidden && exec.obj(team) instanceof Team team && Units.canCreate(team, type)){
|
||||||
//random offset to prevent stacking
|
//random offset to prevent stacking
|
||||||
var unit = type.spawn(team, World.unconv(exec.numf(x)) + Mathf.range(0.01f), World.unconv(exec.numf(y)) + Mathf.range(0.01f));
|
var unit = type.spawn(team, World.unconv(exec.numf(x)) + Mathf.range(0.01f), World.unconv(exec.numf(y)) + Mathf.range(0.01f));
|
||||||
unit.rotation = exec.numf(rotation);
|
unit.rotation = exec.numf(rotation);
|
||||||
if(effect){
|
spawner.spawnEffect(unit);
|
||||||
spawner.spawnEffect(unit);
|
|
||||||
}
|
|
||||||
exec.setobj(result, unit);
|
exec.setobj(result, unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,16 +141,20 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
|
|||||||
this.tiles = tiles;
|
this.tiles = tiles;
|
||||||
this.seed = seed + baseSeed;
|
this.seed = seed + baseSeed;
|
||||||
this.sector = sec;
|
this.sector = sec;
|
||||||
|
this.width = tiles.width;
|
||||||
|
this.height = tiles.height;
|
||||||
this.rand.setSeed(sec.id + seed + baseSeed);
|
this.rand.setSeed(sec.id + seed + baseSeed);
|
||||||
|
|
||||||
TileGen gen = new TileGen();
|
TileGen gen = new TileGen();
|
||||||
tiles.each((x, y) -> {
|
for(int y = 0; y < height; y++){
|
||||||
gen.reset();
|
for(int x = 0; x < width; x++){
|
||||||
Vec3 position = sector.rect.project(x / (float)tiles.width, y / (float)tiles.height);
|
gen.reset();
|
||||||
|
Vec3 position = sector.rect.project(x / (float)tiles.width, y / (float)tiles.height);
|
||||||
|
|
||||||
genTile(position, gen);
|
genTile(position, gen);
|
||||||
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
generate(tiles);
|
generate(tiles);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getSizeScl(){
|
public float getSizeScl(){
|
||||||
return 2000 * 1.06f;
|
//TODO should sectors be 600, or 500 blocks?
|
||||||
|
return 2000 * 1.07f * 6f / 5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,8 +140,50 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private @Nullable String lastSec;
|
||||||
|
|
||||||
|
private void sec(String name){
|
||||||
|
if(lastSec != null){
|
||||||
|
float elapsed = Time.elapsed();
|
||||||
|
Log.info("@: @ (@ sec)", lastSec.toUpperCase(), elapsed, Strings.fixed(elapsed / 1000f, 2));
|
||||||
|
}
|
||||||
|
if(name != null){
|
||||||
|
Time.mark();
|
||||||
|
}
|
||||||
|
lastSec = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO remove
|
||||||
|
@Override
|
||||||
|
public void generate(Tiles tiles, Sector sec, int seed){
|
||||||
|
this.tiles = tiles;
|
||||||
|
this.seed = seed + baseSeed;
|
||||||
|
this.sector = sec;
|
||||||
|
this.width = tiles.width;
|
||||||
|
this.height = tiles.height;
|
||||||
|
this.rand.setSeed(sec.id + seed + baseSeed);
|
||||||
|
|
||||||
|
long begin = Time.millis();
|
||||||
|
sec("genTile");
|
||||||
|
|
||||||
|
TileGen gen = new TileGen();
|
||||||
|
for(int y = 0; y < height; y++){
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
gen.reset();
|
||||||
|
Vec3 position = sector.rect.project(x / (float)tiles.width, y / (float)tiles.height);
|
||||||
|
|
||||||
|
genTile(position, gen);
|
||||||
|
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
generate(tiles);
|
||||||
|
Log.info("TOTAL TILE: @ (@ sec)", Time.timeSinceMillis(begin), Strings.fixed(Time.timeSinceMillis(begin) / 1000f, 2));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generate(){
|
protected void generate(){
|
||||||
|
sec("tempPass");
|
||||||
float temp = rawTemp(sector.tile.v);
|
float temp = rawTemp(sector.tile.v);
|
||||||
|
|
||||||
if(temp > 0.7){
|
if(temp > 0.7){
|
||||||
@@ -165,6 +208,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sec("cells1");
|
||||||
|
|
||||||
cells(4);
|
cells(4);
|
||||||
|
|
||||||
//regolith walls for more dense terrain
|
//regolith walls for more dense terrain
|
||||||
@@ -175,7 +220,6 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
});
|
});
|
||||||
|
|
||||||
//TODO: yellow regolith biome tweaks
|
//TODO: yellow regolith biome tweaks
|
||||||
//TODO: crystal biome on the dark side w/ terrain tweaks
|
|
||||||
//TODO ice biome
|
//TODO ice biome
|
||||||
|
|
||||||
float length = width/3f;
|
float length = width/3f;
|
||||||
@@ -185,10 +229,14 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
endX = (int)(-trns.x + width/2f), endY = (int)(-trns.y + height/2f);
|
endX = (int)(-trns.x + width/2f), endY = (int)(-trns.y + height/2f);
|
||||||
float maxd = Mathf.dst(width/2f, height/2f);
|
float maxd = Mathf.dst(width/2f, height/2f);
|
||||||
|
|
||||||
|
sec("pathfinding");
|
||||||
|
|
||||||
erase(spawnX, spawnY, 15);
|
erase(spawnX, spawnY, 15);
|
||||||
brush(pathfind(spawnX, spawnY, endX, endY, tile -> (tile.solid() ? 300f : 0f) + maxd - tile.dst(width/2f, height/2f)/10f, Astar.manhattan), 9);
|
brush(pathfind(spawnX, spawnY, endX, endY, tile -> (tile.solid() ? 300f : 0f) + maxd - tile.dst(width/2f, height/2f)/10f, Astar.manhattan), 9);
|
||||||
erase(endX, endY, 15);
|
erase(endX, endY, 15);
|
||||||
|
|
||||||
|
sec("arkycite");
|
||||||
|
|
||||||
//arkycite
|
//arkycite
|
||||||
pass((x, y) -> {
|
pass((x, y) -> {
|
||||||
if(floor != Blocks.beryllicStone) return;
|
if(floor != Blocks.beryllicStone) return;
|
||||||
@@ -211,19 +259,26 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
blend(Blocks.arkyciteFloor, Blocks.arkyicStone, 4);
|
blend(Blocks.arkyciteFloor, Blocks.arkyicStone, 4);
|
||||||
|
|
||||||
|
sec("slag");
|
||||||
|
|
||||||
//TODO may overwrite floor blocks under walls and look bad
|
//TODO may overwrite floor blocks under walls and look bad
|
||||||
blend(Blocks.slag, Blocks.yellowStonePlates, 4);
|
blend(Blocks.slag, Blocks.yellowStonePlates, 4);
|
||||||
|
|
||||||
distort(10f, 12f);
|
sec("distort");
|
||||||
|
|
||||||
|
distort(10f, 12f);
|
||||||
distort(5f, 7f);
|
distort(5f, 7f);
|
||||||
|
|
||||||
|
sec("arkycite-slag-median");
|
||||||
|
|
||||||
//does arkycite need smoothing?
|
//does arkycite need smoothing?
|
||||||
median(2, 0.6, Blocks.arkyciteFloor);
|
median(2, 0.6, Blocks.arkyciteFloor);
|
||||||
|
|
||||||
//smooth out slag to prevent random 1-tile patches
|
//smooth out slag to prevent random 1-tile patches
|
||||||
median(3, 0.6, Blocks.slag);
|
median(3, 0.6, Blocks.slag);
|
||||||
|
|
||||||
|
sec("details 1");
|
||||||
|
|
||||||
pass((x, y) -> {
|
pass((x, y) -> {
|
||||||
//rough rhyolite
|
//rough rhyolite
|
||||||
if(noise(x, y + 600 + x, 5, 0.86f, 60f, 1f) < 0.41f && floor == Blocks.rhyolite){
|
if(noise(x, y + 600 + x, 5, 0.86f, 60f, 1f) < 0.41f && floor == Blocks.rhyolite){
|
||||||
@@ -240,6 +295,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
float max = 0;
|
float max = 0;
|
||||||
for(Point2 p : Geometry.d8){
|
for(Point2 p : Geometry.d8){
|
||||||
|
//TODO I think this is the cause of lag
|
||||||
max = Math.max(max, world.getDarkness(x + p.x, y + p.y));
|
max = Math.max(max, world.getDarkness(x + p.x, y + p.y));
|
||||||
}
|
}
|
||||||
if(max > 0){
|
if(max > 0){
|
||||||
@@ -256,11 +312,17 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sec("inverse flood fill");
|
||||||
|
|
||||||
inverseFloodFill(tiles.getn(spawnX, spawnY));
|
inverseFloodFill(tiles.getn(spawnX, spawnY));
|
||||||
|
|
||||||
|
sec("redStone");
|
||||||
|
|
||||||
//TODO veins, blend after inverse flood fill?
|
//TODO veins, blend after inverse flood fill?
|
||||||
blend(Blocks.redStoneWall, Blocks.denseRedStone, 4);
|
blend(Blocks.redStoneWall, Blocks.denseRedStone, 4);
|
||||||
|
|
||||||
|
sec("ores");
|
||||||
|
|
||||||
//make sure enemies have room
|
//make sure enemies have room
|
||||||
erase(endX, endY, 6);
|
erase(endX, endY, 6);
|
||||||
|
|
||||||
@@ -321,6 +383,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
//}
|
//}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sec("trim dark");
|
||||||
|
|
||||||
//remove props near ores, they're too annoying
|
//remove props near ores, they're too annoying
|
||||||
pass((x, y) -> {
|
pass((x, y) -> {
|
||||||
if(ore.asFloor().wallOre || block.itemDrop != null || (block == Blocks.air && ore != Blocks.air)){
|
if(ore.asFloor().wallOre || block.itemDrop != null || (block == Blocks.air && ore != Blocks.air)){
|
||||||
@@ -330,6 +394,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
trimDark();
|
trimDark();
|
||||||
|
|
||||||
|
sec("vents");
|
||||||
|
|
||||||
int minVents = rand.random(6, 9);
|
int minVents = rand.random(6, 9);
|
||||||
int ventCount = 0;
|
int ventCount = 0;
|
||||||
|
|
||||||
@@ -437,6 +503,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sec("decoration");
|
||||||
|
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
if(tile.overlay().needsSurface && !tile.floor().hasSurface()){
|
if(tile.overlay().needsSurface && !tile.floor().hasSurface()){
|
||||||
tile.setOverlay(Blocks.air);
|
tile.setOverlay(Blocks.air);
|
||||||
@@ -456,5 +524,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
//all sectors are wave sectors
|
//all sectors are wave sectors
|
||||||
state.rules.waves = true;
|
state.rules.waves = true;
|
||||||
state.rules.showSpawns = true;
|
state.rules.showSpawns = true;
|
||||||
|
|
||||||
|
sec("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,12 +101,20 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
}).width(204);
|
}).width(204);
|
||||||
|
|
||||||
buttons.button("@launch.text", Icon.ok, () -> {
|
boolean rows = Core.graphics.isPortrait() && mobile;
|
||||||
|
|
||||||
|
if(rows) buttons.row();
|
||||||
|
|
||||||
|
var cell = buttons.button("@launch.text", Icon.ok, () -> {
|
||||||
universe.updateLoadout(core, selected);
|
universe.updateLoadout(core, selected);
|
||||||
confirm.run();
|
confirm.run();
|
||||||
hide();
|
hide();
|
||||||
}).disabled(b -> !valid);
|
}).disabled(b -> !valid);
|
||||||
|
|
||||||
|
if(rows){
|
||||||
|
cell.colspan(2).size(160f + 204f + 4f, 64f);
|
||||||
|
}
|
||||||
|
|
||||||
int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(230)), 1);
|
int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(230)), 1);
|
||||||
ButtonGroup<Button> group = new ButtonGroup<>();
|
ButtonGroup<Button> group = new ButtonGroup<>();
|
||||||
selected = universe.getLoadout(core);
|
selected = universe.getLoadout(core);
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
//TODO what if any sector is selectable?
|
//TODO what if any sector is selectable?
|
||||||
//TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable?
|
//TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable?
|
||||||
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet && launchSector.planet.launchCandidates.contains(planet);
|
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet && launchSector.planet.launchCandidates.contains(planet);
|
||||||
return (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase);
|
return (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase) || debugSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
public boolean breakable;
|
public boolean breakable;
|
||||||
/** whether to add this block to brokenblocks */
|
/** whether to add this block to brokenblocks */
|
||||||
public boolean rebuildable = true;
|
public boolean rebuildable = true;
|
||||||
|
/** if true, this logic-related block can only be used with privileged processors (or is one itself) */
|
||||||
|
public boolean privileged = false;
|
||||||
/** whether this block can only be placed on water */
|
/** whether this block can only be placed on water */
|
||||||
public boolean requiresWater = false;
|
public boolean requiresWater = false;
|
||||||
/** whether this block can be placed on any liquids, anywhere */
|
/** whether this block can be placed on any liquids, anywhere */
|
||||||
|
|||||||
@@ -369,6 +369,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
setFloorNet(floor, Blocks.air);
|
setFloorNet(floor, Blocks.air);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** set()-s this tile, except it's synced across the network */
|
||||||
|
public void setOverlayNet(Block overlay){
|
||||||
|
Call.setOverlay(this, overlay);
|
||||||
|
}
|
||||||
|
|
||||||
public short overlayID(){
|
public short overlayID(){
|
||||||
return overlay.id;
|
return overlay.id;
|
||||||
}
|
}
|
||||||
@@ -699,6 +704,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
tile.setOverlay(overlay);
|
tile.setOverlay(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Remote(called = Loc.server)
|
||||||
|
public static void setOverlay(Tile tile, Block overlay){
|
||||||
|
tile.setOverlay(overlay);
|
||||||
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
public static void removeTile(Tile tile){
|
public static void removeTile(Tile tile){
|
||||||
tile.remove();
|
tile.remove();
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class LogicBlock extends Block{
|
|||||||
public int maxInstructionScale = 5;
|
public int maxInstructionScale = 5;
|
||||||
public int instructionsPerTick = 1;
|
public int instructionsPerTick = 1;
|
||||||
public float range = 8 * 10;
|
public float range = 8 * 10;
|
||||||
public boolean privileged;
|
|
||||||
|
|
||||||
public LogicBlock(String name){
|
public LogicBlock(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -535,7 +534,7 @@ public class LogicBlock extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean validLink(Building other){
|
public boolean validLink(Building other){
|
||||||
return other != null && other.isValid() && (privileged || (other.team == team && other.within(this, range + other.block.size*tilesize/2f))) && !(other instanceof ConstructBuild);
|
return other != null && other.isValid() && (privileged || (!other.block.privileged && other.team == team && other.within(this, range + other.block.size*tilesize/2f))) && !(other instanceof ConstructBuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,6 +33,22 @@ public class MemoryBlock extends Block{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean collide(Bullet other){
|
||||||
|
return !privileged;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayable(){
|
||||||
|
return !privileged;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void damage(float damage){
|
||||||
|
if(privileged) return;
|
||||||
|
super.damage(damage);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(Writes write){
|
public void write(Writes write){
|
||||||
super.write(write);
|
super.write(write);
|
||||||
|
|||||||
Reference in New Issue
Block a user