Cleanup
This commit is contained in:
@@ -249,35 +249,15 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO remove, make it viable on a server
|
|
||||||
/*public void playZone(Zone zone){
|
|
||||||
|
|
||||||
ui.loadAnd(() -> {
|
|
||||||
logic.reset();
|
|
||||||
net.reset();
|
|
||||||
world.loadGenerator(zone.generator);
|
|
||||||
zone.rules.get(state.rules);
|
|
||||||
state.rules.zone = zone;
|
|
||||||
for(TileEntity core : state.teams.playerCores()){
|
|
||||||
for(ItemStack stack : zone.getStartingItems()){
|
|
||||||
core.items.add(stack.item, stack.amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.set(State.playing);
|
|
||||||
state.wavetime = state.rules.waveSpacing;
|
|
||||||
control.saves.zoneSave();
|
|
||||||
logic.play();
|
|
||||||
Events.fire(Trigger.newGame);
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void playSector(Sector sector){
|
public void playSector(Sector sector){
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
|
net.reset();
|
||||||
logic.reset();
|
logic.reset();
|
||||||
world.loadSector(sector);
|
world.loadSector(sector);
|
||||||
state.set(State.playing);
|
|
||||||
logic.play();
|
logic.play();
|
||||||
|
control.saves.zoneSave();
|
||||||
ui.planet.hide();
|
ui.planet.hide();
|
||||||
|
Events.fire(Trigger.newGame);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.blocks.BuildBlock.*;
|
import mindustry.world.blocks.BuildBlock.*;
|
||||||
import mindustry.world.blocks.power.*;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -100,6 +99,7 @@ public class Logic implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Adds starting items, resets wave time, and sets state to playing. */
|
||||||
public void play(){
|
public void play(){
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
state.wavetime = state.rules.waveSpacing * 2; //grace period of 2x wave time before game starts
|
state.wavetime = state.rules.waveSpacing * 2; //grace period of 2x wave time before game starts
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import static mindustry.Vars.*;
|
|||||||
public class PlanetRenderer implements PlanetGenerator{
|
public class PlanetRenderer implements PlanetGenerator{
|
||||||
private final Color outlineColor = Pal.accent.cpy().a(0.7f);
|
private final Color outlineColor = Pal.accent.cpy().a(0.7f);
|
||||||
private final float camLength = 4f, outlineRad = 1.15f;
|
private final float camLength = 4f, outlineRad = 1.15f;
|
||||||
private final boolean drawnRect = true;
|
private final boolean drawRect = false;
|
||||||
|
|
||||||
private final PlanetMesh[] outlines = new PlanetMesh[10];
|
private final PlanetMesh[] outlines = new PlanetMesh[10];
|
||||||
private final Camera3D cam = new Camera3D();
|
private final Camera3D cam = new Camera3D();
|
||||||
@@ -58,8 +58,7 @@ public class PlanetRenderer implements PlanetGenerator{
|
|||||||
}
|
}
|
||||||
batch.flush(cam.combined(), Gl.triangleFan);
|
batch.flush(cam.combined(), Gl.triangleFan);
|
||||||
|
|
||||||
if(drawnRect){
|
if(drawRect){
|
||||||
//TODO hack.
|
|
||||||
SectorRect rect = sector.rect;
|
SectorRect rect = sector.rect;
|
||||||
rect.center.scl(outlineRad);
|
rect.center.scl(outlineRad);
|
||||||
rect.right.scl(outlineRad);
|
rect.right.scl(outlineRad);
|
||||||
@@ -78,12 +77,13 @@ public class PlanetRenderer implements PlanetGenerator{
|
|||||||
rect.center.scl(1f / outlineRad);
|
rect.center.scl(1f / outlineRad);
|
||||||
rect.right.scl(1f / outlineRad);
|
rect.right.scl(1f / outlineRad);
|
||||||
rect.top.scl(1f / outlineRad);
|
rect.top.scl(1f / outlineRad);
|
||||||
|
|
||||||
if(Core.input.keyTap(KeyCode.SPACE)){
|
|
||||||
control.playSector(sector);
|
|
||||||
ui.planet.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Core.input.keyTap(KeyCode.SPACE)){
|
||||||
|
control.playSector(sector);
|
||||||
|
ui.planet.hide();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gl.disable(Gl.depthTest);
|
Gl.disable(Gl.depthTest);
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
|||||||
int waterLevel = 5;
|
int waterLevel = 5;
|
||||||
float water;
|
float water;
|
||||||
float scl = 5f;
|
float scl = 5f;
|
||||||
Array<Block> blocks = Array.with(Blocks.sporeMoss, Blocks.moss, Blocks.ice, Blocks.snow, Blocks.sand, Blocks.darksand, Blocks.darksandWater, Blocks.darksandTaintedWater);
|
Array<Block> blocks = Array.with(Blocks.sporeMoss, Blocks.moss, Blocks.ice, Blocks.snow, Blocks.sand, Blocks.darksand, Blocks.darksandWater, Blocks.darksandTaintedWater, Blocks.iceSnow);
|
||||||
|
|
||||||
public TestPlanetGenerator(){
|
public TestPlanetGenerator(){
|
||||||
try{
|
try{
|
||||||
pix = new Pixmap("planets/colors.png");
|
pix = new Pixmap("planets/colors.png");
|
||||||
water = waterLevel / (float)(pix.getHeight());
|
water = waterLevel / (float)(pix.getHeight());
|
||||||
}catch(Exception ignored){
|
}catch(Exception ignored){
|
||||||
|
//ignored during headless loading for now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +39,15 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(Vec3 position){
|
public Color getColor(Vec3 position){
|
||||||
|
return getBlock(position).color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generate(Vec3 position, TileGen tile){
|
||||||
|
tile.floor = getBlock(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
Block getBlock(Vec3 position){
|
||||||
float height = getHeight(position);
|
float height = getHeight(position);
|
||||||
position = Tmp.v33.set(position).scl(scl);
|
position = Tmp.v33.set(position).scl(scl);
|
||||||
float rad = scl;
|
float rad = scl;
|
||||||
@@ -49,12 +58,7 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
|||||||
height = Mathf.clamp(height);
|
height = Mathf.clamp(height);
|
||||||
|
|
||||||
Color color = Tmp.c1.set(pix.getPixel((int)(temp * (pix.getWidth()-1)), (int)((1f-height) * (pix.getHeight()-1))));
|
Color color = Tmp.c1.set(pix.getPixel((int)(temp * (pix.getWidth()-1)), (int)((1f-height) * (pix.getHeight()-1))));
|
||||||
return blocks.min(c -> color.diff(c.color)).color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return blocks.min(c -> color.diff(c.color));
|
||||||
public void generate(Vec3 position, TileGen tile){
|
|
||||||
Color color = getColor(position);
|
|
||||||
tile.floor = blocks.min(c -> color.diff(c.color));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
setFilter(TextureFilter.Linear);
|
setFilter(TextureFilter.Linear);
|
||||||
}}){{
|
}}){{
|
||||||
float[] time = {0};
|
float[] time = {0};
|
||||||
setColor(Color.gray(0.3f));
|
setColor(Color.grays(0.3f));
|
||||||
setScale(1.5f);
|
setScale(1.5f);
|
||||||
update(() -> {
|
update(() -> {
|
||||||
setOrigin(Align.center);
|
setOrigin(Align.center);
|
||||||
@@ -140,7 +140,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
Stack sub = new Stack();
|
Stack sub = new Stack();
|
||||||
|
|
||||||
if(slot.getZone() != null){
|
if(slot.getZone() != null){
|
||||||
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.gray(0.1f)).grow()));
|
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.grays(0.1f)).grow()));
|
||||||
|
|
||||||
//sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
|
//sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
|
||||||
//TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
|
//TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
|
||||||
@@ -254,7 +254,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
// stack.setSize(Tmp.v1.x, Tmp.v1.y);
|
// stack.setSize(Tmp.v1.x, Tmp.v1.y);
|
||||||
// stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.darkGray : Color.gray(0.2f)).grow()));
|
// stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.darkGray : Color.grays(0.2f)).grow()));
|
||||||
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
|
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
|
||||||
|
|
||||||
Button button = new Button(Styles.squaret);
|
Button button = new Button(Styles.squaret);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=85e020b1565d7f6490d2281411b810916046e5ee
|
archash=e287fdce0449a87fb15599c67b5167ac0273bcb6
|
||||||
|
|||||||
Reference in New Issue
Block a user