Merge branches 'master' and 'zone-objectives' of https://github.com/Anuken/Mindustry
This commit is contained in:
@@ -45,7 +45,6 @@ database = Core Database
|
|||||||
savegame = Save Game
|
savegame = Save Game
|
||||||
loadgame = Load Game
|
loadgame = Load Game
|
||||||
joingame = Join Game
|
joingame = Join Game
|
||||||
addplayers = Add/Remove Players
|
|
||||||
customgame = Custom Game
|
customgame = Custom Game
|
||||||
newgame = New Game
|
newgame = New Game
|
||||||
none = <none>
|
none = <none>
|
||||||
@@ -164,7 +163,6 @@ server.port = Port:
|
|||||||
server.addressinuse = Address already in use!
|
server.addressinuse = Address already in use!
|
||||||
server.invalidport = Invalid port number!
|
server.invalidport = Invalid port number!
|
||||||
server.error = [crimson]Error hosting server.
|
server.error = [crimson]Error hosting server.
|
||||||
save.old = This save is for an older version of the game, and can no longer be used.\n\n[lightgray]Save backwards compatibility will be implemented in the full 4.0 release.
|
|
||||||
save.new = New Save
|
save.new = New Save
|
||||||
save.overwrite = Are you sure you want to overwrite\nthis save slot?
|
save.overwrite = Are you sure you want to overwrite\nthis save slot?
|
||||||
overwrite = Overwrite
|
overwrite = Overwrite
|
||||||
@@ -378,7 +376,6 @@ campaign = Campaign
|
|||||||
load = Load
|
load = Load
|
||||||
save = Save
|
save = Save
|
||||||
fps = FPS: {0}
|
fps = FPS: {0}
|
||||||
tps = TPS: {0}
|
|
||||||
ping = Ping: {0}ms
|
ping = Ping: {0}ms
|
||||||
language.restart = Please restart your game for the language settings to take effect.
|
language.restart = Please restart your game for the language settings to take effect.
|
||||||
settings = Settings
|
settings = Settings
|
||||||
@@ -391,8 +388,10 @@ donate = Donate
|
|||||||
abandon = Abandon
|
abandon = Abandon
|
||||||
abandon.text = This zone and all its resources will be lost to the enemy.
|
abandon.text = This zone and all its resources will be lost to the enemy.
|
||||||
locked = Locked
|
locked = Locked
|
||||||
complete = [lightgray]Reach:
|
complete = [lightgray]Complete:
|
||||||
zone.requirement = Wave {0} in zone {1}
|
requirement.wave = Reach Wave {0} in {1}
|
||||||
|
requirement.core = Destroy Enemy Core in {0}
|
||||||
|
requirement.unlock = Unlock {0}
|
||||||
resume = Resume Zone:\n[lightgray]{0}
|
resume = Resume Zone:\n[lightgray]{0}
|
||||||
bestwave = [lightgray]Best Wave: {0}
|
bestwave = [lightgray]Best Wave: {0}
|
||||||
launch = < LAUNCH >
|
launch = < LAUNCH >
|
||||||
@@ -403,11 +402,13 @@ launch.confirm = This will launch all resources in your core.\nYou will not be a
|
|||||||
launch.skip.confirm = If you skip now, you will not be able to launch until later waves.
|
launch.skip.confirm = If you skip now, you will not be able to launch until later waves.
|
||||||
uncover = Uncover
|
uncover = Uncover
|
||||||
configure = Configure Loadout
|
configure = Configure Loadout
|
||||||
configure.locked = [lightgray]Unlock configuring loadout: Wave {0}.
|
bannedblocks = Banned Blocks
|
||||||
|
addall = Add All
|
||||||
|
configure.locked = [lightgray]Unlock configuring loadout: {0}.
|
||||||
configure.invalid = Amount must be a number between 0 and {0}.
|
configure.invalid = Amount must be a number between 0 and {0}.
|
||||||
zone.unlocked = [lightgray]{0} unlocked.
|
zone.unlocked = [lightgray]{0} unlocked.
|
||||||
zone.requirement.complete = Wave {0} reached:\n{1} zone requirements met.
|
zone.requirement.complete = Requirement for {0} completed:[lightgray]\n{1}
|
||||||
zone.config.complete = Wave {0} reached:\nLoadout config unlocked.
|
zone.config.unlocked = Loadout unlocked:[lightgray]\n{0}
|
||||||
zone.resources = [lightgray]Resources Detected:
|
zone.resources = [lightgray]Resources Detected:
|
||||||
zone.objective = [lightgray]Objective: [accent]{0}
|
zone.objective = [lightgray]Objective: [accent]{0}
|
||||||
zone.objective.survival = Survive
|
zone.objective.survival = Survive
|
||||||
@@ -468,12 +469,13 @@ settings.cleardata = Clear Game Data...
|
|||||||
settings.clear.confirm = Are you sure you want to clear this data?\nWhat is done cannot be undone!
|
settings.clear.confirm = Are you sure you want to clear this data?\nWhat is done cannot be undone!
|
||||||
settings.clearall.confirm = [scarlet]WARNING![]\nThis will clear all data, including saves, maps, unlocks and keybinds.\nOnce you press 'ok' the game will wipe all data and automatically exit.
|
settings.clearall.confirm = [scarlet]WARNING![]\nThis will clear all data, including saves, maps, unlocks and keybinds.\nOnce you press 'ok' the game will wipe all data and automatically exit.
|
||||||
paused = [accent]< Paused >
|
paused = [accent]< Paused >
|
||||||
|
clear = Clear
|
||||||
|
banned = [scarlet]Banned
|
||||||
yes = Yes
|
yes = Yes
|
||||||
no = No
|
no = No
|
||||||
info.title = Info
|
info.title = Info
|
||||||
error.title = [crimson]An error has occured
|
error.title = [crimson]An error has occured
|
||||||
error.crashtitle = An error has occured
|
error.crashtitle = An error has occured
|
||||||
attackpvponly = [scarlet]Only available in Attack/PvP modes
|
|
||||||
blocks.input = Input
|
blocks.input = Input
|
||||||
blocks.output = Output
|
blocks.output = Output
|
||||||
blocks.booster = Booster
|
blocks.booster = Booster
|
||||||
|
|||||||
@@ -965,12 +965,12 @@ public class Blocks implements ContentList{
|
|||||||
//region liquid
|
//region liquid
|
||||||
|
|
||||||
mechanicalPump = new Pump("mechanical-pump"){{
|
mechanicalPump = new Pump("mechanical-pump"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.copper, 15, Items.lead, 10));
|
requirements(Category.liquid, ItemStack.with(Items.copper, 15, Items.metaglass, 10));
|
||||||
pumpAmount = 0.1f;
|
pumpAmount = 0.1f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
rotaryPump = new Pump("rotary-pump"){{
|
rotaryPump = new Pump("rotary-pump"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.copper, 70, Items.lead, 50, Items.silicon, 20, Items.titanium, 35));
|
requirements(Category.liquid, ItemStack.with(Items.copper, 70, Items.metaglass, 50, Items.silicon, 20, Items.titanium, 35));
|
||||||
pumpAmount = 0.8f;
|
pumpAmount = 0.8f;
|
||||||
consumes.power(0.15f);
|
consumes.power(0.15f);
|
||||||
liquidCapacity = 30f;
|
liquidCapacity = 30f;
|
||||||
@@ -979,7 +979,7 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
thermalPump = new Pump("thermal-pump"){{
|
thermalPump = new Pump("thermal-pump"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.copper, 80, Items.lead, 65, Items.silicon, 30, Items.titanium, 40, Items.thorium, 35));
|
requirements(Category.liquid, ItemStack.with(Items.copper, 80, Items.metaglass, 70, Items.silicon, 30, Items.titanium, 40, Items.thorium, 35));
|
||||||
pumpAmount = 1.5f;
|
pumpAmount = 1.5f;
|
||||||
consumes.power(0.30f);
|
consumes.power(0.30f);
|
||||||
liquidCapacity = 40f;
|
liquidCapacity = 40f;
|
||||||
@@ -993,13 +993,13 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
pulseConduit = new Conduit("pulse-conduit"){{
|
pulseConduit = new Conduit("pulse-conduit"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.titanium, 1, Items.metaglass, 1));
|
requirements(Category.liquid, ItemStack.with(Items.titanium, 2, Items.metaglass, 1));
|
||||||
liquidCapacity = 16f;
|
liquidCapacity = 16f;
|
||||||
health = 90;
|
health = 90;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
liquidRouter = new LiquidRouter("liquid-router"){{
|
liquidRouter = new LiquidRouter("liquid-router"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.titanium, 2, Items.metaglass, 2));
|
requirements(Category.liquid, ItemStack.with(Items.graphite, 4, Items.metaglass, 2));
|
||||||
liquidCapacity = 20f;
|
liquidCapacity = 20f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -1011,11 +1011,11 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
liquidJunction = new LiquidJunction("liquid-junction"){{
|
liquidJunction = new LiquidJunction("liquid-junction"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.titanium, 2, Items.metaglass, 2));
|
requirements(Category.liquid, ItemStack.with(Items.graphite, 2, Items.metaglass, 2));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{
|
bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{
|
||||||
requirements(Category.liquid, ItemStack.with(Items.titanium, 4, Items.metaglass, 4));
|
requirements(Category.liquid, ItemStack.with(Items.graphite, 4, Items.metaglass, 8));
|
||||||
range = 4;
|
range = 4;
|
||||||
hasPower = false;
|
hasPower = false;
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.ContentList;
|
import io.anuke.mindustry.game.Objectives.*;
|
||||||
import io.anuke.mindustry.game.SpawnGroup;
|
import io.anuke.mindustry.maps.generators.*;
|
||||||
import io.anuke.mindustry.maps.generators.MapGenerator;
|
import io.anuke.mindustry.maps.generators.MapGenerator.*;
|
||||||
import io.anuke.mindustry.maps.generators.MapGenerator.Decoration;
|
import io.anuke.mindustry.maps.zonegen.*;
|
||||||
import io.anuke.mindustry.maps.zonegen.DesertWastesGenerator;
|
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
|
||||||
|
import static io.anuke.arc.collection.Array.with;
|
||||||
|
import static io.anuke.mindustry.content.Items.*;
|
||||||
|
import static io.anuke.mindustry.type.ItemStack.list;
|
||||||
|
|
||||||
public class Zones implements ContentList{
|
public class Zones implements ContentList{
|
||||||
public static Zone
|
public static Zone
|
||||||
@@ -20,28 +22,26 @@ public class Zones implements ContentList{
|
|||||||
public void load(){
|
public void load(){
|
||||||
|
|
||||||
groundZero = new Zone("groundZero", new MapGenerator("groundZero", 1)){{
|
groundZero = new Zone("groundZero", new MapGenerator("groundZero", 1)){{
|
||||||
baseLaunchCost = ItemStack.with(Items.copper, -60);
|
baseLaunchCost = list(copper, -60);
|
||||||
startingItems = ItemStack.list(Items.copper, 60);
|
startingItems = list(copper, 60);
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
conditionWave = 5;
|
conditionWave = 5;
|
||||||
launchPeriod = 5;
|
launchPeriod = 5;
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead};
|
resources = with(copper, scrap, lead);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
desertWastes = new Zone("desertWastes", new DesertWastesGenerator(260, 260)){{
|
desertWastes = new Zone("desertWastes", new DesertWastesGenerator(260, 260)){{
|
||||||
startingItems = ItemStack.list(Items.copper, 120);
|
startingItems = list(copper, 120);
|
||||||
conditionWave = 20;
|
conditionWave = 20;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
loadout = Loadouts.advancedShard;
|
loadout = Loadouts.advancedShard;
|
||||||
zoneRequirements = ZoneRequirement.with(groundZero, 20);
|
resources = with(copper, lead, coal, sand);
|
||||||
blockRequirements = new Block[]{Blocks.combustionGenerator};
|
|
||||||
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.sand};
|
|
||||||
rules = r -> {
|
rules = r -> {
|
||||||
r.waves = true;
|
r.waves = true;
|
||||||
r.waveTimer = true;
|
r.waveTimer = true;
|
||||||
r.launchWaveMultiplier = 3f;
|
r.launchWaveMultiplier = 3f;
|
||||||
r.waveSpacing = 60 * 50f;
|
r.waveSpacing = 60 * 50f;
|
||||||
r.spawns = Array.with(
|
r.spawns = with(
|
||||||
new SpawnGroup(UnitTypes.crawler){{
|
new SpawnGroup(UnitTypes.crawler){{
|
||||||
unitScaling = 3f;
|
unitScaling = 3f;
|
||||||
}},
|
}},
|
||||||
@@ -75,96 +75,140 @@ public class Zones implements ContentList{
|
|||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
requirements = with(
|
||||||
|
new ZoneWave(groundZero, 20),
|
||||||
|
new Unlock(Blocks.combustionGenerator)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
saltFlats = new Zone("saltFlats", new MapGenerator("saltFlats")){{
|
saltFlats = new Zone("saltFlats", new MapGenerator("saltFlats")){{
|
||||||
startingItems = ItemStack.list(Items.copper, 200, Items.silicon, 200, Items.lead, 200);
|
startingItems = list(copper, 200, Items.silicon, 200, lead, 200);
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
launchPeriod = 5;
|
launchPeriod = 5;
|
||||||
zoneRequirements = ZoneRequirement.with(desertWastes, 60);
|
configureObjective = new Launched(this);
|
||||||
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.draugFactory, Blocks.door, Blocks.waterExtractor};
|
resources = with(copper, scrap, lead, coal, sand, titanium);
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand, Items.titanium};
|
requirements = with(
|
||||||
|
new ZoneWave(desertWastes, 60),
|
||||||
|
new Unlock(Blocks.daggerFactory),
|
||||||
|
new Unlock(Blocks.draugFactory),
|
||||||
|
new Unlock(Blocks.door),
|
||||||
|
new Unlock(Blocks.waterExtractor)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 1)
|
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 1)
|
||||||
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.02))){{
|
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.02))){{
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
baseLaunchCost = ItemStack.with();
|
startingItems = list(copper, 250);
|
||||||
startingItems = ItemStack.list(Items.copper, 250);
|
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
blockRequirements = new Block[]{Blocks.junction, Blocks.router};
|
resources = with(copper, lead, coal);
|
||||||
zoneRequirements = ZoneRequirement.with(groundZero, 10);
|
requirements = with(
|
||||||
resources = new Item[]{Items.copper, Items.lead, Items.coal};
|
new ZoneWave(groundZero, 10),
|
||||||
|
new Unlock(Blocks.junction),
|
||||||
|
new Unlock(Blocks.router)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
craters = new Zone("craters", new MapGenerator("craters", 1).decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.004))){{
|
craters = new Zone("craters", new MapGenerator("craters", 1).decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.004))){{
|
||||||
startingItems = ItemStack.list(Items.copper, 100);
|
startingItems = list(copper, 100);
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
zoneRequirements = ZoneRequirement.with(frozenForest, 10);
|
resources = with(copper, lead, coal, sand, scrap);
|
||||||
blockRequirements = new Block[]{Blocks.mender, Blocks.combustionGenerator};
|
requirements = with(
|
||||||
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.sand, Items.scrap};
|
new ZoneWave(frozenForest, 10),
|
||||||
|
new Unlock(Blocks.mender),
|
||||||
|
new Unlock(Blocks.combustionGenerator)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
ruinousShores = new Zone("ruinousShores", new MapGenerator("ruinousShores", 1)){{
|
ruinousShores = new Zone("ruinousShores", new MapGenerator("ruinousShores", 1)){{
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
baseLaunchCost = ItemStack.with();
|
startingItems = list(copper, 140, lead, 50);
|
||||||
startingItems = ItemStack.list(Items.copper, 140, Items.lead, 50);
|
|
||||||
conditionWave = 20;
|
conditionWave = 20;
|
||||||
launchPeriod = 20;
|
launchPeriod = 20;
|
||||||
zoneRequirements = ZoneRequirement.with(desertWastes, 20, craters, 15);
|
resources = with(copper, scrap, lead, coal, sand);
|
||||||
blockRequirements = new Block[]{Blocks.graphitePress, Blocks.combustionGenerator, Blocks.kiln, Blocks.mechanicalPump};
|
requirements = with(
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
new ZoneWave(desertWastes, 20),
|
||||||
|
new ZoneWave(craters, 15),
|
||||||
|
new Unlock(Blocks.graphitePress),
|
||||||
|
new Unlock(Blocks.combustionGenerator),
|
||||||
|
new Unlock(Blocks.kiln),
|
||||||
|
new Unlock(Blocks.mechanicalPump)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2)
|
stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2)
|
||||||
.decor(new Decoration(Blocks.shale, Blocks.shaleBoulder, 0.02))){{
|
.decor(new Decoration(Blocks.shale, Blocks.shaleBoulder, 0.02))){{
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
startingItems = ItemStack.list(Items.copper, 200, Items.lead, 50);
|
startingItems = list(copper, 200, lead, 50);
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
zoneRequirements = ZoneRequirement.with(frozenForest, 15);
|
resources = with(copper, scrap, lead, coal, titanium, sand);
|
||||||
blockRequirements = new Block[]{Blocks.pneumaticDrill, Blocks.powerNode, Blocks.turbineGenerator};
|
requirements = with(
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand};
|
new ZoneWave(frozenForest, 15),
|
||||||
|
new Unlock(Blocks.pneumaticDrill),
|
||||||
|
new Unlock(Blocks.powerNode),
|
||||||
|
new Unlock(Blocks.turbineGenerator)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
fungalPass = new Zone("fungalPass", new MapGenerator("fungalPass")){{
|
fungalPass = new Zone("fungalPass", new MapGenerator("fungalPass")){{
|
||||||
startingItems = ItemStack.list(Items.copper, 250, Items.lead, 250, Items.metaglass, 100, Items.graphite, 100);
|
startingItems = list(copper, 250, lead, 250, Items.metaglass, 100, Items.graphite, 100);
|
||||||
zoneRequirements = ZoneRequirement.with(stainedMountains, 15);
|
resources = with(copper, lead, coal, titanium, sand);
|
||||||
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.crawlerFactory, Blocks.door, Blocks.siliconSmelter};
|
configureObjective = new Launched(this);
|
||||||
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.titanium, Items.sand};
|
requirements = with(
|
||||||
|
new ZoneWave(stainedMountains, 15),
|
||||||
|
new Unlock(Blocks.daggerFactory),
|
||||||
|
new Unlock(Blocks.crawlerFactory),
|
||||||
|
new Unlock(Blocks.door),
|
||||||
|
new Unlock(Blocks.siliconSmelter)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
overgrowth = new Zone("overgrowth", new MapGenerator("overgrowth")){{
|
overgrowth = new Zone("overgrowth", new MapGenerator("overgrowth")){{
|
||||||
startingItems = ItemStack.list(Items.copper, 1500, Items.lead, 1000, Items.silicon, 500, Items.metaglass, 250);
|
startingItems = list(copper, 1500, lead, 1000, Items.silicon, 500, Items.metaglass, 250);
|
||||||
conditionWave = 12;
|
conditionWave = 12;
|
||||||
launchPeriod = 4;
|
launchPeriod = 4;
|
||||||
loadout = Loadouts.basicNucleus;
|
loadout = Loadouts.basicNucleus;
|
||||||
zoneRequirements = ZoneRequirement.with(craters, 40, fungalPass, 10);
|
configureObjective = new Launched(this);
|
||||||
blockRequirements = new Block[]{Blocks.cultivator, Blocks.sporePress, Blocks.titanFactory, Blocks.wraithFactory};
|
resources = with(copper, lead, coal, titanium, sand, thorium, scrap);
|
||||||
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.titanium, Items.sand, Items.thorium, Items.scrap};
|
requirements = with(
|
||||||
|
new ZoneWave(craters, 40),
|
||||||
|
new Launched(fungalPass),
|
||||||
|
new Unlock(Blocks.cultivator),
|
||||||
|
new Unlock(Blocks.sporePress),
|
||||||
|
new Unlock(Blocks.titanFactory),
|
||||||
|
new Unlock(Blocks.wraithFactory)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
tarFields = new Zone("tarFields", new MapGenerator("tarFields")
|
tarFields = new Zone("tarFields", new MapGenerator("tarFields")
|
||||||
.decor(new Decoration(Blocks.shale, Blocks.shaleBoulder, 0.02))){{
|
.decor(new Decoration(Blocks.shale, Blocks.shaleBoulder, 0.02))){{
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
startingItems = ItemStack.list(Items.copper, 250, Items.lead, 100);
|
startingItems = list(copper, 250, lead, 100);
|
||||||
conditionWave = 15;
|
conditionWave = 15;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
zoneRequirements = ZoneRequirement.with(ruinousShores, 20);
|
requirements = with(new ZoneWave(ruinousShores, 20));
|
||||||
blockRequirements = new Block[]{Blocks.coalCentrifuge, Blocks.conduit, Blocks.wave};
|
resources = with(copper, scrap, lead, coal, titanium, thorium, sand);
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium, Items.sand};
|
requirements = with(
|
||||||
|
new ZoneWave(ruinousShores, 20),
|
||||||
|
new Unlock(Blocks.coalCentrifuge),
|
||||||
|
new Unlock(Blocks.conduit),
|
||||||
|
new Unlock(Blocks.wave)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift")){{
|
desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift")){{
|
||||||
loadout = Loadouts.basicNucleus;
|
loadout = Loadouts.basicNucleus;
|
||||||
baseLaunchCost = ItemStack.with();
|
startingItems = list(copper, 1000, lead, 1000, Items.graphite, 250, titanium, 250, Items.silicon, 250);
|
||||||
startingItems = ItemStack.list(Items.copper, 1000, Items.lead, 1000, Items.graphite, 250, Items.titanium, 250, Items.silicon, 250);
|
|
||||||
conditionWave = 3;
|
conditionWave = 3;
|
||||||
launchPeriod = 2;
|
launchPeriod = 2;
|
||||||
zoneRequirements = ZoneRequirement.with(tarFields, 20);
|
resources = with(copper, scrap, lead, coal, titanium, sand, thorium);
|
||||||
blockRequirements = new Block[]{Blocks.thermalGenerator, Blocks.thoriumReactor};
|
requirements = with(
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand, Items.thorium};
|
new ZoneWave(tarFields, 20),
|
||||||
|
new Unlock(Blocks.thermalGenerator),
|
||||||
|
new Unlock(Blocks.thoriumReactor)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -174,21 +218,23 @@ public class Zones implements ContentList{
|
|||||||
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
|
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
|
||||||
conditionWave = 3;
|
conditionWave = 3;
|
||||||
launchPeriod = 2;
|
launchPeriod = 2;
|
||||||
zoneRequirements = ZoneRequirement.with(stainedMountains, 40);
|
requirements = with(stainedMountains, 40);
|
||||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
resources = Array.with(Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
||||||
}};*/
|
}};*/
|
||||||
|
|
||||||
nuclearComplex = new Zone("nuclearComplex", new MapGenerator("nuclearProductionComplex", 1)
|
nuclearComplex = new Zone("nuclearComplex", new MapGenerator("nuclearProductionComplex", 1)
|
||||||
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{
|
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{
|
||||||
loadout = Loadouts.basicNucleus;
|
loadout = Loadouts.basicNucleus;
|
||||||
baseLaunchCost = ItemStack.with();
|
startingItems = list(copper, 1250, lead, 1500, Items.silicon, 400, Items.metaglass, 250);
|
||||||
startingItems = ItemStack.list(Items.copper, 1250, Items.lead, 1500, Items.silicon, 400, Items.metaglass, 250);
|
|
||||||
conditionWave = 30;
|
conditionWave = 30;
|
||||||
launchPeriod = 15;
|
launchPeriod = 15;
|
||||||
zoneRequirements = ZoneRequirement.with(fungalPass, 8);
|
resources = with(copper, scrap, lead, coal, titanium, thorium, sand);
|
||||||
blockRequirements = new Block[]{Blocks.thermalGenerator, Blocks.laserDrill};
|
requirements = with(
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium, Items.sand};
|
new Launched(fungalPass),
|
||||||
|
new Unlock(Blocks.thermalGenerator),
|
||||||
|
new Unlock(Blocks.laserDrill)
|
||||||
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -198,9 +244,9 @@ public class Zones implements ContentList{
|
|||||||
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
|
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
|
||||||
conditionWave = 3;
|
conditionWave = 3;
|
||||||
launchPeriod = 2;
|
launchPeriod = 2;
|
||||||
zoneRequirements = ZoneRequirement.with(nuclearComplex, 40);
|
requirements = with(nuclearComplex, 40);
|
||||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium};
|
resources = Array.with(Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium};
|
||||||
}};*/
|
}};*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,11 +151,15 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Events.on(ZoneRequireCompleteEvent.class, e -> {
|
Events.on(ZoneRequireCompleteEvent.class, e -> {
|
||||||
ui.hudfrag.showToast(Core.bundle.format("zone.requirement.complete", state.wave, e.zone.localizedName));
|
if(e.objective.display() != null){
|
||||||
|
ui.hudfrag.showToast(Core.bundle.format("zone.requirement.complete", e.zoneForMet.localizedName, e.objective.display()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(ZoneConfigureCompleteEvent.class, e -> {
|
Events.on(ZoneConfigureCompleteEvent.class, e -> {
|
||||||
ui.hudfrag.showToast(Core.bundle.format("zone.config.complete", e.zone.configureWave));
|
if(e.zone.configureObjective.display() != null){
|
||||||
|
ui.hudfrag.showToast(Core.bundle.format("zone.config.unlocked", e.zone.configureObjective.display()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(Trigger.newGame, () -> {
|
Events.on(Trigger.newGame, () -> {
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ public class Logic implements ApplicationListener{
|
|||||||
public void runWave(){
|
public void runWave(){
|
||||||
spawner.spawnEnemies();
|
spawner.spawnEnemies();
|
||||||
state.wave++;
|
state.wave++;
|
||||||
state.wavetime = world.isZone() && world.getZone().isBossWave(state.wave) ? state.rules.waveSpacing * state.rules.bossWaveMultiplier :
|
state.wavetime = world.isZone() && world.getZone().isLaunchWave(state.wave) ? state.rules.waveSpacing * state.rules.launchWaveMultiplier : state.rules.waveSpacing;
|
||||||
world.isZone() && world.getZone().isLaunchWave(state.wave) ? state.rules.waveSpacing * state.rules.launchWaveMultiplier : state.rules.waveSpacing;
|
|
||||||
|
|
||||||
Events.fire(new WaveEvent());
|
Events.fire(new WaveEvent());
|
||||||
}
|
}
|
||||||
@@ -180,6 +179,10 @@ public class Logic implements ApplicationListener{
|
|||||||
Effects.effect(Fx.launch, tile);
|
Effects.effect(Fx.launch, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(world.getZone() != null){
|
||||||
|
world.getZone().setLaunched();
|
||||||
|
}
|
||||||
|
|
||||||
Time.runTask(30f, () -> {
|
Time.runTask(30f, () -> {
|
||||||
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
|
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
|
||||||
for(Item item : content.items()){
|
for(Item item : content.items()){
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
import io.anuke.arc.util.ArcAnnotate.*;
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.mod.Mods.*;
|
import io.anuke.mindustry.mod.Mods.*;
|
||||||
import io.anuke.mindustry.type.ContentType;
|
import io.anuke.mindustry.type.*;
|
||||||
|
|
||||||
|
|
||||||
/** Base class for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}. */
|
/** Base class for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}. */
|
||||||
public abstract class Content{
|
public abstract class Content implements Comparable<Content>{
|
||||||
public final short id;
|
public final short id;
|
||||||
/** The mod that loaded this piece of content. */
|
/** The mod that loaded this piece of content. */
|
||||||
public @Nullable LoadedMod mod;
|
public @Nullable LoadedMod mod;
|
||||||
@@ -34,6 +34,11 @@ public abstract class Content{
|
|||||||
public void load(){
|
public void load(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(Content c){
|
||||||
|
return Integer.compare(id, c.id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return getContentType().name() + "#" + id;
|
return getContentType().name() + "#" + id;
|
||||||
|
|||||||
@@ -61,11 +61,13 @@ public class EventType{
|
|||||||
|
|
||||||
/** Called when a zone's requirements are met. */
|
/** Called when a zone's requirements are met. */
|
||||||
public static class ZoneRequireCompleteEvent{
|
public static class ZoneRequireCompleteEvent{
|
||||||
public final Zone zone, required;
|
public final Zone zoneMet, zoneForMet;
|
||||||
|
public final Objective objective;
|
||||||
|
|
||||||
public ZoneRequireCompleteEvent(Zone zone, Zone required){
|
public ZoneRequireCompleteEvent(Zone zoneMet, Zone zoneForMet, Objective objective){
|
||||||
this.zone = zone;
|
this.zoneMet = zoneMet;
|
||||||
this.required = required;
|
this.zoneForMet = zoneForMet;
|
||||||
|
this.objective = objective;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,12 +91,17 @@ public class GlobalData{
|
|||||||
state.stats.itemsDelivered.getAndIncrement(item, 0, amount);
|
state.stats.itemsDelivered.getAndIncrement(item, 0, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasItems(Array<ItemStack> stacks){
|
||||||
|
return !stacks.contains(s -> items.get(s.item, 0) < s.amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasItems(ItemStack[] stacks){
|
public boolean hasItems(ItemStack[] stacks){
|
||||||
for(ItemStack stack : stacks){
|
for(ItemStack stack : stacks){
|
||||||
if(items.get(stack.item, 0) < stack.amount){
|
if(!has(stack.item, stack.amount)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +112,13 @@ public class GlobalData{
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeItems(Array<ItemStack> stacks){
|
||||||
|
for(ItemStack stack : stacks){
|
||||||
|
items.getAndIncrement(stack.item, 0, -stack.amount);
|
||||||
|
}
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean has(Item item, int amount){
|
public boolean has(Item item, int amount){
|
||||||
return items.get(item, 0) >= amount;
|
return items.get(item, 0) >= amount;
|
||||||
}
|
}
|
||||||
|
|||||||
27
core/src/io/anuke/mindustry/game/Objective.java
Normal file
27
core/src/io/anuke/mindustry/game/Objective.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
|
import io.anuke.mindustry.game.Objectives.*;
|
||||||
|
import io.anuke.mindustry.type.*;
|
||||||
|
|
||||||
|
/** Defines a specific objective for a game. */
|
||||||
|
public interface Objective{
|
||||||
|
|
||||||
|
/** @return whether this objective is met. */
|
||||||
|
boolean complete();
|
||||||
|
|
||||||
|
/** @return the string displayed when this objective is completed, in imperative form.
|
||||||
|
* e.g. when the objective is 'complete 10 waves', this would display "complete 10 waves".
|
||||||
|
* If this objective should not be displayed, should return null.*/
|
||||||
|
@Nullable String display();
|
||||||
|
|
||||||
|
/** Build a display for this zone requirement.*/
|
||||||
|
default void build(Table table){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
default Zone zone(){
|
||||||
|
return this instanceof ZoneObjective ? ((ZoneObjective)this).zone : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
96
core/src/io/anuke/mindustry/game/Objectives.java
Normal file
96
core/src/io/anuke/mindustry/game/Objectives.java
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
|
import io.anuke.mindustry.type.*;
|
||||||
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
|
/** Holds objective classes. */
|
||||||
|
public class Objectives{
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
public static class Wave implements Objective{
|
||||||
|
public int wave;
|
||||||
|
|
||||||
|
public Wave(int wave){
|
||||||
|
this.wave = wave;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Wave(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean complete(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(){
|
||||||
|
//TODO
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Unlock implements Objective{
|
||||||
|
public @NonNull Block block;
|
||||||
|
|
||||||
|
public Unlock(Block block){
|
||||||
|
this.block = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Unlock(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean complete(){
|
||||||
|
return block.unlocked();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(){
|
||||||
|
return Core.bundle.format("requirement.unlock", block.localizedName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ZoneWave extends ZoneObjective{
|
||||||
|
public int wave;
|
||||||
|
|
||||||
|
public ZoneWave(Zone zone, int wave){
|
||||||
|
this.zone = zone;
|
||||||
|
this.wave = wave;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ZoneWave(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean complete(){
|
||||||
|
return zone.bestWave() >= wave;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(){
|
||||||
|
return Core.bundle.format("requirement.wave", wave, zone.localizedName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Launched extends ZoneObjective{
|
||||||
|
|
||||||
|
public Launched(Zone zone){
|
||||||
|
this.zone = zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Launched(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean complete(){
|
||||||
|
return zone.hasLaunched();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(){
|
||||||
|
return Core.bundle.format("requirement.core", zone.localizedName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract static class ZoneObjective implements Objective{
|
||||||
|
public @NonNull Zone zone;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
import io.anuke.annotations.Annotations.Serialize;
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.io.JsonIO;
|
import io.anuke.mindustry.io.*;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Zone;
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines current rules on how the game should function.
|
* Defines current rules on how the game should function.
|
||||||
@@ -69,6 +69,8 @@ public class Rules{
|
|||||||
public boolean tutorial = false;
|
public boolean tutorial = false;
|
||||||
/** Starting items put in cores */
|
/** Starting items put in cores */
|
||||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
||||||
|
/** Blocks that cannot be placed. */
|
||||||
|
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
|
||||||
|
|
||||||
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
||||||
public Rules copy(){
|
public Rules copy(){
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import io.anuke.mindustry.entities.Effects.*;
|
|||||||
import io.anuke.mindustry.entities.bullet.*;
|
import io.anuke.mindustry.entities.bullet.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
|
import io.anuke.mindustry.game.Objectives.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.mod.Mods.*;
|
import io.anuke.mindustry.mod.Mods.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
@@ -39,7 +40,7 @@ public class ContentParser{
|
|||||||
put(BulletType.class, (type, data) -> {
|
put(BulletType.class, (type, data) -> {
|
||||||
Class<? extends BulletType> bc = data.has("type") ? resolve(data.getString("type"), "io.anuke.mindustry.entities.bullets") : BasicBulletType.class;
|
Class<? extends BulletType> bc = data.has("type") ? resolve(data.getString("type"), "io.anuke.mindustry.entities.bullets") : BasicBulletType.class;
|
||||||
data.remove("type");
|
data.remove("type");
|
||||||
BulletType result = bc.getDeclaredConstructor().newInstance();
|
BulletType result = make(bc);
|
||||||
readFields(result, data);
|
readFields(result, data);
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
@@ -60,6 +61,13 @@ public class ContentParser{
|
|||||||
Log.info(Core.assets.get(path));
|
Log.info(Core.assets.get(path));
|
||||||
return Core.assets.get(path);
|
return Core.assets.get(path);
|
||||||
});
|
});
|
||||||
|
put(Objective.class, (type, data) -> {
|
||||||
|
Class<? extends Objective> oc = data.has("type") ? resolve(data.getString("type"), "io.anuke.mindustry.game.Objectives") : ZoneWave.class;
|
||||||
|
data.remove("type");
|
||||||
|
Objective obj = make(oc);
|
||||||
|
readFields(obj, data);
|
||||||
|
return obj;
|
||||||
|
});
|
||||||
}};
|
}};
|
||||||
/** Stores things that need to be parsed fully, e.g. reading fields of content.
|
/** Stores things that need to be parsed fully, e.g. reading fields of content.
|
||||||
* This is done to accomodate binding of content names first.*/
|
* This is done to accomodate binding of content names first.*/
|
||||||
@@ -115,6 +123,7 @@ public class ContentParser{
|
|||||||
);
|
);
|
||||||
|
|
||||||
Block block = type.getDeclaredConstructor(String.class).newInstance(mod + "-" + name);
|
Block block = type.getDeclaredConstructor(String.class).newInstance(mod + "-" + name);
|
||||||
|
currentContent = block;
|
||||||
read(() -> {
|
read(() -> {
|
||||||
if(value.has("consumes")){
|
if(value.has("consumes")){
|
||||||
for(JsonValue child : value.get("consumes")){
|
for(JsonValue child : value.get("consumes")){
|
||||||
@@ -159,6 +168,7 @@ public class ContentParser{
|
|||||||
|
|
||||||
Class<BaseUnit> type = resolve(value.getString("type"), "io.anuke.mindustry.entities.type.base");
|
Class<BaseUnit> type = resolve(value.getString("type"), "io.anuke.mindustry.entities.type.base");
|
||||||
UnitType unit = new UnitType(mod + "-" + name, supply(type));
|
UnitType unit = new UnitType(mod + "-" + name, supply(type));
|
||||||
|
currentContent = unit;
|
||||||
read(() -> readFields(unit, value, true));
|
read(() -> readFields(unit, value, true));
|
||||||
|
|
||||||
return unit;
|
return unit;
|
||||||
@@ -179,6 +189,7 @@ public class ContentParser{
|
|||||||
|
|
||||||
item = constructor.get(mod + "-" + name);
|
item = constructor.get(mod + "-" + name);
|
||||||
}
|
}
|
||||||
|
currentContent = item;
|
||||||
read(() -> readFields(item, value));
|
read(() -> readFields(item, value));
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
@@ -225,7 +236,11 @@ public class ContentParser{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finishParsing(){
|
public void finishParsing(){
|
||||||
reads.each(Runnable::run);
|
try{
|
||||||
|
reads.each(Runnable::run);
|
||||||
|
}catch(Exception e){
|
||||||
|
throw new RuntimeException("Error occurred parsing content: " + currentContent, e);
|
||||||
|
}
|
||||||
reads.clear();
|
reads.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +268,16 @@ public class ContentParser{
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> T make(Class<T> type){
|
||||||
|
try{
|
||||||
|
java.lang.reflect.Constructor<T> cons = type.getDeclaredConstructor();
|
||||||
|
cons.setAccessible(true);
|
||||||
|
return cons.newInstance();
|
||||||
|
}catch(Exception e){
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <T> Supplier<T> supply(Class<T> type){
|
private <T> Supplier<T> supply(Class<T> type){
|
||||||
try{
|
try{
|
||||||
java.lang.reflect.Constructor<T> cons = type.getDeclaredConstructor();
|
java.lang.reflect.Constructor<T> cons = type.getDeclaredConstructor();
|
||||||
@@ -366,9 +391,13 @@ public class ContentParser{
|
|||||||
try{
|
try{
|
||||||
return (Class<T>)Class.forName(type + '.' + base);
|
return (Class<T>)Class.forName(type + '.' + base);
|
||||||
}catch(Exception ignored){
|
}catch(Exception ignored){
|
||||||
|
try{
|
||||||
|
return (Class<T>)Class.forName(type + '$' + base);
|
||||||
|
}catch(Exception ignored2){
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Type not found: " + potentials[0]);
|
throw new IllegalArgumentException("Types not found: " + base + "." + potentials[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface FieldParser{
|
private interface FieldParser{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.mindustry.world.blocks.*;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.content;
|
import static io.anuke.mindustry.Vars.content;
|
||||||
|
|
||||||
public class Item extends UnlockableContent implements Comparable<Item>{
|
public class Item extends UnlockableContent{
|
||||||
public final Color color;
|
public final Color color;
|
||||||
|
|
||||||
/** type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}. */
|
/** type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}. */
|
||||||
@@ -61,11 +61,6 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
|||||||
return localizedName();
|
return localizedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Item item){
|
|
||||||
return Integer.compare(id, item.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContentType getContentType(){
|
public ContentType getContentType(){
|
||||||
return ContentType.item;
|
return ContentType.item;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ public class ItemStack implements Comparable<ItemStack>{
|
|||||||
item = Items.copper;
|
item = Items.copper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack copy(){
|
||||||
|
return new ItemStack(item, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(ItemStack other){
|
public boolean equals(ItemStack other){
|
||||||
return other != null && other.item == item && other.amount == amount;
|
return other != null && other.item == item && other.amount == amount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,34 +5,32 @@ import io.anuke.arc.collection.*;
|
|||||||
import io.anuke.arc.function.*;
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
|
||||||
import io.anuke.arc.util.ArcAnnotate.*;
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
|
import io.anuke.mindustry.game.Objectives.*;
|
||||||
import io.anuke.mindustry.maps.generators.*;
|
import io.anuke.mindustry.maps.generators.*;
|
||||||
import io.anuke.mindustry.world.*;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Zone extends UnlockableContent{
|
public class Zone extends UnlockableContent{
|
||||||
public @NonNull Generator generator;
|
public @NonNull Generator generator;
|
||||||
public Block[] blockRequirements = {};
|
public @NonNull Objective configureObjective = new ZoneWave(this, 15);
|
||||||
public ZoneRequirement[] zoneRequirements = {};
|
public Array<Objective> requirements = new Array<>();
|
||||||
public Item[] resources = {};
|
//TODO autogenerate
|
||||||
|
public Array<Item> resources = new Array<>();
|
||||||
|
|
||||||
public Consumer<Rules> rules = rules -> {};
|
public Consumer<Rules> rules = rules -> {};
|
||||||
public boolean alwaysUnlocked;
|
public boolean alwaysUnlocked;
|
||||||
public int conditionWave = Integer.MAX_VALUE;
|
public int conditionWave = Integer.MAX_VALUE;
|
||||||
public int configureWave = 15;
|
|
||||||
public int launchPeriod = 10;
|
public int launchPeriod = 10;
|
||||||
public Loadout loadout = Loadouts.basicShard;
|
public Loadout loadout = Loadouts.basicShard;
|
||||||
public TextureRegion preview;
|
public TextureRegion preview;
|
||||||
|
|
||||||
protected ItemStack[] baseLaunchCost = {};
|
protected Array<ItemStack> baseLaunchCost = new Array<>();
|
||||||
protected Array<ItemStack> startingItems = new Array<>();
|
protected Array<ItemStack> startingItems = new Array<>();
|
||||||
protected ItemStack[] launchCost = null;
|
protected Array<ItemStack> launchCost;
|
||||||
|
|
||||||
private Array<ItemStack> defaultStartingItems = new Array<>();
|
private Array<ItemStack> defaultStartingItems = new Array<>();
|
||||||
|
|
||||||
@@ -60,35 +58,15 @@ public class Zone extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBossWave(int wave){
|
|
||||||
return wave % configureWave == 0 && wave > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLaunchWave(int wave){
|
public boolean isLaunchWave(int wave){
|
||||||
return metCondition() && wave % launchPeriod == 0;
|
return metCondition() && wave % launchPeriod == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUnlock(){
|
public boolean canUnlock(){
|
||||||
if(data.isUnlocked(this)){
|
return data.isUnlocked(this) || !requirements.contains(r -> !r.complete());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(ZoneRequirement other : zoneRequirements){
|
|
||||||
if(other.zone.bestWave() < other.wave){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Block other : blockRequirements){
|
|
||||||
if(!data.isUnlocked(other)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getLaunchCost(){
|
public Array<ItemStack> getLaunchCost(){
|
||||||
if(launchCost == null){
|
if(launchCost == null){
|
||||||
updateLaunchCost();
|
updateLaunchCost();
|
||||||
}
|
}
|
||||||
@@ -104,30 +82,54 @@ public class Zone extends UnlockableContent{
|
|||||||
defaultStartingItems.each(stack -> startingItems.add(new ItemStack(stack.item, stack.amount)));
|
defaultStartingItems.each(stack -> startingItems.add(new ItemStack(stack.item, stack.amount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasLaunched(){
|
||||||
|
return Core.settings.getBool(name + "-launched", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaunched(){
|
||||||
|
updateObjectives(() -> {
|
||||||
|
Core.settings.put(name + "-launched", true);
|
||||||
|
data.modified();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void updateWave(int wave){
|
public void updateWave(int wave){
|
||||||
int value = Core.settings.getInt(name + "-wave", 0);
|
int value = Core.settings.getInt(name + "-wave", 0);
|
||||||
|
|
||||||
if(value < wave){
|
if(value < wave){
|
||||||
Core.settings.put(name + "-wave", wave);
|
updateObjectives(() -> {
|
||||||
data.modified();
|
Core.settings.put(name + "-wave", wave);
|
||||||
|
data.modified();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(Zone zone : content.zones()){
|
public void updateObjectives(Runnable closure){
|
||||||
ZoneRequirement req = Structs.find(zone.zoneRequirements, f -> f.zone == this);
|
Array<ZoneObjective> incomplete = content.zones()
|
||||||
if(req != null && wave == req.wave + 1){
|
.map(z -> z.requirements).<Objective>flatten()
|
||||||
Events.fire(new ZoneRequireCompleteEvent(zone, this));
|
.select(o -> o.zone() == this && !o.complete())
|
||||||
}
|
.as(ZoneObjective.class);
|
||||||
}
|
|
||||||
|
|
||||||
if(wave == configureWave + 1){
|
boolean wasConfig = configureObjective.complete();
|
||||||
Events.fire(new ZoneConfigureCompleteEvent(this));
|
|
||||||
|
closure.run();
|
||||||
|
for(ZoneObjective objective : incomplete){
|
||||||
|
if(objective.complete()){
|
||||||
|
Events.fire(new ZoneRequireCompleteEvent(objective.zone, content.zones().find(z -> z.requirements.contains(objective)), objective));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!wasConfig && configureObjective.complete()){
|
||||||
|
Events.fire(new ZoneConfigureCompleteEvent(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int bestWave(){
|
public int bestWave(){
|
||||||
return Core.settings.getInt(name + "-wave", 0);
|
return Core.settings.getInt(name + "-wave", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCompleted(){
|
/** @return whether initial conditions to launch are met. */
|
||||||
|
public boolean isLaunchMet(){
|
||||||
return bestWave() >= conditionWave;
|
return bestWave() >= conditionWave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +154,7 @@ public class Zone extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
stacks.sort();
|
stacks.sort();
|
||||||
launchCost = stacks.toArray(ItemStack.class);
|
launchCost = stacks;
|
||||||
Core.settings.putObject(name + "-starting-items", startingItems);
|
Core.settings.putObject(name + "-starting-items", startingItems);
|
||||||
data.modified();
|
data.modified();
|
||||||
}
|
}
|
||||||
@@ -164,13 +166,13 @@ public class Zone extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConfigure(){
|
public boolean canConfigure(){
|
||||||
return bestWave() >= configureWave;
|
return configureObjective.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
generator.init(loadout);
|
generator.init(loadout);
|
||||||
Arrays.sort(resources);
|
resources.sort();
|
||||||
|
|
||||||
for(ItemStack stack : startingItems){
|
for(ItemStack stack : startingItems){
|
||||||
defaultStartingItems.add(new ItemStack(stack.item, stack.amount));
|
defaultStartingItems.add(new ItemStack(stack.item, stack.amount));
|
||||||
@@ -208,26 +210,4 @@ public class Zone extends UnlockableContent{
|
|||||||
return ContentType.zone;
|
return ContentType.zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ZoneRequirement{
|
|
||||||
public @NonNull Zone zone;
|
|
||||||
public @NonNull int wave;
|
|
||||||
|
|
||||||
public ZoneRequirement(Zone zone, int wave){
|
|
||||||
this.zone = zone;
|
|
||||||
this.wave = wave;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ZoneRequirement(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,112 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.function.*;
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.style.*;
|
||||||
|
import io.anuke.arc.scene.ui.*;
|
||||||
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.*;
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.Rules;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.ItemType;
|
import io.anuke.mindustry.ui.*;
|
||||||
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class CustomRulesDialog extends FloatingDialog{
|
public class CustomRulesDialog extends FloatingDialog{
|
||||||
private Table main;
|
private Table main;
|
||||||
private Rules rules;
|
private Rules rules;
|
||||||
private Supplier<Rules> resetter;
|
private Supplier<Rules> resetter;
|
||||||
private LoadoutDialog loadoutDialog;
|
private LoadoutDialog loadoutDialog;
|
||||||
|
private FloatingDialog banDialog;
|
||||||
|
|
||||||
public CustomRulesDialog(){
|
public CustomRulesDialog(){
|
||||||
super("$mode.custom");
|
super("$mode.custom");
|
||||||
|
|
||||||
loadoutDialog = new LoadoutDialog();
|
loadoutDialog = new LoadoutDialog();
|
||||||
|
banDialog = new FloatingDialog("$bannedblocks");
|
||||||
|
banDialog.addCloseButton();
|
||||||
|
|
||||||
|
banDialog.shown(this::rebuildBanned);
|
||||||
|
banDialog.buttons.addImageTextButton("$addall", Icon.arrow16Small, () -> {
|
||||||
|
rules.bannedBlocks.addAll(content.blocks().select(Block::isBuildable));
|
||||||
|
rebuildBanned();
|
||||||
|
}).size(180, 64f);
|
||||||
|
|
||||||
|
banDialog.buttons.addImageTextButton("$clear", Icon.trash16Small, () -> {
|
||||||
|
rules.bannedBlocks.clear();
|
||||||
|
rebuildBanned();
|
||||||
|
}).size(180, 64f);
|
||||||
|
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
shown(this::setup);
|
shown(this::setup);
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void rebuildBanned(){
|
||||||
|
float previousScroll = banDialog.cont.getChildren().isEmpty() ? 0f : ((ScrollPane)banDialog.cont.getChildren().first()).getScrollY();
|
||||||
|
banDialog.cont.clear();
|
||||||
|
banDialog.cont.pane(t -> {
|
||||||
|
t.margin(10f);
|
||||||
|
|
||||||
|
if(rules.bannedBlocks.isEmpty()){
|
||||||
|
t.add("$empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
Array<Block> array = Array.with(rules.bannedBlocks);
|
||||||
|
array.sort();
|
||||||
|
|
||||||
|
int cols = mobile && Core.graphics.isPortrait() ? 1 : mobile ? 2 : 3;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for(Block block : array){
|
||||||
|
t.table(Tex.underline, b -> {
|
||||||
|
b.left().margin(4f);
|
||||||
|
b.addImage(block.icon(Cicon.medium)).size(Cicon.medium.size).padRight(3);
|
||||||
|
b.add(block.localizedName).color(Color.lightGray).padLeft(3).growX().left().wrap();
|
||||||
|
|
||||||
|
b.addImageButton(Icon.cancelSmall, Styles.clearPartiali, () -> {
|
||||||
|
rules.bannedBlocks.remove(block);
|
||||||
|
rebuildBanned();
|
||||||
|
}).size(70f).pad(-4f).padLeft(0f);
|
||||||
|
}).size(300f, 70f).padRight(5);
|
||||||
|
|
||||||
|
if(++i % cols == 0){
|
||||||
|
t.row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).get().setScrollYForce(previousScroll);
|
||||||
|
banDialog.cont.row();
|
||||||
|
banDialog.cont.addImageTextButton("$add", Icon.addSmall, () -> {
|
||||||
|
FloatingDialog dialog = new FloatingDialog("$add");
|
||||||
|
dialog.cont.pane(t -> {
|
||||||
|
t.left().margin(14f);
|
||||||
|
int[] i = {0};
|
||||||
|
content.blocks().each(b -> !rules.bannedBlocks.contains(b) && b.isBuildable(), b -> {
|
||||||
|
int cols = mobile && Core.graphics.isPortrait() ? 4 : 12;
|
||||||
|
t.addImageButton(new TextureRegionDrawable(b.icon(Cicon.medium)), Styles.cleari, () -> {
|
||||||
|
rules.bannedBlocks.add(b);
|
||||||
|
rebuildBanned();
|
||||||
|
dialog.hide();
|
||||||
|
}).size(60f).get().resizeImage(Cicon.medium.size);
|
||||||
|
|
||||||
|
if(++i[0] % cols == 0){
|
||||||
|
t.row();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.addCloseButton();
|
||||||
|
dialog.show();
|
||||||
|
}).size(300f, 64f);
|
||||||
|
}
|
||||||
|
|
||||||
public void show(Rules rules, Supplier<Rules> resetter){
|
public void show(Rules rules, Supplier<Rules> resetter){
|
||||||
this.rules = rules;
|
this.rules = rules;
|
||||||
this.resetter = resetter;
|
this.resetter = resetter;
|
||||||
@@ -67,18 +145,17 @@ public class CustomRulesDialog extends FloatingDialog{
|
|||||||
number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
|
number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
|
||||||
|
|
||||||
main.addButton("$configure",
|
main.addButton("$configure",
|
||||||
() -> loadoutDialog.show(
|
() -> loadoutDialog.show(Blocks.coreShard.itemCapacity, rules.loadout,
|
||||||
Blocks.coreShard.itemCapacity,
|
() -> {
|
||||||
() -> rules.loadout,
|
rules.loadout.clear();
|
||||||
() -> {
|
rules.loadout.add(new ItemStack(Items.copper, 100));
|
||||||
rules.loadout.clear();
|
}, () -> {}, () -> {}
|
||||||
rules.loadout.add(new ItemStack(Items.copper, 100));
|
|
||||||
},
|
|
||||||
() -> {}, () -> {},
|
|
||||||
item -> item.type == ItemType.material
|
|
||||||
)).left().width(300f);
|
)).left().width(300f);
|
||||||
main.row();
|
main.row();
|
||||||
|
|
||||||
|
main.addButton("$bannedblocks", banDialog::show).left().width(300f);
|
||||||
|
main.row();
|
||||||
|
|
||||||
title("$rules.title.player");
|
title("$rules.title.player");
|
||||||
number("$rules.playerdamagemultiplier", f -> rules.playerDamageMultiplier = f, () -> rules.playerDamageMultiplier);
|
number("$rules.playerdamagemultiplier", f -> rules.playerDamageMultiplier = f, () -> rules.playerDamageMultiplier);
|
||||||
number("$rules.playerhealthmultiplier", f -> rules.playerHealthMultiplier = f, () -> rules.playerHealthMultiplier);
|
number("$rules.playerhealthmultiplier", f -> rules.playerHealthMultiplier = f, () -> rules.playerHealthMultiplier);
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ import io.anuke.mindustry.gen.*;
|
|||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.io.SaveIO.*;
|
import io.anuke.mindustry.io.SaveIO.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Zone.*;
|
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
import io.anuke.mindustry.ui.Styles;
|
|
||||||
import io.anuke.mindustry.ui.TreeLayout.*;
|
import io.anuke.mindustry.ui.TreeLayout.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -129,7 +127,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
|
|
||||||
button.defaults().colspan(2);
|
button.defaults().colspan(2);
|
||||||
button.row();
|
button.row();
|
||||||
button.add(Core.bundle.format("save.wave", color + slot.getWave()));
|
button.add(Core.bundle.format("save", color + slot.getWave()));
|
||||||
button.row();
|
button.row();
|
||||||
button.label(() -> Core.bundle.format("save.playtime", color + slot.getPlayTime()));
|
button.label(() -> Core.bundle.format("save.playtime", color + slot.getPlayTime()));
|
||||||
button.row();
|
button.row();
|
||||||
@@ -156,7 +154,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
node.allChildren.clear();
|
node.allChildren.clear();
|
||||||
node.allChildren.addAll(node.children);
|
node.allChildren.addAll(node.children);
|
||||||
for(ZoneNode other : new ObjectSetIterator<>(nodes)){
|
for(ZoneNode other : new ObjectSetIterator<>(nodes)){
|
||||||
if(Structs.contains(other.zone.zoneRequirements, req -> req.zone == node.zone)){
|
if(other.zone.requirements.contains(req -> req.zone() == node.zone)){
|
||||||
node.allChildren.add(other);
|
node.allChildren.add(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,12 +162,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean hidden(Zone zone){
|
boolean hidden(Zone zone){
|
||||||
for(ZoneRequirement other : zone.zoneRequirements){
|
return zone.requirements.contains(o -> o.zone() != null && o.zone().locked());
|
||||||
if(!data.isUnlocked(other.zone)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildButton(Zone zone, Button button){
|
void buildButton(Zone zone, Button button){
|
||||||
@@ -258,7 +251,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
//this.height /= 2f;
|
//this.height /= 2f;
|
||||||
nodes.add(this);
|
nodes.add(this);
|
||||||
|
|
||||||
arr.selectFrom(content.zones(), other -> other.zoneRequirements.length > 0 && other.zoneRequirements[0].zone == zone);
|
arr.selectFrom(content.zones(), other -> other.requirements.size > 0 && other.requirements.first().zone() == zone);
|
||||||
|
|
||||||
children = new ZoneNode[arr.size];
|
children = new ZoneNode[arr.size];
|
||||||
for(int i = 0; i < children.length; i++){
|
for(int i = 0; i < children.length; i++){
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package io.anuke.mindustry.ui.dialogs;
|
|||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.function.*;
|
|
||||||
import io.anuke.arc.input.*;
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
@@ -16,10 +14,12 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class LoadoutDialog extends FloatingDialog{
|
public class LoadoutDialog extends FloatingDialog{
|
||||||
private Runnable hider;
|
private Runnable hider;
|
||||||
private Supplier<Array<ItemStack>> supplier;
|
//private Supplier<Array<ItemStack>> supplier;
|
||||||
private Runnable resetter;
|
private Runnable resetter;
|
||||||
private Runnable updater;
|
private Runnable updater;
|
||||||
private Predicate<Item> filter;
|
private Array<ItemStack> stacks = new Array<>();
|
||||||
|
private Array<ItemStack> originalStacks = new Array<>();
|
||||||
|
//private Predicate<Item> filter;
|
||||||
private Table items;
|
private Table items;
|
||||||
private int capacity;
|
private int capacity;
|
||||||
|
|
||||||
@@ -33,54 +33,37 @@ public class LoadoutDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cont.add(items = new Table()).left();
|
cont.pane(t -> items = t.margin(10f)).left();
|
||||||
|
|
||||||
shown(this::setup);
|
shown(this::setup);
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
|
originalStacks.selectFrom(stacks, s -> s.amount > 0);
|
||||||
|
updater.run();
|
||||||
if(hider != null){
|
if(hider != null){
|
||||||
hider.run();
|
hider.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cont.row();
|
buttons.addImageTextButton("$back", Icon.arrowLeft, this::hide).size(210f, 64f);
|
||||||
|
|
||||||
cont.addButton("$add", () -> {
|
buttons.addImageTextButton("$settings.reset", Icon.refreshSmall, () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("");
|
|
||||||
dialog.setFillParent(false);
|
|
||||||
for(Item item : content.items().select(item -> filter.test(item) && item.type == ItemType.material && supplier.get().find(stack -> stack.item == item) == null)){
|
|
||||||
TextButton button = dialog.cont.addButton("", Styles.cleart, () -> {
|
|
||||||
dialog.hide();
|
|
||||||
supplier.get().add(new ItemStack(item, 0));
|
|
||||||
updater.run();
|
|
||||||
setup();
|
|
||||||
}).size(300f, 36f).get();
|
|
||||||
button.clearChildren();
|
|
||||||
button.left();
|
|
||||||
button.addImage(item.icon(Cicon.small)).size(8 * 3).pad(4);
|
|
||||||
button.add(item.localizedName);
|
|
||||||
dialog.cont.row();
|
|
||||||
}
|
|
||||||
dialog.show();
|
|
||||||
}).size(100f, 40).left().disabled(b -> !content.items().contains(item -> filter.test(item) && !supplier.get().contains(stack -> stack.item == item)));
|
|
||||||
|
|
||||||
cont.row();
|
|
||||||
cont.addButton("$settings.reset", () -> {
|
|
||||||
resetter.run();
|
resetter.run();
|
||||||
updater.run();
|
updater.run();
|
||||||
setup();
|
setup();
|
||||||
}).size(210f, 64f);
|
}).size(210f, 64f);
|
||||||
|
|
||||||
cont.row();
|
|
||||||
cont.addImageTextButton("$back", Icon.arrowLeft, this::hide).size(210f, 64f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(int capacity, Supplier<Array<ItemStack>> supplier, Runnable reseter, Runnable updater, Runnable hider, Predicate<Item> filter){
|
public void show(int capacity, Array<ItemStack> stacks, Runnable reseter, Runnable updater, Runnable hider){
|
||||||
|
this.originalStacks = stacks;
|
||||||
|
this.stacks = stacks.map(ItemStack::copy);
|
||||||
|
this.stacks.addAll(content.items().select(i -> i.type == ItemType.material &&
|
||||||
|
!stacks.contains(stack -> stack.item == i)).map(i -> new ItemStack(i, 0)));
|
||||||
|
this.stacks.sort(Structs.comparingInt(s -> s.item.id));
|
||||||
this.resetter = reseter;
|
this.resetter = reseter;
|
||||||
this.supplier = supplier;
|
|
||||||
this.updater = updater;
|
this.updater = updater;
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
this.hider = hider;
|
this.hider = hider;
|
||||||
this.filter = filter;
|
//this.filter = filter;
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,41 +71,54 @@ public class LoadoutDialog extends FloatingDialog{
|
|||||||
items.clearChildren();
|
items.clearChildren();
|
||||||
items.left();
|
items.left();
|
||||||
float bsize = 40f;
|
float bsize = 40f;
|
||||||
int step = 50;
|
|
||||||
|
|
||||||
for(ItemStack stack : supplier.get()){
|
int i = 0;
|
||||||
items.addButton("x", Styles.clearPartialt, () -> {
|
|
||||||
supplier.get().remove(stack);
|
|
||||||
updater.run();
|
|
||||||
setup();
|
|
||||||
}).size(bsize);
|
|
||||||
|
|
||||||
items.addButton("-", Styles.clearPartialt, () -> {
|
for(ItemStack stack : stacks){
|
||||||
stack.amount = Math.max(stack.amount - step, 0);
|
items.table(Tex.pane, t -> {
|
||||||
updater.run();
|
t.margin(4).marginRight(8).left();
|
||||||
}).size(bsize);
|
t.addButton("-", Styles.cleart, () -> {
|
||||||
|
stack.amount = Math.max(stack.amount - step(stack.amount), 0);
|
||||||
|
updater.run();
|
||||||
|
}).size(bsize);
|
||||||
|
|
||||||
items.addButton("+", Styles.clearPartialt, () -> {
|
t.addButton("+", Styles.cleart, () -> {
|
||||||
stack.amount = Math.min(stack.amount + step, capacity);
|
stack.amount = Math.min(stack.amount + step(stack.amount), capacity);
|
||||||
updater.run();
|
updater.run();
|
||||||
}).size(bsize);
|
}).size(bsize);
|
||||||
|
|
||||||
items.addImageButton(Icon.pencilSmaller, Styles.clearPartial2i, () -> ui.showTextInput("$configure", stack.item.localizedName, 10, stack.amount + "", true, str -> {
|
t.addImageButton(Icon.pencilSmaller, Styles.cleari, () -> ui.showTextInput("$configure", stack.item.localizedName, 10, stack.amount + "", true, str -> {
|
||||||
if(Strings.canParsePostiveInt(str)){
|
if(Strings.canParsePostiveInt(str)){
|
||||||
int amount = Strings.parseInt(str);
|
int amount = Strings.parseInt(str);
|
||||||
if(amount >= 0 && amount <= capacity){
|
if(amount >= 0 && amount <= capacity){
|
||||||
stack.amount = amount;
|
stack.amount = amount;
|
||||||
updater.run();
|
updater.run();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
ui.showInfo(Core.bundle.format("configure.invalid", capacity));
|
||||||
ui.showInfo(Core.bundle.format("configure.invalid", capacity));
|
})).size(bsize);
|
||||||
})).size(bsize);
|
|
||||||
|
|
||||||
items.addImage(stack.item.icon(Cicon.small)).size(8 * 3).padRight(4).padLeft(4);
|
t.addImage(stack.item.icon(Cicon.small)).size(8 * 3).padRight(4).padLeft(4);
|
||||||
items.label(() -> stack.amount + "").left();
|
t.label(() -> stack.amount + "").left().width(90f);
|
||||||
|
}).pad(2).left().fillX();
|
||||||
|
|
||||||
items.row();
|
|
||||||
|
if(++i % 2 == 0 || (mobile && Core.graphics.isPortrait())){
|
||||||
|
items.row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int step(int amount){
|
||||||
|
if(amount < 1000){
|
||||||
|
return 100;
|
||||||
|
}else if(amount < 2000){
|
||||||
|
return 200;
|
||||||
|
}else if(amount < 5000){
|
||||||
|
return 500;
|
||||||
|
}else{
|
||||||
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.graphics.*;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
|
import io.anuke.mindustry.game.Objectives.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Zone.*;
|
|
||||||
import io.anuke.mindustry.world.*;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -38,8 +38,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
|
|
||||||
if(!zone.unlocked()) return;
|
if(!zone.unlocked()) return;
|
||||||
|
|
||||||
ItemStack[] stacks = zone.getLaunchCost();
|
for(ItemStack stack : zone.getLaunchCost()){
|
||||||
for(ItemStack stack : stacks){
|
|
||||||
if(stack.amount == 0) continue;
|
if(stack.amount == 0) continue;
|
||||||
|
|
||||||
if(i++ % 2 == 0){
|
if(i++ % 2 == 0){
|
||||||
@@ -62,29 +61,32 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
cont.table(req -> {
|
cont.table(req -> {
|
||||||
req.defaults().left();
|
req.defaults().left();
|
||||||
|
|
||||||
if(zone.zoneRequirements.length > 0){
|
Array<Objective> zones = zone.requirements.select(o -> !(o instanceof Unlock));
|
||||||
|
|
||||||
|
if(!zones.isEmpty()){
|
||||||
req.table(r -> {
|
req.table(r -> {
|
||||||
r.add("$complete").colspan(2).left();
|
r.add("$complete").colspan(2).left();
|
||||||
r.row();
|
r.row();
|
||||||
for(ZoneRequirement other : zone.zoneRequirements){
|
for(Objective o : zones){
|
||||||
r.addImage(Icon.terrain).padRight(4);
|
r.addImage(Icon.terrain).padRight(4);
|
||||||
r.add(Core.bundle.format("zone.requirement", other.wave, other.zone.localizedName())).color(Color.lightGray);
|
r.add(o.display()).color(Color.lightGray);
|
||||||
r.addImage(other.zone.bestWave() >= other.wave ? Icon.checkSmall : Icon.cancelSmall, other.zone.bestWave() >= other.wave ? Color.lightGray : Color.scarlet).padLeft(3);
|
r.addImage(o.complete() ? Icon.checkSmall : Icon.cancelSmall, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||||
r.row();
|
r.row();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
req.row();
|
req.row();
|
||||||
|
Array<Unlock> blocks = zone.requirements.select(o -> o instanceof Unlock).as(Unlock.class);
|
||||||
|
|
||||||
if(zone.blockRequirements.length > 0){
|
if(!blocks.isEmpty()){
|
||||||
req.table(r -> {
|
req.table(r -> {
|
||||||
r.add("$research.list").colspan(2).left();
|
r.add("$research.list").colspan(2).left();
|
||||||
r.row();
|
r.row();
|
||||||
for(Block block : zone.blockRequirements){
|
for(Unlock blocko : blocks){
|
||||||
r.addImage(block.icon(Cicon.small)).size(8 * 3).padRight(4);
|
r.addImage(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
|
||||||
r.add(block.localizedName).color(Color.lightGray);
|
r.add(blocko.block.localizedName).color(Color.lightGray).left();
|
||||||
r.addImage(data.isUnlocked(block) ? Icon.checkSmall : Icon.cancelSmall, data.isUnlocked(block) ? Color.lightGray : Color.scarlet).padLeft(3);
|
r.addImage(blocko.block.unlocked() ? Icon.checkSmall : Icon.cancelSmall, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||||
r.row();
|
r.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +108,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
t.left();
|
t.left();
|
||||||
t.add("$zone.resources").padRight(6);
|
t.add("$zone.resources").padRight(6);
|
||||||
|
|
||||||
if(zone.resources.length > 0){
|
if(zone.resources.size > 0){
|
||||||
t.table(r -> {
|
t.table(r -> {
|
||||||
t.left();
|
t.left();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -135,8 +137,8 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
cont.addButton(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureWave),
|
cont.addButton(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
|
||||||
() -> loadout.show(zone.loadout.core().itemCapacity, zone::getStartingItems, zone::resetStartingItems, zone::updateLaunchCost, rebuildItems, item -> data.getItem(item) > 0 && item.type == ItemType.material)
|
() -> loadout.show(zone.loadout.core().itemCapacity, zone.getStartingItems(), zone::resetStartingItems, zone::updateLaunchCost, rebuildItems)
|
||||||
).fillX().pad(3).disabled(b -> !zone.canConfigure());
|
).fillX().pad(3).disabled(b -> !zone.canConfigure());
|
||||||
}
|
}
|
||||||
cont.marginRight(12f);
|
cont.marginRight(12f);
|
||||||
|
|||||||
@@ -151,6 +151,10 @@ public class PlacementFragment extends Fragment{
|
|||||||
Color color = state.rules.infiniteResources || (core != null && (core.items.has(block.requirements, state.rules.buildCostMultiplier) || state.rules.infiniteResources)) ? Color.white : Color.gray;
|
Color color = state.rules.infiniteResources || (core != null && (core.items.has(block.requirements, state.rules.buildCostMultiplier) || state.rules.infiniteResources)) ? Color.white : Color.gray;
|
||||||
button.forEach(elem -> elem.setColor(color));
|
button.forEach(elem -> elem.setColor(color));
|
||||||
button.setChecked(control.input.block == block);
|
button.setChecked(control.input.block == block);
|
||||||
|
|
||||||
|
if(state.rules.bannedBlocks.contains(block)){
|
||||||
|
button.forEach(elem -> elem.setColor(Color.darkGray));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
button.hovered(() -> hovered = block);
|
button.hovered(() -> hovered = block);
|
||||||
@@ -226,6 +230,15 @@ public class PlacementFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
}).growX().left().margin(3);
|
}).growX().left().margin(3);
|
||||||
|
|
||||||
|
if(state.rules.bannedBlocks.contains(lastDisplay)){
|
||||||
|
topTable.row();
|
||||||
|
topTable.table(b -> {
|
||||||
|
b.addImage(Icon.cancelSmall).padRight(2).color(Color.scarlet);
|
||||||
|
b.add("$banned");
|
||||||
|
b.left();
|
||||||
|
}).padTop(2).left();
|
||||||
|
}
|
||||||
|
|
||||||
}else if(tileDisplayBlock() != null){ //show selected tile
|
}else if(tileDisplayBlock() != null){ //show selected tile
|
||||||
lastDisplay = tileDisplayBlock();
|
lastDisplay = tileDisplayBlock();
|
||||||
topTable.table(t -> {
|
topTable.table(t -> {
|
||||||
@@ -301,7 +314,11 @@ public class PlacementFragment extends Fragment{
|
|||||||
returnArray.add(block);
|
returnArray.add(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnArray.sort((b1, b2) -> -Boolean.compare(unlocked(b1), unlocked(b2)));
|
returnArray.sort((b1, b2) -> {
|
||||||
|
int locked = -Boolean.compare(unlocked(b1), unlocked(b2));
|
||||||
|
if(locked != 0) return locked;
|
||||||
|
return Boolean.compare(state.rules.bannedBlocks.contains(b1), state.rules.bannedBlocks.contains(b2));
|
||||||
|
});
|
||||||
return returnArray;
|
return returnArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ public class Build{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(state.rules.bannedBlocks.contains(type) && !(state.rules.waves && team == waveTeam)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if((type.solid || type.solidifes) && Units.anyEntities(x * tilesize + type.offset() - type.size*tilesize/2f, y * tilesize + type.offset() - type.size*tilesize/2f, type.size * tilesize, type.size*tilesize)){
|
if((type.solid || type.solidifes) && Units.anyEntities(x * tilesize + type.offset() - type.size*tilesize/2f, y * tilesize + type.offset() - type.size*tilesize/2f, type.size * tilesize, type.size*tilesize)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=9f567f04a005ea8b4132b31d64f325ec105def5e
|
archash=59cff366c4d46577b659e153183eb824eaafd7f7
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.collection.ObjectSet;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Structs;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.game.SpawnGroup;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.world.blocks.storage.*;
|
||||||
import io.anuke.mindustry.type.Zone;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
|
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
|
||||||
|
|
||||||
public class ZoneTests{
|
public class ZoneTests{
|
||||||
@@ -68,7 +64,7 @@ public class ZoneTests{
|
|||||||
assertTrue(spawner.countSpawns() > 0 || (state.rules.attackMode && !state.teams.get(waveTeam).cores.isEmpty()), "Zone \"" + zone.name + "\" has no enemy spawn points: " + spawner.countSpawns());
|
assertTrue(spawner.countSpawns() > 0 || (state.rules.attackMode && !state.teams.get(waveTeam).cores.isEmpty()), "Zone \"" + zone.name + "\" has no enemy spawn points: " + spawner.countSpawns());
|
||||||
|
|
||||||
for(Item item : resources){
|
for(Item item : resources){
|
||||||
assertTrue(Structs.contains(zone.resources, item), "Zone \"" + zone.name + "\" is missing item in resource list: \"" + item.name + "\"");
|
assertTrue(zone.resources.contains(item), "Zone \"" + zone.name + "\" is missing item in resource list: \"" + item.name + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Item item : zone.resources){
|
for(Item item : zone.resources){
|
||||||
|
|||||||
Reference in New Issue
Block a user