Starting items / No editor unlocks / Fixed Block#synthetic()

This commit is contained in:
Anuken
2019-01-16 19:36:30 -05:00
parent 733a064c79
commit 6510d83524
17 changed files with 508 additions and 528 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

After

Width:  |  Height:  |  Size: 335 KiB

View File

@@ -31,7 +31,7 @@ public class Blocks implements ContentList{
//environment //environment
air, blockpart, spawn, space, metalfloor, deepwater, water, 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, rocksSmall, rocksMedium, grass, shrub, rock, icerock, blackrock, rocks,
//crafting //crafting
siliconSmelter, plastaniumCompressor, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, siliconSmelter, plastaniumCompressor, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
@@ -210,17 +210,11 @@ public class Blocks implements ContentList{
variants = 1; variants = 1;
}}; }};
rocksSmall = new Rock("rocks-small"){{ rocks = new Rock("rocks"){{
variants = 2; variants = 2;
breakable = alwaysReplace = false; breakable = alwaysReplace = false;
solid = true; solid = true;
}}; }};
rocksMedium = new Rock("rocks-medium"){{
variants = 2;
breakable = alwaysReplace = false;
solid = true;
}};
//endregion //endregion
//region crafting //region crafting

View File

@@ -12,9 +12,10 @@ public class Zones implements ContentList{
@Override @Override
public void load(){ public void load(){
wasteland = new Zone("wasteland", new BasicGenerator(256, 256, Items.lead, Items.copper)){{ wasteland = new Zone("wasteland", new BasicGenerator(256, 256, Items.copper)){{
deployCost = ItemStack.with(Items.copper, 100); deployCost = ItemStack.with(Items.copper, 100);
startingItems = ItemStack.with(Items.copper, 50); startingItems = ItemStack.with(Items.copper, 50);
alwaysUnlocked = true;
rules = () -> new Rules(){{ rules = () -> new Rules(){{
waves = true; waves = true;
waveTimer = true; waveTimer = true;

View File

@@ -18,14 +18,12 @@ import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.utils.UIUtils; import io.anuke.arc.scene.utils.UIUtils;
import io.anuke.arc.util.*; import io.anuke.arc.util.*;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.MapIO; import io.anuke.mindustry.io.MapIO;
import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.maps.MapMeta; import io.anuke.mindustry.maps.MapMeta;
import io.anuke.mindustry.maps.MapTileData; import io.anuke.mindustry.maps.MapTileData;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.ui.dialogs.FloatingDialog; import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -501,14 +499,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(Block block : Vars.content.blocks()){ for(Block block : Vars.content.blocks()){
TextureRegion[] regions = block.getCompactIcon(); TextureRegion[] regions = block.getCompactIcon();
if((block.synthetic() && (Recipe.getByResult(block) == null || !data.isUnlocked(Recipe.getByResult(block))))
&& block != Blocks.core){
continue;
}
if(Recipe.getByResult(block) != null && !Recipe.getByResult(block).visibility.shown()){
continue;
}
if(regions.length == 0 || regions[0] == Core.atlas.find("jjfgj")) continue; if(regions.length == 0 || regions[0] == Core.atlas.find("jjfgj")) continue;

View File

@@ -6,6 +6,7 @@ import io.anuke.arc.collection.ObjectIntMap;
import io.anuke.arc.collection.ObjectMap; import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.collection.ObjectSet;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.game.EventType.UnlockEvent; import io.anuke.mindustry.game.EventType.UnlockEvent;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
@@ -48,8 +49,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 true; //return true;
//return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.getContentName()); return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.getContentName());
} }
/** /**
@@ -93,6 +94,11 @@ public class GlobalData{
for(Item item : Vars.content.items()){ for(Item item : Vars.content.items()){
items.put(item, Core.settings.getInt("item-" + item.name, 0)); items.put(item, Core.settings.getInt("item-" + item.name, 0));
} }
//set up default values
if(!Core.settings.has("item-" + Items.copper)){
addItem(Items.copper, 1000);
}
} }
public void save(){ public void save(){

View File

@@ -53,7 +53,7 @@ public class BasicGenerator extends RandomGenerator{
} }
if(rocks > 0.64){ if(rocks > 0.64){
block = Blocks.rocksSmall; block = Blocks.rocks;
} }
} }
} }

View File

@@ -14,12 +14,18 @@ public class Zone extends UnlockableContent{
public ItemStack[] deployCost = {}; public ItemStack[] deployCost = {};
public ItemStack[] startingItems = {}; public ItemStack[] startingItems = {};
public Supplier<Rules> rules = Rules::new; public Supplier<Rules> rules = Rules::new;
public boolean alwaysUnlocked;
public Zone(String name, Generator generator){ public Zone(String name, Generator generator){
this.name = name; this.name = name;
this.generator = generator; this.generator = generator;
} }
@Override
public boolean alwaysUnlocked(){
return alwaysUnlocked;
}
@Override @Override
public boolean isHidden(){ public boolean isHidden(){
return true; return true;

View File

@@ -76,7 +76,7 @@ public class HudFragment extends Fragment{
if(Net.active()){ if(Net.active()){
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-players"); i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-players");
}else{ }else{
i.setDisabled(Net.active()); i.setDisabled(false);
i.getStyle().imageUp = Core.scene.skin.getDrawable(state.is(State.paused) ? "icon-play" : "icon-pause"); i.getStyle().imageUp = Core.scene.skin.getDrawable(state.is(State.paused) ? "icon-play" : "icon-pause");
} }
}).get(); }).get();
@@ -131,7 +131,6 @@ public class HudFragment extends Fragment{
//fps display //fps display
infolabel = cont.table(t -> { infolabel = cont.table(t -> {
IntFormat fps = new IntFormat("fps"); IntFormat fps = new IntFormat("fps");
IntFormat tps = new IntFormat("tps");
IntFormat ping = new IntFormat("ping"); IntFormat ping = new IntFormat("ping");
t.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padRight(10); t.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padRight(10);
t.row(); t.row();
@@ -364,20 +363,32 @@ public class HudFragment extends Fragment{
IntFormat wavef = new IntFormat("wave"); IntFormat wavef = new IntFormat("wave");
IntFormat enemyf = new IntFormat("wave.enemy"); IntFormat enemyf = new IntFormat("wave.enemy");
IntFormat enemiesf = new IntFormat("wave.enemies"); IntFormat enemiesf = new IntFormat("wave.enemies");
IntFormat waitingf = new IntFormat("wave.waiting");
table.clearChildren(); table.clearChildren();
table.touchable(Touchable.enabled); table.touchable(Touchable.enabled);
table.labelWrap(() -> StringBuilder builder = new StringBuilder();
(state.enemies() > 0 && !state.rules.waveTimer ?
wavef.get(state.wave) + "\n" + (state.enemies() == 1 ? table.labelWrap(() -> {
enemyf.get(state.enemies()) : builder.setLength(0);
enemiesf.get(state.enemies())) : builder.append(wavef.get(state.wave));
wavef.get(state.wave) + "\n" + builder.append("\n");
(state.rules.waveTimer ?
Core.bundle.format("wave.waiting", (int)(state.wavetime/60)) : if(state.enemies() > 0 && !state.rules.waveTimer){
Core.bundle.get("waiting"))) if(state.enemies() == 1){
).growX().pad(8f); builder.append(enemyf.get(state.enemies()));
}else{
builder.append(enemiesf.get(state.enemies()));
}
}else if(state.rules.waveTimer){
builder.append(waitingf.get((int)(state.wavetime/60)));
}else{
builder.append(Core.bundle.get("waiting"));
}
return builder;
}).growX().pad(8f);
table.setDisabled(true); table.setDisabled(true);
table.visible(() -> state.rules.waves); table.visible(() -> state.rules.waves);

View File

@@ -314,7 +314,7 @@ public class Block extends BaseBlock {
} }
public boolean synthetic(){ public boolean synthetic(){
return update || destructible || solid; return update || destructible;
} }
public void drawConfigure(Tile tile){ public void drawConfigure(Tile tile){