New unfinished environment blocks / Bugfixes / Tech tree tweak

This commit is contained in:
Anuken
2019-03-10 22:38:53 -04:00
parent 1feb4a5e6d
commit 0f4d574115
28 changed files with 1773 additions and 1077 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 512 B

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 228 KiB

@@ -36,7 +36,7 @@ public class Blocks implements ContentList{
//environment
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, duneRocks, sandRocks, stainedRocks, stainedStone, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow, stainedBoulder, grass,
iceSnow, sandWater, duneRocks, sandRocks, stainedRocks, moss, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow, stainedBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks,
//crafting
@@ -183,6 +183,10 @@ public class Blocks implements ContentList{
}};
salt = new Floor("salt"){{
variants = 0;
}};
iceSnow = new Floor("ice-snow"){{
variants = 3;
}};
@@ -240,9 +244,8 @@ public class Blocks implements ContentList{
variants = 2;
}};
stainedStone = new Floor("stained-stone"){{
edgeStyle = "blocky";
hasOres = true;
moss = new Floor("moss"){{
variants = 3;
}};
stainedRocksRed = new StaticWall("stained-rocks-red"){{
@@ -250,8 +253,8 @@ public class Blocks implements ContentList{
}};
stainedStoneRed = new Floor("stained-stone-red"){{
edgeStyle = "blocky";
hasOres = true;
variants = 1;
}};
stainedRocksYellow = new StaticWall("stained-rocks-yellow"){{
@@ -259,7 +262,7 @@ public class Blocks implements ContentList{
}};
stainedStoneYellow = new Floor("stained-stone-yellow"){{
edgeStyle = "blocky";
variants = 1;
}};
stainedBoulder = new Rock("stained-boulder"){{
@@ -609,6 +609,11 @@ public class Bullets implements ContentList{
keepVelocity = false;
}
@Override
public float range(){
return 70f;
}
@Override
public void draw(Bullet b){
}
@@ -15,9 +15,6 @@ public class TechTree implements ContentList{
root = node(coreShard, () -> {
node(conveyor, () -> {
node(launchPad, () -> {
});
node(junction, () -> {
node(itemBridge);
@@ -28,7 +25,9 @@ public class TechTree implements ContentList{
node(container, () -> {
node(unloader);
node(vault, () -> {
node(launchPad, () -> {
});
});
});
@@ -100,25 +99,25 @@ public class TechTree implements ContentList{
});
node(mechanicalDrill, () -> {
node(pneumaticDrill, () -> {
node(cultivator, () -> {
});
node(laserDrill, () -> {
node(blastDrill, () -> {
node(graphitePress, () -> {
node(pneumaticDrill, () -> {
node(cultivator, () -> {
});
node(waterExtractor, () -> {
node(oilExtractor, () -> {
node(laserDrill, () -> {
node(blastDrill, () -> {
});
node(waterExtractor, () -> {
node(oilExtractor, () -> {
});
});
});
});
});
node(graphitePress, () -> {
node(pyratiteMixer, () -> {
node(blastMixer, () -> {
@@ -185,68 +184,68 @@ public class TechTree implements ContentList{
});
});
});
});
node(powerNode, () -> {
node(combustionGenerator, () -> {
node(powerNodeLarge, () -> {
node(battery, () -> {
node(batteryLarge, () -> {
node(surgeTower, () -> {
node(powerNode, () -> {
node(powerNodeLarge, () -> {
node(battery, () -> {
node(batteryLarge, () -> {
node(surgeTower, () -> {
});
});
});
node(mendProjector, () -> {
node(forceProjector, () -> {
node(overdriveProjector, () -> {
});
});
node(repairPoint, () -> {
});
});
});
node(mendProjector, () -> {
node(forceProjector, () -> {
node(overdriveProjector, () -> {
});
});
node(repairPoint, () -> {
});
});
});
node(turbineGenerator, () -> {
node(thermalGenerator, () -> {
node(rtgGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, () -> {
node(impactReactor, () -> {
node(turbineGenerator, () -> {
node(thermalGenerator, () -> {
node(rtgGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, () -> {
node(impactReactor, () -> {
});
});
});
});
});
});
});
node(solarPanel, () -> {
node(largeSolarPanel, () -> {
node(solarPanel, () -> {
node(largeSolarPanel, () -> {
});
});
});
node(alphaDartPad, () -> {
node(deltaPad, () -> {
node(spiritFactory, () -> {
node(phantomFactory);
});
node(javelinPad, () -> {
node(tridentPad, () -> {
node(glaivePad);
});
});
});
node(tauPad, () -> {
node(omegaPad, () -> {
node(alphaDartPad, () -> {
node(deltaPad, () -> {
node(spiritFactory, () -> {
node(phantomFactory);
});
node(javelinPad, () -> {
node(tridentPad, () -> {
node(glaivePad);
});
});
node(tauPad, () -> {
node(omegaPad, () -> {
});
});
});
});
@@ -258,7 +257,7 @@ public class TechTree implements ContentList{
private TechNode node(Block block, Runnable children){
ItemStack[] requirements = new ItemStack[block.buildRequirements.length];
for(int i = 0; i < requirements.length; i++){
requirements[i] = new ItemStack(block.buildRequirements[i].item, block.buildRequirements[i].amount * 30);
requirements[i] = new ItemStack(block.buildRequirements[i].item, block.buildRequirements[i].amount * 8);
}
return new TechNode(block, requirements, children);
@@ -199,7 +199,7 @@ public class Zones implements ContentList{
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 60;
waveSpacing = 60 * 80;
spawns = Array.with(
new SpawnGroup(UnitTypes.wraith){{
unitScaling = 2;
@@ -279,7 +279,7 @@ public class Zones implements ContentList{
stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2)
.dist(2.5f, true)
.decor(new Decoration(Blocks.stainedStone, Blocks.stainedBoulder, 0.01))){{
.decor(new Decoration(Blocks.moss, Blocks.stainedBoulder, 0.01))){{
loadout = Loadouts.basicFoundation;
baseLaunchCost = ItemStack.with(Items.copper, 100, Items.lead, 200, Items.silicon, 100);
startingItems = ItemStack.list(Items.copper, 400, Items.lead, 100);
@@ -432,7 +432,6 @@ public class World implements ApplicationListener{
}
public void addDarkness(Tile[][] tiles){
byte[][] dark = new byte[tiles.length][tiles[0].length];
byte[][] writeBuffer = new byte[tiles.length][tiles[0].length];
+17 -4
View File
@@ -3,6 +3,7 @@ package io.anuke.mindustry.io;
import io.anuke.arc.collection.IntIntMap;
import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.collection.ObjectMap.Entry;
import io.anuke.arc.files.FileHandle;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.Pixmap;
import io.anuke.arc.graphics.Pixmap.Format;
@@ -20,20 +21,32 @@ import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.LegacyColorMapper;
import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import static io.anuke.mindustry.Vars.content;
/**
* Reads and writes map files.
*/
//TODO name mapping
public class MapIO{
private static final int[] pngHeader = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
private static final int version = 0;
private static IntIntMap defaultBlockMap = new IntIntMap();
public static boolean isImage(FileHandle file){
try(InputStream stream = file.read()){
for(int i1 : pngHeader){
if(stream.read() != i1){
return false;
}
}
return true;
}catch(IOException e){
return false;
}
}
private static void loadDefaultBlocks(){
for(Block block : content.blocks()){
defaultBlockMap.put(block.id, block.id);
@@ -1,12 +1,12 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Interpolation;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.actions.Actions;
import io.anuke.arc.scene.event.Touchable;
@@ -35,16 +35,14 @@ public class TechTreeDialog extends FloatingDialog{
public TechTreeDialog(){
super("");
TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = Unit.dp.scl(60f);
layout.gapBetweenNodes = Unit.dp.scl(40f);
layout.layout(root);
titleTable.remove();
margin(0f).marginBottom(8);
cont.stack(new View(), items = new ItemsDisplay()).grow();
shown(() -> checkNodes(root));
shown(() -> {
checkNodes(root);
treeLayout();
});
hidden(ui.deploy::setup);
addCloseButton();
@@ -59,6 +57,25 @@ public class TechTreeDialog extends FloatingDialog{
drawDefaultBackground(x, y);
}
void treeLayout(){
TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = Unit.dp.scl(60f);
layout.gapBetweenNodes = Unit.dp.scl(40f);
LayoutNode node = new LayoutNode(root, null);
layout.layout(node);
copyInfo(node);
}
void copyInfo(LayoutNode node){
node.node.x = node.x;
node.node.y = node.y;
if(node.children != null){
for(LayoutNode child : node.children){
copyInfo(child);
}
}
}
void checkNodes(TechTreeNode node){
boolean locked = locked(node.node);
if(!locked) node.visible = true;
@@ -71,24 +88,13 @@ public class TechTreeDialog extends FloatingDialog{
}
void showToast(String info){
int maxIndex = 0;
for(Element e : Core.scene.root.getChildren()){
if("toast".equals(e.getName())){
maxIndex = Math.max(maxIndex, (Integer)e.getUserObject() + 1);
}
}
int m = maxIndex;
Table table = new Table();
table.actions(Actions.fadeOut(7f, Interpolation.fade), Actions.removeActor());
table.actions(Actions.fadeOut(0.5f, Interpolation.fade), Actions.removeActor());
table.top().add(info);
table.setName("toast");
table.setUserObject(maxIndex);
table.update(() -> {
table.toFront();
table.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight() - 21 - m*20f, Align.top);
table.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight() - 21, Align.top);
});
Core.scene.add(table);
}
@@ -97,6 +103,19 @@ public class TechTreeDialog extends FloatingDialog{
return node.block.locked();
}
class LayoutNode extends TreeNode<LayoutNode>{
final TechTreeNode node;
LayoutNode(TechTreeNode node, LayoutNode parent){
this.node = node;
this.parent = parent;
this.width = this.height = nodeSize;
if(node.children != null){
children = Array.with(node.children).select(n -> n.visible).map(t -> new LayoutNode(t, this)).toArray(LayoutNode.class);
}
}
}
class TechTreeNode extends TreeNode<TechTreeNode>{
final TechNode node;
boolean visible = true;
@@ -126,6 +145,7 @@ public class TechTreeDialog extends FloatingDialog{
for(TechTreeNode node : nodes){
ImageButton button = new ImageButton(node.node.block.icon(Icon.medium), "node");
button.visible(() -> node.visible);
button.clicked(() -> {
if(mobile){
hoverNode = button;
@@ -174,7 +194,9 @@ public class TechTreeDialog extends FloatingDialog{
showToast(Core.bundle.format("researched", node.block.localizedName));
checkNodes(root);
hoverNode = null;
treeLayout();
rebuild();
Core.scene.act();
}
void rebuild(){
@@ -242,9 +264,11 @@ public class TechTreeDialog extends FloatingDialog{
float offsetX = panX + width/2f + x, offsetY = panY + height/2f + y;
for(TechTreeNode node : nodes){
if(!node.visible) continue;
for(TechTreeNode child : node.children){
Lines.stroke(Unit.dp.scl(3f), locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent);
if(!child.visible) continue;
Lines.stroke(Unit.dp.scl(3f), locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
}
}
@@ -523,6 +523,7 @@ public class Block extends BlockStorage{
/**Never use outside of the editor!*/
public TextureRegion[] editorVariantRegions(){
if(editorVariantRegions == null){
variantRegions();
editorVariantRegions = new TextureRegion[variantRegions.length];
for(int i = 0; i < variantRegions.length; i ++){
AtlasRegion region = (AtlasRegion)variantRegions[i];
@@ -20,12 +20,12 @@ public class LegacyColorMapper implements ContentList{
public void load(){
defaultValue = new LegacyBlock(Blocks.stone, Blocks.air);
map("ff0000", Blocks.stainedStone, Blocks.spawn);
map("ff0000", Blocks.stone, Blocks.spawn);
map("00ff00", Blocks.stone);
map("323232", Blocks.stone);
map("646464", Blocks.stone, Blocks.rocks);
map("50965a", Blocks.stainedStone);
map("5ab464", Blocks.stainedStone, Blocks.stainedRocks);
map("50965a", Blocks.grass);
map("5ab464", Blocks.grass, Blocks.stainedRocks);
map("506eb4", Blocks.water);
map("465a96", Blocks.deepwater);
map("252525", Blocks.ignarock);
@@ -35,7 +35,7 @@ public class LegacyColorMapper implements ContentList{
map("c2d1d2", Blocks.snow);
map("c4e3e7", Blocks.ice);
map("f7feff", Blocks.snow, Blocks.snowrocks);
map("6e501e", Blocks.stainedStone);
map("6e501e", Blocks.stainedStoneRed);
map("ed5334", Blocks.stainedStoneRed);
map("292929", Blocks.tar);
map("c3a490", OreBlock.get(Blocks.stone, Items.copper));