Zone improvements

This commit is contained in:
Anuken
2019-08-06 13:01:54 -04:00
parent 5c6bcbf9cd
commit 282aab5939
11 changed files with 20 additions and 13 deletions

View File

@@ -78,14 +78,14 @@ public class Zones implements ContentList{
}};
saltFlats = new Zone("saltFlats", new MapGenerator("saltFlats")){{
startingItems = ItemStack.list(Items.copper, 200, Items.silicon, 100, Items.lead, 200);
startingItems = ItemStack.list(Items.copper, 200, Items.silicon, 200, Items.lead, 200);
alwaysUnlocked = true;
conditionWave = 5;
launchPeriod = 5;
loadout = Loadouts.basicFoundation;
zoneRequirements = ZoneRequirement.with(desertWastes, 60);
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.draugFactory};
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.draugFactory, Blocks.door};
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand, Items.titanium};
}};
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 1)

View File

@@ -170,7 +170,7 @@ public class DeployDialog extends FloatingDialog{
button.setDisabled(() -> hidden(zone));
button.clicked(() -> info.show(zone));
if(zone.unlocked()){
if(zone.unlocked() && !hidden(zone)){
button.labelWrap(zone.localizedName()).style("outline").width(140).growX().get().setAlignment(Align.center);
}else{
button.addImage("icon-locked");

View File

@@ -5,7 +5,6 @@ import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.util.*;
/** Fades in a black overlay.*/
public class FadeInFragment extends Fragment{
@@ -30,7 +29,7 @@ public class FadeInFragment extends Fragment{
@Override
public void act(float delta){
super.act(delta);
time += Time.delta() / duration;
time += 1f / duration;
if(time > 1){
remove();
}

View File

@@ -78,12 +78,12 @@ public class MendProjector extends Block{
float realRange = range + entity.phaseHeat * phaseRangeBoost;
entity.charge = 0f;
int tileRange = (int)(realRange / tilesize);
int tileRange = (int)(realRange / tilesize + 1);
healed.clear();
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
if(Mathf.dst(x, y, tile.x, tile.y) > tileRange) continue;
if(!Mathf.within(x * tilesize, y * tilesize, tile.drawx(), tile.drawy(), realRange)) continue;
Tile other = world.ltile(x, y);

View File

@@ -84,12 +84,12 @@ public class OverdriveProjector extends Block{
entity.charge = 0f;
int tileRange = (int)(realRange / tilesize);
int tileRange = (int)(realRange / tilesize + 1);
healed.clear();
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
if(Mathf.dst(x, y, tile.x, tile.y) > tileRange) continue;
if(!Mathf.within(x * tilesize, y * tilesize, tile.drawx(), tile.drawy(), realRange)) continue;
Tile other = world.ltile(x, y);

View File

@@ -209,6 +209,7 @@ public class PowerGraph{
}
public void add(Tile tile){
if(tile.entity == null || tile.entity.power == null) return;
tile.entity.power.graph = this;
all.add(tile);

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.power;
import io.anuke.annotations.Annotations.*;
import io.anuke.arc.*;
import io.anuke.arc.function.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*;
@@ -105,14 +106,20 @@ public class PowerNode extends PowerBlock{
Call.linkPowerNodes(null, tile, before);
}
Predicate<Tile> valid = other -> other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)
&& !other.entity.proximity().contains(tile) && other.entity.power.graph != tile.entity.power.graph;
tempTiles.clear();
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
Tile other = world.ltile(x, y);
if(other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)
&& !other.entity.proximity().contains(tile) && other.entity.power.graph != tile.entity.power.graph){
Call.linkPowerNodes(null, tile, other);
if(valid.test(other)){
tempTiles.add(other);
}
});
tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile)));
tempTiles.each(valid, other -> Call.linkPowerNodes(null, tile, other));
lastPlaced = tile.pos();
super.playerPlaced(tile);
}