World generation launch pad preset
This commit is contained in:
@@ -8,6 +8,7 @@ import io.anuke.arc.entities.impl.EffectEntity;
|
||||
import io.anuke.arc.entities.trait.DrawTrait;
|
||||
import io.anuke.arc.files.FileHandle;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.util.Structs;
|
||||
import io.anuke.mindustry.core.*;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
@@ -149,7 +150,7 @@ public class Vars{
|
||||
}
|
||||
}
|
||||
|
||||
Arrays.sort(locales, (l1, l2) -> l1.getDisplayName(l1).compareTo(l2.getDisplayName(l2)));
|
||||
Arrays.sort(locales, Structs.comparing(l -> l.getDisplayName(l), String.CASE_INSENSITIVE_ORDER));
|
||||
Version.init();
|
||||
|
||||
content = new ContentLoader();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Blocks implements ContentList{
|
||||
public static Block
|
||||
|
||||
//environment
|
||||
air, blockpart, spawn, space, metalfloor, deepwater, water, lava, tar, stone, blackstone, dirt, sand, ice, snow,
|
||||
air, blockpart, spawn, space, metalfloor, deepwater, water, tar, stone, blackstone, dirt, sand, ice, snow,
|
||||
grass, shrub, rock, icerock, blackrock,
|
||||
|
||||
//crafting
|
||||
|
||||
@@ -18,7 +18,6 @@ public class GlobalData{
|
||||
|
||||
public GlobalData(){
|
||||
Core.settings.setSerializer(ContentType.class, (stream, t) -> stream.writeInt(t.ordinal()), stream -> ContentType.values()[stream.readInt()]);
|
||||
Core.settings.setSerializer(Item.class, (stream, t) -> stream.writeUTF(t.name), stream -> Vars.content.getByName(ContentType.item, stream.readUTF()));
|
||||
}
|
||||
|
||||
public void addItem(Item item, int amount){
|
||||
@@ -32,7 +31,8 @@ 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.getContentName());
|
||||
return true;
|
||||
//return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.getContentName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,12 +73,16 @@ public class GlobalData{
|
||||
@SuppressWarnings("unchecked")
|
||||
public void load(){
|
||||
unlocked = Core.settings.getObject("unlocks", ObjectMap.class, ObjectMap::new);
|
||||
items = Core.settings.getObject("items", ObjectIntMap.class, ObjectIntMap::new);
|
||||
for(Item item : Vars.content.items()){
|
||||
items.put(item, Core.settings.getInt("item-" + item.name, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public void save(){
|
||||
Core.settings.putObject("unlocks", unlocked);
|
||||
Core.settings.putObject("items", items);
|
||||
for(Item item : Vars.content.items()){
|
||||
Core.settings.put("item-" + item.name, items.get(item, 0));
|
||||
}
|
||||
Core.settings.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class BlockRenderer{
|
||||
private final static int initialRequests = 32 * 32;
|
||||
private final static int expandr = 6;
|
||||
private final static boolean disableShadows = true;
|
||||
private final static boolean disableShadows = false;
|
||||
private final static Color shadowColor = new Color(0, 0, 0, 0.15f);
|
||||
|
||||
public final FloorRenderer floor = new FloorRenderer();
|
||||
|
||||
@@ -29,7 +30,7 @@ public class BlockRenderer{
|
||||
private int lastCamX, lastCamY, lastRangeX, lastRangeY;
|
||||
private int requestidx = 0;
|
||||
private int iterateidx = 0;
|
||||
private FrameBuffer shadows = new FrameBuffer(1, 1);
|
||||
private FrameBuffer shadows = new FrameBuffer(2, 2);
|
||||
|
||||
public BlockRenderer(){
|
||||
|
||||
@@ -61,14 +62,14 @@ public class BlockRenderer{
|
||||
}
|
||||
|
||||
Tmp.tr1.set(shadows.getTexture());
|
||||
Shaders.outline.color.set(0, 0, 0, 0.15f);
|
||||
Shaders.outline.color.set(shadowColor);
|
||||
Shaders.outline.scl = renderer.cameraScale()/3f;
|
||||
Shaders.outline.region = Tmp.tr1;
|
||||
|
||||
Draw.flush();
|
||||
shadows.begin();
|
||||
Core.graphics.clear(Color.CLEAR);
|
||||
Draw.color(Color.BLACK);
|
||||
Draw.color(shadowColor);
|
||||
drawBlocks(Layer.shadow);
|
||||
Draw.color();
|
||||
Draw.flush();
|
||||
@@ -89,8 +90,8 @@ public class BlockRenderer{
|
||||
int avgx = (int)(camera.position.x / tilesize);
|
||||
int avgy = (int)(camera.position.y / tilesize);
|
||||
|
||||
int rangex = (int) (camera.width / tilesize / 2) + 2;
|
||||
int rangey = (int) (camera.height / tilesize / 2) + 2;
|
||||
int rangex = (int) (camera.width / tilesize / 2) + 3;
|
||||
int rangey = (int) (camera.height / tilesize / 2) + 3;
|
||||
|
||||
if(avgx == lastCamX && avgy == lastCamY && lastRangeX == rangex && lastRangeY == rangey){
|
||||
return;
|
||||
@@ -192,7 +193,6 @@ public class BlockRenderer{
|
||||
}
|
||||
|
||||
public void skipLayer(Layer stopAt){
|
||||
|
||||
for(; iterateidx < requestidx; iterateidx++){
|
||||
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
||||
break;
|
||||
|
||||
@@ -185,6 +185,7 @@ public class WorldGenerator{
|
||||
}
|
||||
|
||||
world.setBlock(tiles[spawns.get(0).x][spawns.get(0).y], Blocks.core, Team.blue);
|
||||
world.setBlock(tiles[spawns.get(0).x][spawns.get(0).y - 3], Blocks.launchPad, Team.blue);
|
||||
|
||||
if(state.mode.isPvp){
|
||||
world.setBlock(tiles[spawns.get(1).x][spawns.get(1).y], Blocks.core, Team.red);
|
||||
@@ -310,8 +311,6 @@ public class WorldGenerator{
|
||||
if(iceridge > 0.25 && minDst > lerpDst/1.5f){
|
||||
elevation ++;
|
||||
}
|
||||
}else if(minDst > lerpDst/1.5f){
|
||||
floor = Blocks.lava;
|
||||
}else{
|
||||
floor = Blocks.blackstone;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
|
||||
public class DeployDialog extends FloatingDialog{
|
||||
|
||||
@@ -24,18 +25,18 @@ public class DeployDialog extends FloatingDialog{
|
||||
|
||||
ObjectIntMap<Item> items = Vars.data.items();
|
||||
for(Item item : Vars.content.items()){
|
||||
if(Vars.data.isUnlocked(item)){
|
||||
add(items.get(item, 0) + "");
|
||||
addImage(item.region).size(8*3).pad(3);
|
||||
add(item.localizedName());
|
||||
if(item.type == ItemType.material && Vars.data.isUnlocked(item)){
|
||||
add(items.get(item, 0) + "").left();
|
||||
addImage(item.region).size(8*4).pad(4);
|
||||
add("[LIGHT_GRAY]" + item.localizedName()).left();
|
||||
row();
|
||||
}
|
||||
}
|
||||
}}, new Table(){{
|
||||
addButton("$text.play", () -> {
|
||||
addButton("Wasteland", () -> {
|
||||
hide();
|
||||
Vars.world.generator.playRandomMap();
|
||||
}).margin(15);
|
||||
}).size(190f, 60f);
|
||||
}}).grow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class LegacyColorMapper implements ContentList{
|
||||
map("c4e3e7", Blocks.ice, 0);
|
||||
map("f7feff", Blocks.snow, 1);
|
||||
map("6e501e", Blocks.dirt, 0);
|
||||
map("ed5334", Blocks.lava, 0);
|
||||
map("ed5334", Blocks.blackstone, 0);
|
||||
map("292929", Blocks.tar, 0);
|
||||
map("c3a490", OreBlock.get(Blocks.stone, Items.copper), 0);
|
||||
map("161616", OreBlock.get(Blocks.stone, Items.coal), 0);
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Conveyor extends Block{
|
||||
private static final float itemSpace = 0.135f * 4f;
|
||||
private static final float itemSpace = 0.135f * 3f;
|
||||
private static final float offsetScl = 128f * 3f;
|
||||
private static final float minmove = 1f / (Short.MAX_VALUE - 2);
|
||||
private static ItemPos drawpos = new ItemPos();
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package io.anuke.mindustry.world.blocks.sandbox;
|
||||
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.distribution.Sorter.SorterEntity;
|
||||
import io.anuke.mindustry.world.blocks.distribution.Sorter;
|
||||
|
||||
public class ItemSource extends Block{
|
||||
public class ItemSource extends Sorter{
|
||||
|
||||
public ItemSource(String name){
|
||||
super(name);
|
||||
hasItems = true;
|
||||
update = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
@@ -12,7 +13,6 @@ import static io.anuke.mindustry.Vars.data;
|
||||
|
||||
public class LaunchPad extends Block{
|
||||
protected final int timerLaunch = timers++;
|
||||
|
||||
/**Time inbetween launches.*/
|
||||
protected float launchTime;
|
||||
|
||||
@@ -24,6 +24,11 @@ public class LaunchPad extends Block{
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
return item.type == ItemType.material && tile.entity.items.get(item) < getMaximumAccepted(tile, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
TileEntity entity = tile.entity;
|
||||
|
||||
Reference in New Issue
Block a user