World generation launch pad preset
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 538 B After Width: | Height: | Size: 561 B |
BIN
core/assets-raw/sprites/items/item-bioglass.png
Normal file
BIN
core/assets-raw/sprites/items/item-bioglass.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 274 B |
BIN
core/assets-raw/sprites/items/item-graphite.png
Normal file
BIN
core/assets-raw/sprites/items/item-graphite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 218 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 335 KiB After Width: | Height: | Size: 335 KiB |
@@ -8,6 +8,7 @@ import io.anuke.arc.entities.impl.EffectEntity;
|
|||||||
import io.anuke.arc.entities.trait.DrawTrait;
|
import io.anuke.arc.entities.trait.DrawTrait;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
|
import io.anuke.arc.util.Structs;
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
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();
|
Version.init();
|
||||||
|
|
||||||
content = new ContentLoader();
|
content = new ContentLoader();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class Blocks implements ContentList{
|
|||||||
public static Block
|
public static Block
|
||||||
|
|
||||||
//environment
|
//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,
|
grass, shrub, rock, icerock, blackrock,
|
||||||
|
|
||||||
//crafting
|
//crafting
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ public class GlobalData{
|
|||||||
|
|
||||||
public GlobalData(){
|
public GlobalData(){
|
||||||
Core.settings.setSerializer(ContentType.class, (stream, t) -> stream.writeInt(t.ordinal()), stream -> ContentType.values()[stream.readInt()]);
|
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){
|
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.*/
|
/** Returns whether or not this piece of content is unlocked yet.*/
|
||||||
public boolean isUnlocked(UnlockableContent content){
|
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")
|
@SuppressWarnings("unchecked")
|
||||||
public void load(){
|
public void load(){
|
||||||
unlocked = Core.settings.getObject("unlocks", ObjectMap.class, ObjectMap::new);
|
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(){
|
public void save(){
|
||||||
Core.settings.putObject("unlocks", unlocked);
|
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();
|
Core.settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
public class BlockRenderer{
|
public class BlockRenderer{
|
||||||
private final static int initialRequests = 32 * 32;
|
private final static int initialRequests = 32 * 32;
|
||||||
private final static int expandr = 6;
|
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();
|
public final FloorRenderer floor = new FloorRenderer();
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ public class BlockRenderer{
|
|||||||
private int lastCamX, lastCamY, lastRangeX, lastRangeY;
|
private int lastCamX, lastCamY, lastRangeX, lastRangeY;
|
||||||
private int requestidx = 0;
|
private int requestidx = 0;
|
||||||
private int iterateidx = 0;
|
private int iterateidx = 0;
|
||||||
private FrameBuffer shadows = new FrameBuffer(1, 1);
|
private FrameBuffer shadows = new FrameBuffer(2, 2);
|
||||||
|
|
||||||
public BlockRenderer(){
|
public BlockRenderer(){
|
||||||
|
|
||||||
@@ -61,14 +62,14 @@ public class BlockRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tmp.tr1.set(shadows.getTexture());
|
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.scl = renderer.cameraScale()/3f;
|
||||||
Shaders.outline.region = Tmp.tr1;
|
Shaders.outline.region = Tmp.tr1;
|
||||||
|
|
||||||
Draw.flush();
|
Draw.flush();
|
||||||
shadows.begin();
|
shadows.begin();
|
||||||
Core.graphics.clear(Color.CLEAR);
|
Core.graphics.clear(Color.CLEAR);
|
||||||
Draw.color(Color.BLACK);
|
Draw.color(shadowColor);
|
||||||
drawBlocks(Layer.shadow);
|
drawBlocks(Layer.shadow);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
Draw.flush();
|
Draw.flush();
|
||||||
@@ -89,8 +90,8 @@ public class BlockRenderer{
|
|||||||
int avgx = (int)(camera.position.x / tilesize);
|
int avgx = (int)(camera.position.x / tilesize);
|
||||||
int avgy = (int)(camera.position.y / tilesize);
|
int avgy = (int)(camera.position.y / tilesize);
|
||||||
|
|
||||||
int rangex = (int) (camera.width / tilesize / 2) + 2;
|
int rangex = (int) (camera.width / tilesize / 2) + 3;
|
||||||
int rangey = (int) (camera.height / tilesize / 2) + 2;
|
int rangey = (int) (camera.height / tilesize / 2) + 3;
|
||||||
|
|
||||||
if(avgx == lastCamX && avgy == lastCamY && lastRangeX == rangex && lastRangeY == rangey){
|
if(avgx == lastCamX && avgy == lastCamY && lastRangeX == rangex && lastRangeY == rangey){
|
||||||
return;
|
return;
|
||||||
@@ -192,7 +193,6 @@ public class BlockRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void skipLayer(Layer stopAt){
|
public void skipLayer(Layer stopAt){
|
||||||
|
|
||||||
for(; iterateidx < requestidx; iterateidx++){
|
for(; iterateidx < requestidx; iterateidx++){
|
||||||
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
||||||
break;
|
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], Blocks.core, Team.blue);
|
||||||
|
world.setBlock(tiles[spawns.get(0).x][spawns.get(0).y - 3], Blocks.launchPad, Team.blue);
|
||||||
|
|
||||||
if(state.mode.isPvp){
|
if(state.mode.isPvp){
|
||||||
world.setBlock(tiles[spawns.get(1).x][spawns.get(1).y], Blocks.core, Team.red);
|
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){
|
if(iceridge > 0.25 && minDst > lerpDst/1.5f){
|
||||||
elevation ++;
|
elevation ++;
|
||||||
}
|
}
|
||||||
}else if(minDst > lerpDst/1.5f){
|
|
||||||
floor = Blocks.lava;
|
|
||||||
}else{
|
}else{
|
||||||
floor = Blocks.blackstone;
|
floor = Blocks.blackstone;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import io.anuke.arc.collection.ObjectIntMap;
|
|||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
|
import io.anuke.mindustry.type.ItemType;
|
||||||
|
|
||||||
public class DeployDialog extends FloatingDialog{
|
public class DeployDialog extends FloatingDialog{
|
||||||
|
|
||||||
@@ -24,18 +25,18 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
|
|
||||||
ObjectIntMap<Item> items = Vars.data.items();
|
ObjectIntMap<Item> items = Vars.data.items();
|
||||||
for(Item item : Vars.content.items()){
|
for(Item item : Vars.content.items()){
|
||||||
if(Vars.data.isUnlocked(item)){
|
if(item.type == ItemType.material && Vars.data.isUnlocked(item)){
|
||||||
add(items.get(item, 0) + "");
|
add(items.get(item, 0) + "").left();
|
||||||
addImage(item.region).size(8*3).pad(3);
|
addImage(item.region).size(8*4).pad(4);
|
||||||
add(item.localizedName());
|
add("[LIGHT_GRAY]" + item.localizedName()).left();
|
||||||
row();
|
row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}, new Table(){{
|
}}, new Table(){{
|
||||||
addButton("$text.play", () -> {
|
addButton("Wasteland", () -> {
|
||||||
hide();
|
hide();
|
||||||
Vars.world.generator.playRandomMap();
|
Vars.world.generator.playRandomMap();
|
||||||
}).margin(15);
|
}).size(190f, 60f);
|
||||||
}}).grow();
|
}}).grow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class LegacyColorMapper implements ContentList{
|
|||||||
map("c4e3e7", Blocks.ice, 0);
|
map("c4e3e7", Blocks.ice, 0);
|
||||||
map("f7feff", Blocks.snow, 1);
|
map("f7feff", Blocks.snow, 1);
|
||||||
map("6e501e", Blocks.dirt, 0);
|
map("6e501e", Blocks.dirt, 0);
|
||||||
map("ed5334", Blocks.lava, 0);
|
map("ed5334", Blocks.blackstone, 0);
|
||||||
map("292929", Blocks.tar, 0);
|
map("292929", Blocks.tar, 0);
|
||||||
map("c3a490", OreBlock.get(Blocks.stone, Items.copper), 0);
|
map("c3a490", OreBlock.get(Blocks.stone, Items.copper), 0);
|
||||||
map("161616", OreBlock.get(Blocks.stone, Items.coal), 0);
|
map("161616", OreBlock.get(Blocks.stone, Items.coal), 0);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.io.IOException;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Conveyor extends Block{
|
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 offsetScl = 128f * 3f;
|
||||||
private static final float minmove = 1f / (Short.MAX_VALUE - 2);
|
private static final float minmove = 1f / (Short.MAX_VALUE - 2);
|
||||||
private static ItemPos drawpos = new ItemPos();
|
private static ItemPos drawpos = new ItemPos();
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package io.anuke.mindustry.world.blocks.sandbox;
|
package io.anuke.mindustry.world.blocks.sandbox;
|
||||||
|
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
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){
|
public ItemSource(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
update = true;
|
||||||
|
solid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.anuke.mindustry.Vars;
|
|||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
|
import io.anuke.mindustry.type.ItemType;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
@@ -12,7 +13,6 @@ import static io.anuke.mindustry.Vars.data;
|
|||||||
|
|
||||||
public class LaunchPad extends Block{
|
public class LaunchPad extends Block{
|
||||||
protected final int timerLaunch = timers++;
|
protected final int timerLaunch = timers++;
|
||||||
|
|
||||||
/**Time inbetween launches.*/
|
/**Time inbetween launches.*/
|
||||||
protected float launchTime;
|
protected float launchTime;
|
||||||
|
|
||||||
@@ -24,6 +24,11 @@ public class LaunchPad extends Block{
|
|||||||
solid = true;
|
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
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
TileEntity entity = tile.entity;
|
TileEntity entity = tile.entity;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class DesktopLauncher extends Lwjgl3Application{
|
|||||||
config.setTitle("Mindustry");
|
config.setTitle("Mindustry");
|
||||||
config.setMaximized(true);
|
config.setMaximized(true);
|
||||||
config.setWindowedMode(960, 540);
|
config.setWindowedMode(960, 540);
|
||||||
//config.setBackBufferConfig(0, 0, 0, 0, 0, 0, 16);
|
|
||||||
config.setWindowIcon("sprites/icon.png");
|
config.setWindowIcon("sprites/icon.png");
|
||||||
|
|
||||||
Platform.instance = new DesktopPlatform(arg);
|
Platform.instance = new DesktopPlatform(arg);
|
||||||
|
|||||||
Reference in New Issue
Block a user