Map bugfixes / Sprite tweak / Zone loadout moved to dialog
This commit is contained in:
@@ -62,7 +62,7 @@ public class WaveSpawner{
|
||||
spawning = true;
|
||||
|
||||
for(SpawnGroup group : state.rules.spawns){
|
||||
int spawned = group.getUnitsSpawned(state.wave);
|
||||
int spawned = group.getUnitsSpawned(state.wave - 1);
|
||||
|
||||
float spawnX, spawnY;
|
||||
float spread;
|
||||
|
||||
@@ -205,16 +205,16 @@ public class Zones implements ContentList{
|
||||
desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift").dist(2f)){{
|
||||
loadout = Loadouts.basicNucleus;
|
||||
baseLaunchCost = ItemStack.with();
|
||||
startingItems = ItemStack.list(Items.copper, 1500);
|
||||
conditionWave = 2;
|
||||
launchPeriod = 1;
|
||||
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
|
||||
conditionWave = 3;
|
||||
launchPeriod = 2;
|
||||
zoneRequirements = ZoneRequirement.with(tarFields, 20);
|
||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand, Items.thorium};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
waveSpacing = 60 * 60 * 3.5f;
|
||||
waveSpacing = 60 * 60 * 2.5f;
|
||||
}};
|
||||
}};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class GlobalData{
|
||||
|
||||
/** Returns whether or not this piece of content is unlocked yet. */
|
||||
public boolean isUnlocked(UnlockableContent content){
|
||||
return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.name);
|
||||
return true;//content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -130,7 +130,7 @@ public class DesktopInput extends InputHandler{
|
||||
player.isShooting = false;
|
||||
}
|
||||
|
||||
if(!state.is(State.menu) && Core.input.keyTap(Binding.minimap)){
|
||||
if(!state.is(State.menu) && Core.input.keyTap(Binding.minimap) && !ui.chatfrag.chatOpen()){
|
||||
if(!ui.minimap.isShown()){
|
||||
ui.minimap.show();
|
||||
}else{
|
||||
@@ -145,8 +145,6 @@ public class DesktopInput extends InputHandler{
|
||||
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
|
||||
}
|
||||
|
||||
//renderer.minimap.zoomBy(-Core.input.axisTap(Binding.zoom_minimap));
|
||||
|
||||
if(player.isDead()){
|
||||
cursorType = SystemCursor.arrow;
|
||||
return;
|
||||
|
||||
@@ -108,10 +108,10 @@ public class MapGenerator extends Generator{
|
||||
int newX = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x, y) * distortion + x), 0, width - 1);
|
||||
int newY = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x + 9999, y + 9999) * distortion + y), 0, height - 1);
|
||||
|
||||
if((tile.block() instanceof StaticWall
|
||||
if(((tile.block() instanceof StaticWall
|
||||
&& tiles[newX][newY].block() instanceof StaticWall)
|
||||
|| (tile.block() == Blocks.air && !tiles[newX][newY].block().synthetic())
|
||||
|| (tiles[newX][newY].block() == Blocks.air && tile.block() instanceof StaticWall)){
|
||||
|| (tiles[newX][newY].block() == Blocks.air && tile.block() instanceof StaticWall)) && tiles[newX][newY].block() != Blocks.spawn){
|
||||
tile.setBlock(tiles[newX][newY].block());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ public class Zone extends UnlockableContent{
|
||||
protected Array<ItemStack> startingItems = new Array<>();
|
||||
protected ItemStack[] launchCost = null;
|
||||
|
||||
private Array<ItemStack> defaultStartingItems = new Array<>();
|
||||
|
||||
public Zone(String name, Generator generator){
|
||||
super(name);
|
||||
this.generator = generator;
|
||||
@@ -60,6 +62,11 @@ public class Zone extends UnlockableContent{
|
||||
return startingItems;
|
||||
}
|
||||
|
||||
public void resetStartingItems(){
|
||||
startingItems.clear();
|
||||
defaultStartingItems.each(stack -> startingItems.add(new ItemStack(stack.item, stack.amount)));
|
||||
}
|
||||
|
||||
public void updateWave(int wave){
|
||||
int value = Core.settings.getInt(name + "-wave", 0);
|
||||
if(value < wave){
|
||||
@@ -127,6 +134,10 @@ public class Zone extends UnlockableContent{
|
||||
generator.init(loadout);
|
||||
Arrays.sort(resources);
|
||||
|
||||
for(ItemStack stack : startingItems){
|
||||
defaultStartingItems.add(new ItemStack(stack.item, stack.amount));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Array<ItemStack> arr = Core.settings.getObject(name + "-starting-items", Array.class, () -> null);
|
||||
if(arr != null){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.scene.event.HandCursorListener;
|
||||
import io.anuke.arc.scene.ui.*;
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.anuke.mindustry.ui.dialogs;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.scene.ui.Button;
|
||||
import io.anuke.arc.scene.ui.TextButton;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.type.*;
|
||||
@@ -14,6 +13,7 @@ import io.anuke.mindustry.world.Block.Icon;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class ZoneInfoDialog extends FloatingDialog{
|
||||
private ZoneLoadoutDialog loadout = new ZoneLoadoutDialog();
|
||||
|
||||
public ZoneInfoDialog(){
|
||||
super("");
|
||||
@@ -103,6 +103,8 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
cont.row();
|
||||
cont.addImage("white").color(Pal.accent).height(3).pad(6).growX();
|
||||
cont.row();
|
||||
cont.addButton(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureWave), () -> loadout.show(zone, rebuildItems)).fillX().pad(3).disabled(b -> !zone.canConfigure());
|
||||
cont.row();
|
||||
cont.table(res -> {
|
||||
res.add("$zone.resources").padRight(6);
|
||||
if(zone.resources.length > 0){
|
||||
@@ -118,75 +120,8 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
cont.row();
|
||||
cont.add(Core.bundle.format("bestwave", zone.bestWave()));
|
||||
}
|
||||
|
||||
Table load = new Table();
|
||||
//thanks java, absolutely brilliant syntax here
|
||||
Runnable[] rebuildLoadout = {null};
|
||||
rebuildLoadout[0] = () -> {
|
||||
load.clear();
|
||||
float bsize = 40f;
|
||||
int step = 50;
|
||||
|
||||
load.left();
|
||||
for(ItemStack stack : zone.getStartingItems()){
|
||||
load.addButton("x", () -> {
|
||||
zone.getStartingItems().remove(stack);
|
||||
zone.updateLaunchCost();
|
||||
rebuildItems.run();
|
||||
rebuildLoadout[0].run();
|
||||
}).size(bsize).pad(2);
|
||||
|
||||
load.addButton("-", () -> {
|
||||
stack.amount = Math.max(stack.amount - step, 0);
|
||||
zone.updateLaunchCost();
|
||||
rebuildItems.run();
|
||||
}).size(bsize).pad(2);
|
||||
load.addButton("+", () -> {
|
||||
stack.amount = Math.min(stack.amount + step, zone.loadout.core().itemCapacity);
|
||||
zone.updateLaunchCost();
|
||||
rebuildItems.run();
|
||||
}).size(bsize).pad(2);
|
||||
|
||||
load.addImage(stack.item.icon(Item.Icon.medium)).size(8 * 3).padRight(4);
|
||||
load.label(() -> stack.amount + "").left();
|
||||
|
||||
load.row();
|
||||
}
|
||||
|
||||
load.addButton("$add", () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("");
|
||||
dialog.setFillParent(false);
|
||||
for(Item item : content.items().select(item -> data.getItem(item) > 0 && item.type == ItemType.material && zone.getStartingItems().find(stack -> stack.item == item) == null)){
|
||||
TextButton button = dialog.cont.addButton("", () -> {
|
||||
zone.getStartingItems().add(new ItemStack(item, 0));
|
||||
zone.updateLaunchCost();
|
||||
rebuildLoadout[0].run();
|
||||
dialog.hide();
|
||||
}).size(300f, 35f).pad(1).get();
|
||||
button.clearChildren();
|
||||
button.left();
|
||||
button.addImage(item.icon(Item.Icon.medium)).size(8 * 3).pad(4);
|
||||
button.add(item.localizedName);
|
||||
dialog.cont.row();
|
||||
}
|
||||
dialog.show();
|
||||
}).colspan(4).size(100f, bsize).left().disabled(b -> !content.items().contains(item -> data.getItem(item) > 0 && item.type == ItemType.material && !zone.getStartingItems().contains(stack -> stack.item == item)));
|
||||
};
|
||||
|
||||
rebuildLoadout[0].run();
|
||||
|
||||
cont.row();
|
||||
cont.table(zone.canConfigure() ? "button" : "button-disabled", t -> {
|
||||
t.left();
|
||||
t.add(!zone.canConfigure() ? Core.bundle.format("configure.locked", zone.configureWave) : "$configure").growX().wrap();
|
||||
if(zone.canConfigure()){
|
||||
t.row();
|
||||
t.pane(load).pad(2).growX().left();
|
||||
}
|
||||
}).width(300f).pad(4).left();
|
||||
}
|
||||
});
|
||||
|
||||
cont.row();
|
||||
|
||||
Button button = cont.addButton(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
@@ -200,7 +135,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
hide();
|
||||
world.playZone(zone);
|
||||
}
|
||||
}).minWidth(150f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !canUnlock(zone) : !data.hasItems(zone.getLaunchCost())).get();
|
||||
}).minWidth(150f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !canUnlock(zone) : !data.hasItems(zone.getLaunchCost())).uniformY().get();
|
||||
|
||||
button.row();
|
||||
button.add(iteminfo);
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.scene.ui.TextButton;
|
||||
import io.anuke.mindustry.type.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.data;
|
||||
|
||||
public class ZoneLoadoutDialog extends FloatingDialog{
|
||||
private Zone zone;
|
||||
private Runnable hider;
|
||||
|
||||
public ZoneLoadoutDialog(){
|
||||
super("$configure");
|
||||
setFillParent(false);
|
||||
addCloseButton();
|
||||
shown(this::setup);
|
||||
hidden(() -> {
|
||||
if(hider != null){
|
||||
hider.run();
|
||||
}
|
||||
});
|
||||
buttons.row();
|
||||
buttons.addButton("$settings.reset", () -> {
|
||||
zone.resetStartingItems();
|
||||
zone.updateLaunchCost();
|
||||
setup();
|
||||
}).size(210f, 64f);
|
||||
}
|
||||
|
||||
public void show(Zone zone, Runnable hider){
|
||||
this.hider = hider;
|
||||
this.zone = zone;
|
||||
show();
|
||||
}
|
||||
|
||||
void setup(){
|
||||
cont.clear();
|
||||
float bsize = 40f;
|
||||
int step = 50;
|
||||
|
||||
for(ItemStack stack : zone.getStartingItems()){
|
||||
cont.addButton("x", "clear-partial", () -> {
|
||||
zone.getStartingItems().remove(stack);
|
||||
zone.updateLaunchCost();
|
||||
setup();
|
||||
}).size(bsize);
|
||||
|
||||
cont.addButton("-", "clear-partial", () -> {
|
||||
stack.amount = Math.max(stack.amount - step, 0);
|
||||
zone.updateLaunchCost();
|
||||
}).size(bsize);
|
||||
cont.addButton("+", "clear-partial", () -> {
|
||||
stack.amount = Math.min(stack.amount + step, zone.loadout.core().itemCapacity);
|
||||
zone.updateLaunchCost();
|
||||
}).size(bsize);
|
||||
|
||||
cont.addImage(stack.item.icon(Item.Icon.medium)).size(8 * 3).padRight(4);
|
||||
cont.label(() -> stack.amount + "").left();
|
||||
|
||||
cont.row();
|
||||
}
|
||||
|
||||
cont.addButton("$add", () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("");
|
||||
dialog.setFillParent(false);
|
||||
for(Item item : content.items().select(item -> data.getItem(item) > 0 && item.type == ItemType.material && zone.getStartingItems().find(stack -> stack.item == item) == null)){
|
||||
TextButton button = dialog.cont.addButton("", "clear", () -> {
|
||||
zone.getStartingItems().add(new ItemStack(item, 0));
|
||||
zone.updateLaunchCost();
|
||||
setup();
|
||||
dialog.hide();
|
||||
}).size(300f, 36f).get();
|
||||
button.clearChildren();
|
||||
button.left();
|
||||
button.addImage(item.icon(Item.Icon.medium)).size(8 * 3).pad(4);
|
||||
button.add(item.localizedName);
|
||||
dialog.cont.row();
|
||||
}
|
||||
dialog.show();
|
||||
}).colspan(4).size(100f, bsize).left().disabled(b -> !content.items().contains(item -> data.getItem(item) > 0 && item.type == ItemType.material && !zone.getStartingItems().contains(stack -> stack.item == item)));
|
||||
pack();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user