Added interceptor factory / Sector-specific ore gen
This commit is contained in:
@@ -134,6 +134,7 @@ public class Recipes implements ContentList{
|
||||
//actual unit related stuff
|
||||
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 130));
|
||||
new Recipe(units, UnitBlocks.fabricatorFactory, new ItemStack(Items.carbide, 70), new ItemStack(Items.thorium, 100), new ItemStack(Items.lead, 150), new ItemStack(Items.silicon, 300));
|
||||
new Recipe(units, UnitBlocks.interceptorFactory, new ItemStack(Items.carbide, 70), new ItemStack(Items.thorium, 100), new ItemStack(Items.lead, 150), new ItemStack(Items.silicon, 300));
|
||||
|
||||
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
||||
new Recipe(units, UnitBlocks.resupplyPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.anuke.mindustry.game.Content;
|
||||
import io.anuke.mindustry.type.ContentList;
|
||||
|
||||
public class UnitTypes implements ContentList{
|
||||
public static UnitType drone, scout, vtol, monsoon, titan, fabricator;
|
||||
public static UnitType drone, scout, interceptor, monsoon, titan, fabricator;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -41,7 +41,7 @@ public class UnitTypes implements ContentList{
|
||||
health = 260;
|
||||
}};
|
||||
|
||||
vtol = new UnitType("vtol", Vtol.class, Vtol::new){{
|
||||
interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.9f;
|
||||
drag = 0.01f;
|
||||
|
||||
@@ -8,7 +8,8 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.units.*;
|
||||
|
||||
public class UnitBlocks extends BlockList implements ContentList{
|
||||
public static Block resupplyPoint, repairPoint, droneFactory, fabricatorFactory, dropPoint, reconstructor, overdriveProjector, shieldProjector;
|
||||
public static Block resupplyPoint, repairPoint, droneFactory, fabricatorFactory, interceptorFactory, dropPoint,
|
||||
reconstructor, overdriveProjector, shieldProjector, commandCenter;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -28,6 +29,14 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
|
||||
}};
|
||||
|
||||
interceptorFactory = new UnitFactory("interceptor-factory"){{
|
||||
type = UnitTypes.interceptor;
|
||||
produceTime = 1300;
|
||||
size = 2;
|
||||
consumes.power(0.1f);
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 40)});
|
||||
}};
|
||||
|
||||
resupplyPoint = new ResupplyPoint("resupply-point"){{
|
||||
shadow = "shadow-round-1";
|
||||
itemCapacity = 30;
|
||||
@@ -51,8 +60,12 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
shieldProjector = new ShieldProjector("shieldprojector"){{
|
||||
shieldProjector = new ShieldProjector("shield-projector"){{
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
commandCenter = new CommandCenter("command-center"){{
|
||||
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||
|
||||
public class Vtol extends FlyingUnit{
|
||||
public class Interceptor extends FlyingUnit{
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class Waves{
|
||||
unitScaling = 2;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
new SpawnGroup(UnitTypes.interceptor){{
|
||||
begin = 12;
|
||||
end = 14;
|
||||
}},
|
||||
@@ -70,7 +70,7 @@ public class Waves{
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
new SpawnGroup(UnitTypes.interceptor){{
|
||||
begin = 16;
|
||||
unitScaling = 2;
|
||||
spacing = 2;
|
||||
@@ -128,7 +128,7 @@ public class Waves{
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
new SpawnGroup(UnitTypes.interceptor){{
|
||||
begin = 50;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -210,7 +210,7 @@ public class BuildBlock extends Block{
|
||||
}
|
||||
|
||||
if(progress >= 1f || debug){
|
||||
CallBlocks.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), tile.getTeam());
|
||||
CallBlocks.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
package io.anuke.mindustry.world.blocks.units;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
import io.anuke.ucore.util.EnumSet;
|
||||
|
||||
public class CommandCenter extends Block{
|
||||
|
||||
public CommandCenter(String name){
|
||||
super(name);
|
||||
|
||||
flags = EnumSet.of(BlockFlag.comandCenter);
|
||||
destructible = true;
|
||||
solid = true;
|
||||
configurable = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,20 @@
|
||||
package io.anuke.mindustry.world.meta;
|
||||
|
||||
public enum BlockFlag{
|
||||
/**
|
||||
* General important target for all types of units.
|
||||
*/
|
||||
/**General important target for all types of units.*/
|
||||
target(0),
|
||||
/**
|
||||
* Point to resupply resources.
|
||||
*/
|
||||
/**Point to resupply resources.*/
|
||||
resupplyPoint(Float.MAX_VALUE),
|
||||
/**
|
||||
* Point to drop off resources.
|
||||
*/
|
||||
/**Point to drop off resources.*/
|
||||
dropPoint(Float.MAX_VALUE),
|
||||
/**
|
||||
* Producer of important goods.
|
||||
*/
|
||||
/**Producer of important goods.*/
|
||||
producer(20),
|
||||
/**
|
||||
* Producer or storage unit of volatile materials.
|
||||
*/
|
||||
/**Producer or storage unit of volatile materials.*/
|
||||
explosive(10),
|
||||
/**
|
||||
* Repair point.
|
||||
*/
|
||||
repair(Float.MAX_VALUE);
|
||||
/**Repair point.*/
|
||||
repair(Float.MAX_VALUE),
|
||||
/**Special flag for command center blocks.*/
|
||||
comandCenter(30);
|
||||
|
||||
public final float cost;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user