Fixed #2515
This commit is contained in:
Binary file not shown.
@@ -101,13 +101,12 @@ public class Blocks implements ContentList{
|
|||||||
hasShadow = false;
|
hasShadow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBase(Tile tile){}
|
@Override public void drawBase(Tile tile){}
|
||||||
public void load(){}
|
@Override public void load(){}
|
||||||
public void init(){}
|
@Override public void init(){}
|
||||||
public boolean isHidden(){
|
@Override public boolean isHidden(){ return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public TextureRegion[] variantRegions(){
|
public TextureRegion[] variantRegions(){
|
||||||
if(variantRegions == null){
|
if(variantRegions == null){
|
||||||
variantRegions = new TextureRegion[]{Core.atlas.find("clear")};
|
variantRegions = new TextureRegion[]{Core.atlas.find("clear")};
|
||||||
@@ -211,9 +210,7 @@ public class Blocks implements ContentList{
|
|||||||
cacheLayer = CacheLayer.slag;
|
cacheLayer = CacheLayer.slag;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
stone = new Floor("stone"){{
|
stone = new Floor("stone");
|
||||||
|
|
||||||
}};
|
|
||||||
|
|
||||||
craters = new Floor("craters"){{
|
craters = new Floor("craters"){{
|
||||||
variants = 3;
|
variants = 3;
|
||||||
@@ -265,9 +262,7 @@ public class Blocks implements ContentList{
|
|||||||
((ShallowLiquid)sandWater).set(Blocks.water, Blocks.sand);
|
((ShallowLiquid)sandWater).set(Blocks.water, Blocks.sand);
|
||||||
((ShallowLiquid)darksandWater).set(Blocks.water, Blocks.darksand);
|
((ShallowLiquid)darksandWater).set(Blocks.water, Blocks.darksand);
|
||||||
|
|
||||||
holostone = new Floor("holostone"){{
|
holostone = new Floor("holostone");
|
||||||
|
|
||||||
}};
|
|
||||||
|
|
||||||
grass = new Floor("grass"){{
|
grass = new Floor("grass"){{
|
||||||
attributes.set(Attribute.water, 0.1f);
|
attributes.set(Attribute.water, 0.1f);
|
||||||
@@ -334,8 +329,7 @@ public class Blocks implements ContentList{
|
|||||||
variants = 2;
|
variants = 2;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
saltRocks = new StaticWall("saltrocks"){{
|
saltRocks = new StaticWall("saltrocks");
|
||||||
}};
|
|
||||||
|
|
||||||
sporePine = new StaticTree("spore-pine"){{
|
sporePine = new StaticTree("spore-pine"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
@@ -349,15 +343,11 @@ public class Blocks implements ContentList{
|
|||||||
variants = 0;
|
variants = 0;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
shrubs = new StaticWall("shrubs"){{
|
shrubs = new StaticWall("shrubs");
|
||||||
|
|
||||||
}};
|
whiteTreeDead = new TreeBlock("white-tree-dead");
|
||||||
|
|
||||||
whiteTreeDead = new TreeBlock("white-tree-dead"){{
|
whiteTree = new TreeBlock("white-tree");
|
||||||
}};
|
|
||||||
|
|
||||||
whiteTree = new TreeBlock("white-tree"){{
|
|
||||||
}};
|
|
||||||
|
|
||||||
sporeCluster = new Rock("spore-cluster"){{
|
sporeCluster = new Rock("spore-cluster"){{
|
||||||
variants = 3;
|
variants = 3;
|
||||||
@@ -1157,7 +1147,7 @@ public class Blocks implements ContentList{
|
|||||||
rtgGenerator = new DecayGenerator("rtg-generator"){{
|
rtgGenerator = new DecayGenerator("rtg-generator"){{
|
||||||
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phasefabric, 25, Items.plastanium, 75, Items.thorium, 50));
|
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phasefabric, 25, Items.plastanium, 75, Items.thorium, 50));
|
||||||
size = 2;
|
size = 2;
|
||||||
powerProduction = 4f;
|
powerProduction = 4.5f;
|
||||||
itemDuration = 500f;
|
itemDuration = 500f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -1177,7 +1167,7 @@ public class Blocks implements ContentList{
|
|||||||
size = 3;
|
size = 3;
|
||||||
health = 700;
|
health = 700;
|
||||||
itemDuration = 360f;
|
itemDuration = 360f;
|
||||||
powerProduction = 14f;
|
powerProduction = 15f;
|
||||||
consumes.item(Items.thorium);
|
consumes.item(Items.thorium);
|
||||||
heating = 0.02f;
|
heating = 0.02f;
|
||||||
consumes.liquid(Liquids.cryofluid, heating / coolantPower).update(false);
|
consumes.liquid(Liquids.cryofluid, heating / coolantPower).update(false);
|
||||||
|
|||||||
@@ -431,16 +431,16 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
ui.showStartupInfo("[accent]v6[] is currently in [accent]pre-alpha[].\n" +
|
ui.showStartupInfo("[accent]v6[] is currently in [accent]pre-alpha[].\n" +
|
||||||
"[lightgray]This means:[]\n" +
|
"[lightgray]This means:[]\n" +
|
||||||
"- Content is missing\n" +
|
"- Content is missing\n" +
|
||||||
"- [scarlet]Mobile[] is not supported.\n" +
|
|
||||||
"- Most [scarlet]Unit AI[] does not work\n" +
|
"- Most [scarlet]Unit AI[] does not work\n" +
|
||||||
"- Many units are [scarlet]missing[] or unfinished\n" +
|
"- Many units are unfinished\n" +
|
||||||
"- The campaign is completely unfinished\n" +
|
"- The campaign is completely unfinished\n" +
|
||||||
"- Everything you see is subject to change or removal." +
|
"- Everything you see is subject to change or removal." +
|
||||||
"\n\nReport bugs or crashes on [accent]Github[].");
|
"\n\nReport bugs or crashes on [accent]Github[].");
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
//play tutorial on stop
|
//play tutorial on start
|
||||||
|
//TODO no tutorial right now
|
||||||
if(!settings.getBool("playedtutorial", false)){
|
if(!settings.getBool("playedtutorial", false)){
|
||||||
//Core.app.post(() -> Core.app.post(this::playTutorial));
|
//Core.app.post(() -> Core.app.post(this::playTutorial));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,8 +185,6 @@ public class World{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.updateOcclusion();
|
|
||||||
|
|
||||||
if(tile.build != null){
|
if(tile.build != null){
|
||||||
tile.build.updateProximity();
|
tile.build.updateProximity();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ public class EditorTile extends Tile{
|
|||||||
super.setFloor(type);
|
super.setFloor(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateOcclusion(){
|
|
||||||
super.updateOcclusion();
|
|
||||||
|
|
||||||
ui.editor.editor.renderer().updatePoint(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlock(Block type, Team team, int rotation){
|
public void setBlock(Block type, Team team, int rotation){
|
||||||
if(state.isGame()){
|
if(state.isGame()){
|
||||||
@@ -85,8 +78,12 @@ public class EditorTile extends Tile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preChanged(){
|
protected void fireChanged(){
|
||||||
super.preChanged();
|
if(state.isGame()){
|
||||||
|
super.fireChanged();
|
||||||
|
}else{
|
||||||
|
ui.editor.editor.renderer().updatePoint(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -200,20 +200,16 @@ public class BaseGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isTaken(Block block, int x, int y){
|
boolean isTaken(Block block, int x, int y){
|
||||||
if(block.isMultiblock()){
|
int offsetx = -(block.size - 1) / 2;
|
||||||
int offsetx = -(block.size - 1) / 2;
|
int offsety = -(block.size - 1) / 2;
|
||||||
int offsety = -(block.size - 1) / 2;
|
int pad = 1;
|
||||||
|
|
||||||
for(int dx = 0; dx < block.size; dx++){
|
for(int dx = -pad; dx < block.size + pad; dx++){
|
||||||
for(int dy = 0; dy < block.size; dy++){
|
for(int dy = -pad; dy < block.size + pad; dy++){
|
||||||
if(overlaps(dx + offsetx + x, dy + offsety + y)){
|
if(overlaps(dx + offsetx + x, dy + offsety + y)){
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
|
||||||
return overlaps(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -390,6 +390,8 @@ public class Sector{
|
|||||||
/** Has an enemy base. */
|
/** Has an enemy base. */
|
||||||
base,
|
base,
|
||||||
/** Has spore weather. */
|
/** Has spore weather. */
|
||||||
spores
|
spores,
|
||||||
|
/** Path from core to spawns requires traversing water. */
|
||||||
|
navalPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,10 +449,6 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
return block.solid && block.fillsTile && !block.synthetic() ? data : 0;
|
return block.solid && block.fillsTile && !block.synthetic() ? data : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO remove this method?
|
|
||||||
public void updateOcclusion(){
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void preChanged(){
|
protected void preChanged(){
|
||||||
if(build != null){
|
if(build != null){
|
||||||
//only call removed() for the center block - this only gets called once.
|
//only call removed() for the center block - this only gets called once.
|
||||||
@@ -475,8 +471,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
other.block = Blocks.air;
|
other.block = Blocks.air;
|
||||||
|
|
||||||
//manually call changed event
|
//manually call changed event
|
||||||
other.updateOcclusion();
|
other.fireChanged();
|
||||||
world.notifyChanged(other);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -533,9 +528,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOcclusion();
|
fireChanged();
|
||||||
|
|
||||||
world.notifyChanged(this);
|
|
||||||
|
|
||||||
//recache when static block is added
|
//recache when static block is added
|
||||||
if(block.isStatic()){
|
if(block.isStatic()){
|
||||||
@@ -543,6 +536,10 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void fireChanged(){
|
||||||
|
world.notifyChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void display(Table table){
|
public void display(Table table){
|
||||||
Block toDisplay = overlay.itemDrop != null ? overlay : floor;
|
Block toDisplay = overlay.itemDrop != null ? overlay : floor;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
ConsumeLiquid cliquid = consumes.get(ConsumeType.liquid);
|
ConsumeLiquid cliquid = consumes.get(ConsumeType.liquid);
|
||||||
Item item = consumes.<ConsumeItems>get(ConsumeType.item).items[0].item;
|
Item item = consumes.getItem().items[0].item;
|
||||||
|
|
||||||
int fuel = items.get(item);
|
int fuel = items.get(item);
|
||||||
float fullness = (float)fuel / itemCapacity;
|
float fullness = (float)fuel / itemCapacity;
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ public class Consumers{
|
|||||||
return get(ConsumeType.power);
|
return get(ConsumeType.power);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConsumeItems getItem(){
|
||||||
|
return get(ConsumeType.item);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasPower(){
|
public boolean hasPower(){
|
||||||
return has(ConsumeType.power);
|
return has(ConsumeType.power);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mindustry.tools;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.backend.headless.mock.*;
|
import arc.backend.headless.mock.*;
|
||||||
import arc.files.*;
|
import arc.files.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.mock.*;
|
import arc.mock.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.struct.ObjectIntMap.*;
|
import arc.struct.ObjectIntMap.*;
|
||||||
@@ -17,6 +18,7 @@ import mindustry.net.Net;
|
|||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.type.Sector.*;
|
import mindustry.type.Sector.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.storage.*;
|
||||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -84,6 +86,19 @@ public class SectorDataGenerator{
|
|||||||
CoreBuild entity = Team.sharded.core();
|
CoreBuild entity = Team.sharded.core();
|
||||||
int cx = entity.tileX(), cy = entity.tileY();
|
int cx = entity.tileX(), cy = entity.tileY();
|
||||||
|
|
||||||
|
boolean path = pathfind(true);
|
||||||
|
boolean groundPath = pathfind(false);
|
||||||
|
|
||||||
|
if(!path){
|
||||||
|
Log.err("Sector &ly@&lr has no core path!", sector.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!groundPath){
|
||||||
|
Log.debug("&lbSector &ly@&lb is naval-only", sector.id);
|
||||||
|
|
||||||
|
data.attributes |= (1 << SectorAttribute.navalPath.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
int nearTiles = 0;
|
int nearTiles = 0;
|
||||||
int waterCheckRad = 5;
|
int waterCheckRad = 5;
|
||||||
|
|
||||||
@@ -150,7 +165,7 @@ public class SectorDataGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(count[0]++ % 10 == 0){
|
if(count[0]++ % 10 == 0){
|
||||||
Log.info("&lyDone with sector &lm@/@", count[0], planet.sectors.size);
|
Log.info("&ly[ &lg@% &ly] Done with sector &lm@/@ ", (int)((float)count[0] / planet.sectors.size * 100), count[0], planet.sectors.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@@ -163,4 +178,51 @@ public class SectorDataGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean pathfind(boolean allowWater){
|
||||||
|
CoreBuild entity = Team.sharded.core();
|
||||||
|
|
||||||
|
IntSet enemies = new IntSet();
|
||||||
|
world.tiles.eachTile(t -> {
|
||||||
|
if((t.team() == Team.crux && t.block() instanceof CoreBlock) || t.overlay() == Blocks.spawn){
|
||||||
|
enemies.add(t.pos());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
GridBits used = new GridBits(world.width(), world.height());
|
||||||
|
|
||||||
|
IntQueue queue = new IntQueue();
|
||||||
|
queue.addFirst(entity.pos());
|
||||||
|
boolean any = false;
|
||||||
|
|
||||||
|
outer:
|
||||||
|
while(!queue.isEmpty()){
|
||||||
|
int pos = queue.removeFirst();
|
||||||
|
int x = Point2.x(pos), y = Point2.y(pos);
|
||||||
|
used.set(x, y);
|
||||||
|
|
||||||
|
for(Point2 p : Geometry.d4){
|
||||||
|
int nx = p.x + x, ny = p.y + y;
|
||||||
|
|
||||||
|
if(world.tiles.in(nx, ny) && !used.get(nx, ny)){
|
||||||
|
Tile tile = world.tile(nx, ny);
|
||||||
|
|
||||||
|
//skip full solids
|
||||||
|
if((tile.block().isStatic() && tile.solid()) || (!allowWater && tile.floor().isLiquid)) continue;
|
||||||
|
|
||||||
|
int newpos = Point2.pack(nx, ny);
|
||||||
|
|
||||||
|
used.set(nx, ny);
|
||||||
|
queue.addLast(newpos);
|
||||||
|
|
||||||
|
if(enemies.contains(newpos)){
|
||||||
|
any = true;
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return any;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user