New requirements for zone unlock, currently broken
This commit is contained in:
@@ -199,6 +199,21 @@ public class Blocks implements ContentList{
|
||||
blendGroup = stone;
|
||||
}};
|
||||
|
||||
ignarock = new Floor("ignarock"){{
|
||||
|
||||
}};
|
||||
|
||||
hotrock = new Floor("hotrock"){{
|
||||
attributes.set(Attribute.heat, 0.5f);
|
||||
blendGroup = ignarock;
|
||||
}};
|
||||
|
||||
magmarock = new Floor("magmarock"){{
|
||||
attributes.set(Attribute.heat, 0.75f);
|
||||
updateEffect = Fx.magmasmoke;
|
||||
blendGroup = ignarock;
|
||||
}};
|
||||
|
||||
sand = new Floor("sand"){{
|
||||
itemDrop = Items.sand;
|
||||
playerUnmineable = true;
|
||||
@@ -338,21 +353,6 @@ public class Blocks implements ContentList{
|
||||
variants = 0;
|
||||
}};
|
||||
|
||||
ignarock = new Floor("ignarock"){{
|
||||
blendGroup = darksand;
|
||||
}};
|
||||
|
||||
hotrock = new Floor("hotrock"){{
|
||||
attributes.set(Attribute.heat, 0.5f);
|
||||
blendGroup = ignarock;
|
||||
}};
|
||||
|
||||
magmarock = new Floor("magmarock"){{
|
||||
attributes.set(Attribute.heat, 0.75f);
|
||||
updateEffect = Fx.magmasmoke;
|
||||
blendGroup = ignarock;
|
||||
}};
|
||||
|
||||
//endregion
|
||||
//region ore
|
||||
|
||||
@@ -1234,13 +1234,13 @@ public class Blocks implements ContentList{
|
||||
arc = new PowerTurret("arc"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 70, Items.lead, 70));
|
||||
shootType = Bullets.arc;
|
||||
reload = 25f;
|
||||
reload = 24f;
|
||||
shootCone = 40f;
|
||||
rotatespeed = 8f;
|
||||
powerUsed = 1f / 2f;
|
||||
targetAir = false;
|
||||
consumes.powerBuffered(80f);
|
||||
range = 80f;
|
||||
consumes.powerBuffered(60f, 60f);
|
||||
range = 95f;
|
||||
shootEffect = Fx.lightningShoot;
|
||||
heatColor = Color.RED;
|
||||
recoil = 1f;
|
||||
|
||||
@@ -664,7 +664,7 @@ public class Bullets implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
arc = new BulletType(0.001f, 21){{
|
||||
arc = new BulletType(0.001f, 25){{
|
||||
lifetime = 1;
|
||||
despawnEffect = Fx.none;
|
||||
hitEffect = Fx.hitLancer;
|
||||
@@ -675,7 +675,7 @@ public class Bullets implements ContentList{
|
||||
|
||||
@Override
|
||||
public void init(Bullet b){
|
||||
Lightning.create(b.getTeam(), Pal.lancerLaser, damage, b.x, b.y, b.rot(), 15);
|
||||
Lightning.create(b.getTeam(), Pal.lancerLaser, damage, b.x, b.y, b.rot(), 25);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,8 +33,7 @@ public class Zones implements ContentList{
|
||||
craters = new Zone("craters", new MapGenerator("craters", 1).dist(0).decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{
|
||||
startingItems = ItemStack.list(Items.copper, 200);
|
||||
conditionWave = 10;
|
||||
itemRequirements = ItemStack.with(Items.copper, 2000);
|
||||
zoneRequirements = new Zone[]{groundZero};
|
||||
zoneRequirements = ZoneRequirement.with(groundZero, 10);
|
||||
blockRequirements = new Block[]{Blocks.router};
|
||||
resources = new Item[]{Items.copper, Items.lead};
|
||||
rules = () -> new Rules(){{
|
||||
@@ -50,8 +49,7 @@ public class Zones implements ContentList{
|
||||
baseLaunchCost = ItemStack.with();
|
||||
startingItems = ItemStack.list(Items.copper, 400);
|
||||
conditionWave = 10;
|
||||
zoneRequirements = new Zone[]{craters};
|
||||
itemRequirements = ItemStack.with(Items.copper, 4000, Items.lead, 2000);
|
||||
zoneRequirements = ZoneRequirement.with(craters, 10);
|
||||
resources = new Item[]{Items.copper, Items.lead, Items.coal};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
@@ -66,8 +64,7 @@ public class Zones implements ContentList{
|
||||
startingItems = ItemStack.list(Items.copper, 400);
|
||||
conditionWave = 20;
|
||||
launchPeriod = 20;
|
||||
zoneRequirements = new Zone[]{frozenForest};
|
||||
itemRequirements = ItemStack.with(Items.lead, 6000, Items.graphite, 2000);
|
||||
zoneRequirements = ZoneRequirement.with(frozenForest, 10, craters, 15);
|
||||
blockRequirements = new Block[]{Blocks.graphitePress, Blocks.combustionGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
||||
rules = () -> new Rules(){{
|
||||
@@ -99,9 +96,8 @@ public class Zones implements ContentList{
|
||||
startingItems = ItemStack.list(Items.copper, 400, Items.lead, 100);
|
||||
conditionWave = 10;
|
||||
launchPeriod = 10;
|
||||
zoneRequirements = new Zone[]{frozenForest};
|
||||
zoneRequirements = ZoneRequirement.with(frozenForest, 15);
|
||||
blockRequirements = new Block[]{Blocks.pneumaticDrill};
|
||||
itemRequirements = ItemStack.with(Items.copper, 8000, Items.silicon, 2000);
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
@@ -114,10 +110,9 @@ public class Zones implements ContentList{
|
||||
loadout = Loadouts.basicNucleus;
|
||||
baseLaunchCost = ItemStack.with();
|
||||
startingItems = ItemStack.list(Items.copper, 1500);
|
||||
itemRequirements = ItemStack.with(Items.copper, 8000, Items.metaglass, 2000, Items.graphite, 3000);
|
||||
conditionWave = 10;
|
||||
launchPeriod = 20;
|
||||
zoneRequirements = new Zone[]{ruinousShores};
|
||||
zoneRequirements = ZoneRequirement.with(stainedMountains, 20);
|
||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand};
|
||||
rules = () -> new Rules(){{
|
||||
@@ -133,10 +128,9 @@ public class Zones implements ContentList{
|
||||
loadout = Loadouts.basicNucleus;
|
||||
baseLaunchCost = ItemStack.with();
|
||||
startingItems = ItemStack.list(Items.copper, 2500, Items.lead, 3000, Items.silicon, 800, Items.metaglass, 400);
|
||||
itemRequirements = ItemStack.with(Items.copper, 10000, Items.titanium, 8000, Items.metaglass, 6000, Items.plastanium, 2000);
|
||||
conditionWave = 30;
|
||||
launchPeriod = 15;
|
||||
zoneRequirements = new Zone[]{desolateRift};
|
||||
zoneRequirements = ZoneRequirement.with(desolateRift, 20);
|
||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium, Items.sand};
|
||||
rules = () -> new Rules(){{
|
||||
|
||||
@@ -169,6 +169,7 @@ public class Renderer implements ApplicationListener{
|
||||
blocks.processBlocks();
|
||||
|
||||
blocks.drawShadows();
|
||||
Draw.color();
|
||||
|
||||
blocks.floor.beginDraw();
|
||||
blocks.floor.drawLayer(CacheLayer.walls);
|
||||
|
||||
@@ -491,6 +491,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
if(mode == placing && isPlacing()){
|
||||
iterateLine(lineStartX, lineStartY, tileX, tileY, l -> {
|
||||
Tile tile = world.tile(l.x, l.y);
|
||||
if(tile != null && hasRequest(tile)){
|
||||
return;
|
||||
}
|
||||
|
||||
PlaceRequest request = new PlaceRequest(l.x, l.y, block, l.rotation);
|
||||
request.scale = 1f;
|
||||
selection.add(request);
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.content.Loadouts;
|
||||
import io.anuke.mindustry.game.EventType.ZoneCompleteEvent;
|
||||
import io.anuke.mindustry.game.EventType.ZoneConfigureCompleteEvent;
|
||||
import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.maps.generators.Generator;
|
||||
@@ -24,8 +23,8 @@ import static io.anuke.mindustry.Vars.state;
|
||||
public class Zone extends UnlockableContent{
|
||||
public final Generator generator;
|
||||
public Block[] blockRequirements = {};
|
||||
public ItemStack[] itemRequirements = {};
|
||||
public Zone[] zoneRequirements = {};
|
||||
public ZoneRequirement[] zoneRequirements = {};
|
||||
//TODO debug verify resources.
|
||||
public Item[] resources = {};
|
||||
public Supplier<Rules> rules = Rules::new;
|
||||
public boolean alwaysUnlocked;
|
||||
@@ -73,7 +72,7 @@ public class Zone extends UnlockableContent{
|
||||
}
|
||||
|
||||
if(wave == configureWave + 1){
|
||||
Events.fire(new ZoneConfigureCompleteEvent(this));
|
||||
// Events.fire(new ZoneConfigureCompleteEvent(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,4 +158,22 @@ public class Zone extends UnlockableContent{
|
||||
return ContentType.zone;
|
||||
}
|
||||
|
||||
public static class ZoneRequirement{
|
||||
public final Zone zone;
|
||||
public final int wave;
|
||||
|
||||
public ZoneRequirement(Zone zone, int wave){
|
||||
this.zone = zone;
|
||||
this.wave = wave;
|
||||
}
|
||||
|
||||
public static ZoneRequirement[] with(Object... objects){
|
||||
ZoneRequirement[] out = new ZoneRequirement[objects.length/2];
|
||||
for(int i = 0; i < objects.length; i+= 2){
|
||||
out[i/2] = new ZoneRequirement((Zone)objects[i], (Integer)objects[i + 1]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.io.SaveIO.SaveException;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.type.Zone.ZoneRequirement;
|
||||
import io.anuke.mindustry.ui.ItemsDisplay;
|
||||
import io.anuke.mindustry.ui.TreeLayout;
|
||||
import io.anuke.mindustry.ui.TreeLayout.TreeNode;
|
||||
@@ -100,8 +101,8 @@ public class DeployDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
boolean hidden(Zone zone){
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
if(!data.isUnlocked(other)){
|
||||
for(ZoneRequirement other : zone.zoneRequirements){
|
||||
if(!data.isUnlocked(other.zone)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
this.height /= 2f;
|
||||
nodes.add(this);
|
||||
|
||||
arr.selectFrom(content.zones(), other -> Structs.contains(other.zoneRequirements, zone));
|
||||
arr.selectFrom(content.zones(), other -> Structs.find(other.zoneRequirements, f -> f.zone == zone) != null);
|
||||
|
||||
children = new ZoneNode[arr.size];
|
||||
for(int i = 0; i < children.length; i++){
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.type.Zone.ZoneRequirement;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Block.Icon;
|
||||
|
||||
@@ -41,7 +42,10 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
Runnable rebuildItems = () -> {
|
||||
int i = 0;
|
||||
iteminfo.clear();
|
||||
ItemStack[] stacks = zone.unlocked() ? zone.getLaunchCost() : zone.itemRequirements;
|
||||
|
||||
if(!zone.unlocked()) return;
|
||||
|
||||
ItemStack[] stacks = zone.getLaunchCost();
|
||||
for(ItemStack stack : stacks){
|
||||
if(stack.amount == 0) continue;
|
||||
|
||||
@@ -69,11 +73,11 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
req.table(r -> {
|
||||
r.add("$complete").colspan(2).left();
|
||||
r.row();
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
for(ZoneRequirement other : zone.zoneRequirements){
|
||||
r.addImage("icon-zone").padRight(4);
|
||||
r.add(other.localizedName()).color(Color.LIGHT_GRAY);
|
||||
r.addImage(other.isCompleted() ? "icon-check-2" : "icon-cancel-2")
|
||||
.color(other.isCompleted() ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
|
||||
r.add(Core.bundle.format("zone.requirement", other.wave, other.zone.localizedName())).color(Color.LIGHT_GRAY);
|
||||
r.addImage(other.zone.bestWave() >= other.wave ? "icon-check-2" : "icon-cancel-2")
|
||||
.color(other.zone.bestWave() >= other.wave ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
});
|
||||
@@ -190,7 +194,6 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
|
||||
Button button = cont.addButton(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
if(!data.isUnlocked(zone)){
|
||||
data.removeItems(zone.itemRequirements);
|
||||
data.unlockContent(zone);
|
||||
ui.deploy.setup();
|
||||
setup(zone);
|
||||
@@ -211,8 +214,8 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
return true;
|
||||
}
|
||||
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
if(!other.isCompleted()){
|
||||
for(ZoneRequirement other : zone.zoneRequirements){
|
||||
if(other.zone.bestWave() < other.wave){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -223,6 +226,6 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
}
|
||||
}
|
||||
|
||||
return data.hasItems(zone.itemRequirements);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user