This commit is contained in:
Anuken
2020-09-07 17:06:56 -04:00
parent 15bb01fd22
commit fe76490418
11 changed files with 106 additions and 60 deletions

Binary file not shown.

View File

@ -101,13 +101,12 @@ public class Blocks implements ContentList{
hasShadow = false;
}
public void drawBase(Tile tile){}
public void load(){}
public void init(){}
public boolean isHidden(){
return true;
}
@Override public void drawBase(Tile tile){}
@Override public void load(){}
@Override public void init(){}
@Override public boolean isHidden(){ return true; }
@Override
public TextureRegion[] variantRegions(){
if(variantRegions == null){
variantRegions = new TextureRegion[]{Core.atlas.find("clear")};
@ -211,9 +210,7 @@ public class Blocks implements ContentList{
cacheLayer = CacheLayer.slag;
}};
stone = new Floor("stone"){{
}};
stone = new Floor("stone");
craters = new Floor("craters"){{
variants = 3;
@ -265,9 +262,7 @@ public class Blocks implements ContentList{
((ShallowLiquid)sandWater).set(Blocks.water, Blocks.sand);
((ShallowLiquid)darksandWater).set(Blocks.water, Blocks.darksand);
holostone = new Floor("holostone"){{
}};
holostone = new Floor("holostone");
grass = new Floor("grass"){{
attributes.set(Attribute.water, 0.1f);
@ -334,8 +329,7 @@ public class Blocks implements ContentList{
variants = 2;
}};
saltRocks = new StaticWall("saltrocks"){{
}};
saltRocks = new StaticWall("saltrocks");
sporePine = new StaticTree("spore-pine"){{
variants = 0;
@ -349,15 +343,11 @@ public class Blocks implements ContentList{
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"){{
variants = 3;
@ -1157,7 +1147,7 @@ public class Blocks implements ContentList{
rtgGenerator = new DecayGenerator("rtg-generator"){{
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phasefabric, 25, Items.plastanium, 75, Items.thorium, 50));
size = 2;
powerProduction = 4f;
powerProduction = 4.5f;
itemDuration = 500f;
}};
@ -1177,7 +1167,7 @@ public class Blocks implements ContentList{
size = 3;
health = 700;
itemDuration = 360f;
powerProduction = 14f;
powerProduction = 15f;
consumes.item(Items.thorium);
heating = 0.02f;
consumes.liquid(Liquids.cryofluid, heating / coolantPower).update(false);

View File

@ -431,16 +431,16 @@ public class Control implements ApplicationListener, Loadable{
ui.showStartupInfo("[accent]v6[] is currently in [accent]pre-alpha[].\n" +
"[lightgray]This means:[]\n" +
"- Content is missing\n" +
"- [scarlet]Mobile[] is not supported.\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" +
"- Everything you see is subject to change or removal." +
"\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)){
//Core.app.post(() -> Core.app.post(this::playTutorial));
}

View File

@ -185,8 +185,6 @@ public class World{
continue;
}
tile.updateOcclusion();
if(tile.build != null){
tile.build.updateProximity();
}

View File

@ -39,13 +39,6 @@ public class EditorTile extends Tile{
super.setFloor(type);
}
@Override
public void updateOcclusion(){
super.updateOcclusion();
ui.editor.editor.renderer().updatePoint(x, y);
}
@Override
public void setBlock(Block type, Team team, int rotation){
if(state.isGame()){
@ -85,8 +78,12 @@ public class EditorTile extends Tile{
}
@Override
protected void preChanged(){
super.preChanged();
protected void fireChanged(){
if(state.isGame()){
super.fireChanged();
}else{
ui.editor.editor.renderer().updatePoint(x, y);
}
}
@Override

View File

@ -200,20 +200,16 @@ public class BaseGenerator{
}
boolean isTaken(Block block, int x, int y){
if(block.isMultiblock()){
int offsetx = -(block.size - 1) / 2;
int offsety = -(block.size - 1) / 2;
int offsetx = -(block.size - 1) / 2;
int offsety = -(block.size - 1) / 2;
int pad = 1;
for(int dx = 0; dx < block.size; dx++){
for(int dy = 0; dy < block.size; dy++){
if(overlaps(dx + offsetx + x, dy + offsety + y)){
return true;
}
for(int dx = -pad; dx < block.size + pad; dx++){
for(int dy = -pad; dy < block.size + pad; dy++){
if(overlaps(dx + offsetx + x, dy + offsety + y)){
return true;
}
}
}else{
return overlaps(x, y);
}
return false;

View File

@ -390,6 +390,8 @@ public class Sector{
/** Has an enemy base. */
base,
/** Has spore weather. */
spores
spores,
/** Path from core to spawns requires traversing water. */
navalPath
}
}

View File

@ -449,10 +449,6 @@ public class Tile implements Position, QuadTreeObject, Displayable{
return block.solid && block.fillsTile && !block.synthetic() ? data : 0;
}
//TODO remove this method?
public void updateOcclusion(){
}
protected void preChanged(){
if(build != null){
//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;
//manually call changed event
other.updateOcclusion();
world.notifyChanged(other);
other.fireChanged();
}
}
}
@ -533,9 +528,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
}
}
updateOcclusion();
world.notifyChanged(this);
fireChanged();
//recache when static block is added
if(block.isStatic()){
@ -543,6 +536,10 @@ public class Tile implements Position, QuadTreeObject, Displayable{
}
}
protected void fireChanged(){
world.notifyChanged(this);
}
@Override
public void display(Table table){
Block toDisplay = overlay.itemDrop != null ? overlay : floor;

View File

@ -70,7 +70,7 @@ public class NuclearReactor extends PowerGenerator{
@Override
public void updateTile(){
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);
float fullness = (float)fuel / itemCapacity;

View File

@ -34,6 +34,10 @@ public class Consumers{
return get(ConsumeType.power);
}
public ConsumeItems getItem(){
return get(ConsumeType.item);
}
public boolean hasPower(){
return has(ConsumeType.power);
}

View File

@ -3,6 +3,7 @@ package mindustry.tools;
import arc.*;
import arc.backend.headless.mock.*;
import arc.files.*;
import arc.math.geom.*;
import arc.mock.*;
import arc.struct.*;
import arc.struct.ObjectIntMap.*;
@ -17,6 +18,7 @@ import mindustry.net.Net;
import mindustry.type.*;
import mindustry.type.Sector.*;
import mindustry.world.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.blocks.storage.CoreBlock.*;
import static mindustry.Vars.*;
@ -84,6 +86,19 @@ public class SectorDataGenerator{
CoreBuild entity = Team.sharded.core();
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 waterCheckRad = 5;
@ -150,7 +165,7 @@ public class SectorDataGenerator{
}
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;
@ -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;
}
}