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

View File

@@ -36,7 +36,7 @@ public class Blocks implements ContentList{
//environment //environment
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow, air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster, 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, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks,
//crafting //crafting
@@ -183,6 +183,10 @@ public class Blocks implements ContentList{
}}; }};
salt = new Floor("salt"){{
variants = 0;
}};
iceSnow = new Floor("ice-snow"){{ iceSnow = new Floor("ice-snow"){{
variants = 3; variants = 3;
}}; }};
@@ -240,9 +244,8 @@ public class Blocks implements ContentList{
variants = 2; variants = 2;
}}; }};
stainedStone = new Floor("stained-stone"){{ moss = new Floor("moss"){{
edgeStyle = "blocky"; variants = 3;
hasOres = true;
}}; }};
stainedRocksRed = new StaticWall("stained-rocks-red"){{ stainedRocksRed = new StaticWall("stained-rocks-red"){{
@@ -250,8 +253,8 @@ public class Blocks implements ContentList{
}}; }};
stainedStoneRed = new Floor("stained-stone-red"){{ stainedStoneRed = new Floor("stained-stone-red"){{
edgeStyle = "blocky";
hasOres = true; hasOres = true;
variants = 1;
}}; }};
stainedRocksYellow = new StaticWall("stained-rocks-yellow"){{ stainedRocksYellow = new StaticWall("stained-rocks-yellow"){{
@@ -259,7 +262,7 @@ public class Blocks implements ContentList{
}}; }};
stainedStoneYellow = new Floor("stained-stone-yellow"){{ stainedStoneYellow = new Floor("stained-stone-yellow"){{
edgeStyle = "blocky"; variants = 1;
}}; }};
stainedBoulder = new Rock("stained-boulder"){{ stainedBoulder = new Rock("stained-boulder"){{

View File

@@ -609,6 +609,11 @@ public class Bullets implements ContentList{
keepVelocity = false; keepVelocity = false;
} }
@Override
public float range(){
return 70f;
}
@Override @Override
public void draw(Bullet b){ public void draw(Bullet b){
} }

View File

@@ -15,9 +15,6 @@ public class TechTree implements ContentList{
root = node(coreShard, () -> { root = node(coreShard, () -> {
node(conveyor, () -> { node(conveyor, () -> {
node(launchPad, () -> {
});
node(junction, () -> { node(junction, () -> {
node(itemBridge); node(itemBridge);
@@ -28,7 +25,9 @@ public class TechTree implements ContentList{
node(container, () -> { node(container, () -> {
node(unloader); node(unloader);
node(vault, () -> { node(vault, () -> {
node(launchPad, () -> {
});
}); });
}); });
@@ -100,25 +99,25 @@ public class TechTree implements ContentList{
}); });
node(mechanicalDrill, () -> { node(mechanicalDrill, () -> {
node(pneumaticDrill, () -> { node(graphitePress, () -> {
node(cultivator, () -> { node(pneumaticDrill, () -> {
node(cultivator, () -> {
});
node(laserDrill, () -> {
node(blastDrill, () -> {
}); });
node(waterExtractor, () -> { node(laserDrill, () -> {
node(oilExtractor, () -> { node(blastDrill, () -> {
}); });
node(waterExtractor, () -> {
node(oilExtractor, () -> {
});
});
}); });
}); });
});
node(graphitePress, () -> {
node(pyratiteMixer, () -> { node(pyratiteMixer, () -> {
node(blastMixer, () -> { node(blastMixer, () -> {
@@ -185,68 +184,68 @@ public class TechTree implements ContentList{
}); });
}); });
}); });
});
node(powerNode, () -> {
node(combustionGenerator, () -> { node(combustionGenerator, () -> {
node(powerNodeLarge, () -> { node(powerNode, () -> {
node(battery, () -> { node(powerNodeLarge, () -> {
node(batteryLarge, () -> { node(battery, () -> {
node(surgeTower, () -> { node(batteryLarge, () -> {
node(surgeTower, () -> {
});
});
});
node(mendProjector, () -> {
node(forceProjector, () -> {
node(overdriveProjector, () -> {
});
});
node(repairPoint, () -> {
}); });
}); });
}); });
node(mendProjector, () -> { node(turbineGenerator, () -> {
node(forceProjector, () -> { node(thermalGenerator, () -> {
node(overdriveProjector, () -> { node(rtgGenerator, () -> {
node(differentialGenerator, () -> {
}); node(thoriumReactor, () -> {
}); node(impactReactor, () -> {
node(repairPoint, () -> {
});
});
});
node(turbineGenerator, () -> {
node(thermalGenerator, () -> {
node(rtgGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, () -> {
node(impactReactor, () -> {
});
}); });
}); });
}); });
}); });
}); });
});
node(solarPanel, () -> { node(solarPanel, () -> {
node(largeSolarPanel, () -> { node(largeSolarPanel, () -> {
});
});
});
node(alphaDartPad, () -> {
node(deltaPad, () -> {
node(spiritFactory, () -> {
node(phantomFactory);
});
node(javelinPad, () -> {
node(tridentPad, () -> {
node(glaivePad);
}); });
}); });
});
node(tauPad, () -> { node(alphaDartPad, () -> {
node(omegaPad, () -> { 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){ private TechNode node(Block block, Runnable children){
ItemStack[] requirements = new ItemStack[block.buildRequirements.length]; ItemStack[] requirements = new ItemStack[block.buildRequirements.length];
for(int i = 0; i < requirements.length; i++){ 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); return new TechNode(block, requirements, children);

View File

@@ -199,7 +199,7 @@ public class Zones implements ContentList{
rules = () -> new Rules(){{ rules = () -> new Rules(){{
waves = true; waves = true;
waveTimer = true; waveTimer = true;
waveSpacing = 60 * 60; waveSpacing = 60 * 80;
spawns = Array.with( spawns = Array.with(
new SpawnGroup(UnitTypes.wraith){{ new SpawnGroup(UnitTypes.wraith){{
unitScaling = 2; unitScaling = 2;
@@ -279,7 +279,7 @@ public class Zones implements ContentList{
stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2) stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2)
.dist(2.5f, true) .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; loadout = Loadouts.basicFoundation;
baseLaunchCost = ItemStack.with(Items.copper, 100, Items.lead, 200, Items.silicon, 100); baseLaunchCost = ItemStack.with(Items.copper, 100, Items.lead, 200, Items.silicon, 100);
startingItems = ItemStack.list(Items.copper, 400, Items.lead, 100); startingItems = ItemStack.list(Items.copper, 400, Items.lead, 100);

View File

@@ -432,7 +432,6 @@ public class World implements ApplicationListener{
} }
public void addDarkness(Tile[][] tiles){ public void addDarkness(Tile[][] tiles){
byte[][] dark = new byte[tiles.length][tiles[0].length]; byte[][] dark = new byte[tiles.length][tiles[0].length];
byte[][] writeBuffer = new byte[tiles.length][tiles[0].length]; byte[][] writeBuffer = new byte[tiles.length][tiles[0].length];

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.io;
import io.anuke.arc.collection.IntIntMap; import io.anuke.arc.collection.IntIntMap;
import io.anuke.arc.collection.ObjectMap; import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.collection.ObjectMap.Entry; import io.anuke.arc.collection.ObjectMap.Entry;
import io.anuke.arc.files.FileHandle;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.Pixmap; import io.anuke.arc.graphics.Pixmap;
import io.anuke.arc.graphics.Pixmap.Format; 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;
import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock; import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock;
import java.io.DataInputStream; import java.io.*;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
/** /**
* Reads and writes map files. * Reads and writes map files.
*/ */
//TODO name mapping
public class MapIO{ public class MapIO{
private static final int[] pngHeader = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
private static final int version = 0; private static final int version = 0;
private static IntIntMap defaultBlockMap = new IntIntMap(); 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(){ private static void loadDefaultBlocks(){
for(Block block : content.blocks()){ for(Block block : content.blocks()){
defaultBlockMap.put(block.id, block.id); defaultBlockMap.put(block.id, block.id);

View File

@@ -1,12 +1,12 @@
package io.anuke.mindustry.ui.dialogs; package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines; import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Interpolation; import io.anuke.arc.math.Interpolation;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.Group; import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.actions.Actions; import io.anuke.arc.scene.actions.Actions;
import io.anuke.arc.scene.event.Touchable; import io.anuke.arc.scene.event.Touchable;
@@ -35,16 +35,14 @@ public class TechTreeDialog extends FloatingDialog{
public TechTreeDialog(){ public TechTreeDialog(){
super(""); super("");
TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = Unit.dp.scl(60f);
layout.gapBetweenNodes = Unit.dp.scl(40f);
layout.layout(root);
titleTable.remove(); titleTable.remove();
margin(0f).marginBottom(8); margin(0f).marginBottom(8);
cont.stack(new View(), items = new ItemsDisplay()).grow(); cont.stack(new View(), items = new ItemsDisplay()).grow();
shown(() -> checkNodes(root)); shown(() -> {
checkNodes(root);
treeLayout();
});
hidden(ui.deploy::setup); hidden(ui.deploy::setup);
addCloseButton(); addCloseButton();
@@ -59,6 +57,25 @@ public class TechTreeDialog extends FloatingDialog{
drawDefaultBackground(x, y); 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){ void checkNodes(TechTreeNode node){
boolean locked = locked(node.node); boolean locked = locked(node.node);
if(!locked) node.visible = true; if(!locked) node.visible = true;
@@ -71,24 +88,13 @@ public class TechTreeDialog extends FloatingDialog{
} }
void showToast(String info){ 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 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.top().add(info);
table.setName("toast"); table.setName("toast");
table.setUserObject(maxIndex);
table.update(() -> { table.update(() -> {
table.toFront(); 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); Core.scene.add(table);
} }
@@ -97,6 +103,19 @@ public class TechTreeDialog extends FloatingDialog{
return node.block.locked(); 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>{ class TechTreeNode extends TreeNode<TechTreeNode>{
final TechNode node; final TechNode node;
boolean visible = true; boolean visible = true;
@@ -126,6 +145,7 @@ public class TechTreeDialog extends FloatingDialog{
for(TechTreeNode node : nodes){ for(TechTreeNode node : nodes){
ImageButton button = new ImageButton(node.node.block.icon(Icon.medium), "node"); ImageButton button = new ImageButton(node.node.block.icon(Icon.medium), "node");
button.visible(() -> node.visible);
button.clicked(() -> { button.clicked(() -> {
if(mobile){ if(mobile){
hoverNode = button; hoverNode = button;
@@ -174,7 +194,9 @@ public class TechTreeDialog extends FloatingDialog{
showToast(Core.bundle.format("researched", node.block.localizedName)); showToast(Core.bundle.format("researched", node.block.localizedName));
checkNodes(root); checkNodes(root);
hoverNode = null; hoverNode = null;
treeLayout();
rebuild(); rebuild();
Core.scene.act();
} }
void rebuild(){ void rebuild(){
@@ -242,9 +264,11 @@ public class TechTreeDialog extends FloatingDialog{
float offsetX = panX + width/2f + x, offsetY = panY + height/2f + y; float offsetX = panX + width/2f + x, offsetY = panY + height/2f + y;
for(TechTreeNode node : nodes){ for(TechTreeNode node : nodes){
if(!node.visible) continue;
for(TechTreeNode child : node.children){ 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); Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
} }
} }

View File

@@ -523,6 +523,7 @@ public class Block extends BlockStorage{
/**Never use outside of the editor!*/ /**Never use outside of the editor!*/
public TextureRegion[] editorVariantRegions(){ public TextureRegion[] editorVariantRegions(){
if(editorVariantRegions == null){ if(editorVariantRegions == null){
variantRegions();
editorVariantRegions = new TextureRegion[variantRegions.length]; editorVariantRegions = new TextureRegion[variantRegions.length];
for(int i = 0; i < variantRegions.length; i ++){ for(int i = 0; i < variantRegions.length; i ++){
AtlasRegion region = (AtlasRegion)variantRegions[i]; AtlasRegion region = (AtlasRegion)variantRegions[i];

View File

@@ -20,12 +20,12 @@ public class LegacyColorMapper implements ContentList{
public void load(){ public void load(){
defaultValue = new LegacyBlock(Blocks.stone, Blocks.air); defaultValue = new LegacyBlock(Blocks.stone, Blocks.air);
map("ff0000", Blocks.stainedStone, Blocks.spawn); map("ff0000", Blocks.stone, Blocks.spawn);
map("00ff00", Blocks.stone); map("00ff00", Blocks.stone);
map("323232", Blocks.stone); map("323232", Blocks.stone);
map("646464", Blocks.stone, Blocks.rocks); map("646464", Blocks.stone, Blocks.rocks);
map("50965a", Blocks.stainedStone); map("50965a", Blocks.grass);
map("5ab464", Blocks.stainedStone, Blocks.stainedRocks); map("5ab464", Blocks.grass, Blocks.stainedRocks);
map("506eb4", Blocks.water); map("506eb4", Blocks.water);
map("465a96", Blocks.deepwater); map("465a96", Blocks.deepwater);
map("252525", Blocks.ignarock); map("252525", Blocks.ignarock);
@@ -35,7 +35,7 @@ public class LegacyColorMapper implements ContentList{
map("c2d1d2", Blocks.snow); map("c2d1d2", Blocks.snow);
map("c4e3e7", Blocks.ice); map("c4e3e7", Blocks.ice);
map("f7feff", Blocks.snow, Blocks.snowrocks); map("f7feff", Blocks.snow, Blocks.snowrocks);
map("6e501e", Blocks.stainedStone); map("6e501e", Blocks.stainedStoneRed);
map("ed5334", Blocks.stainedStoneRed); map("ed5334", Blocks.stainedStoneRed);
map("292929", Blocks.tar); map("292929", Blocks.tar);
map("c3a490", OreBlock.get(Blocks.stone, Items.copper)); map("c3a490", OreBlock.get(Blocks.stone, Items.copper));

View File

@@ -229,6 +229,7 @@ public class Generators {
image.draw(ImagePacker.get(item.name + (i+1))); image.draw(ImagePacker.get(item.name + (i+1)));
image.save("../blocks/environment/ore-" + item.name + "-" + base.name + (i+1)); image.save("../blocks/environment/ore-" + item.name + "-" + base.name + (i+1));
image.save("../editor/editor-ore-" + item.name + "-" + base.name + (i+1));
//save icons //save icons
image.save(block.name + "-icon-full"); image.save(block.name + "-icon-full");