Added interceptor factory / Sector-specific ore gen
This commit is contained in:
@@ -6,6 +6,7 @@ import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||
import io.anuke.mindustry.game.SpawnGroup;
|
||||
import io.anuke.mindustry.maps.goals.Mission;
|
||||
import io.anuke.mindustry.maps.goals.WaveMission;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.ucore.util.Bits;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
@@ -25,6 +26,8 @@ public class Sector{
|
||||
public transient Mission mission = new WaveMission(30);
|
||||
/**Enemies spawned at this sector.*/
|
||||
public transient Array<SpawnGroup> spawns = new Array<>();
|
||||
/**Ores that appear in this sector.*/
|
||||
public transient Array<Item> ores = new Array<>();
|
||||
|
||||
public int getSeed(){
|
||||
return Bits.packInt(x, y);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.maps.generation.WorldGenerator.GenResult;
|
||||
@@ -118,6 +119,8 @@ public class Sectors{
|
||||
|
||||
private void initSector(Sector sector){
|
||||
sector.mission = new BattleMission();
|
||||
//add all ores for now since material differences aren't well handled yet
|
||||
sector.ores.addAll(Items.tungsten, Items.coal, Items.lead, Items.thorium, Items.titanium);
|
||||
}
|
||||
|
||||
private int round2(int i){
|
||||
|
||||
@@ -66,10 +66,10 @@ public class WorldGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
prepareTiles(tiles, seed, genOres);
|
||||
prepareTiles(tiles, seed, genOres, null);
|
||||
}
|
||||
|
||||
public void prepareTiles(Tile[][] tiles, long seed, boolean genOres){
|
||||
public void prepareTiles(Tile[][] tiles, long seed, boolean genOres, Array<Item> usedOres){
|
||||
|
||||
//find multiblocks
|
||||
IntArray multiblocks = new IntArray();
|
||||
@@ -136,7 +136,7 @@ public class WorldGenerator{
|
||||
oreIndex = 0;
|
||||
|
||||
if(genOres){
|
||||
Array<OreEntry> ores = Array.with(
|
||||
Array<OreEntry> baseOres = Array.with(
|
||||
new OreEntry(Items.tungsten, 0.3f, seed),
|
||||
new OreEntry(Items.coal, 0.284f, seed),
|
||||
new OreEntry(Items.lead, 0.28f, seed),
|
||||
@@ -144,6 +144,15 @@ public class WorldGenerator{
|
||||
new OreEntry(Items.thorium, 0.26f, seed)
|
||||
);
|
||||
|
||||
Array<OreEntry> ores = new Array<>();
|
||||
if(usedOres == null){
|
||||
ores.addAll(baseOres);
|
||||
}else{
|
||||
for(Item item : usedOres){
|
||||
ores.add(baseOres.select(entry -> entry.item == item).iterator().next());
|
||||
}
|
||||
}
|
||||
|
||||
for(int x = 0; x < tiles.length; x++){
|
||||
for(int y = 0; y < tiles[0].length; y++){
|
||||
|
||||
@@ -205,7 +214,7 @@ public class WorldGenerator{
|
||||
|
||||
sector.mission.generate(tiles, sector);
|
||||
|
||||
prepareTiles(tiles, sector.getSeed(), true);
|
||||
prepareTiles(tiles, sector.getSeed(), true, sector.ores);
|
||||
}
|
||||
|
||||
public GenResult generateTile(int sectorX, int sectorY, int localX, int localY){
|
||||
|
||||
Reference in New Issue
Block a user