Removed shadow/world padding
This commit is contained in:
@@ -2,6 +2,7 @@ package io.anuke.mindustry.maps;
|
||||
|
||||
import com.badlogic.gdx.utils.IntIntMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public class MapMeta{
|
||||
public final int version;
|
||||
@@ -18,15 +19,19 @@ public class MapMeta{
|
||||
}
|
||||
|
||||
public String author(){
|
||||
return tags.get("author", "unknown");
|
||||
return tag("author");
|
||||
}
|
||||
|
||||
public String description(){
|
||||
return tags.get("description", "unknown");
|
||||
return tag("description");
|
||||
}
|
||||
|
||||
public String name(){
|
||||
return tags.get("name", "unknown");
|
||||
return tag("name");
|
||||
}
|
||||
|
||||
public String tag(String name){
|
||||
return tags.containsKey(name) && !tags.get(name).trim().isEmpty() ? tags.get(name): Bundles.get("text.unknown");
|
||||
}
|
||||
|
||||
public boolean hasOreGen(){
|
||||
|
||||
@@ -23,10 +23,10 @@ public class SectorPresets{
|
||||
|
||||
public SectorPresets(){
|
||||
|
||||
//base tutorial mission (disabled)
|
||||
/*add(new SectorPreset(0, 0,
|
||||
//base tutorial mission
|
||||
add(new SectorPreset(0, 0,
|
||||
TutorialSector.getMissions(),
|
||||
Array.with(Items.copper, Items.coal, Items.lead)));*/
|
||||
Array.with(Items.copper, Items.coal, Items.lead)));
|
||||
|
||||
//command center mission
|
||||
add(new SectorPreset(0, 1,
|
||||
@@ -56,7 +56,8 @@ public class SectorPresets{
|
||||
Missions.blockRecipe(ProductionBlocks.waterExtractor),
|
||||
new ContentMission(Items.biomatter),
|
||||
Missions.blockRecipe(CraftingBlocks.biomatterCompressor),
|
||||
new ContentMission(Liquids.oil)
|
||||
new ContentMission(Liquids.oil),
|
||||
new BattleMission()
|
||||
),
|
||||
Array.with(Items.copper, Items.lead, Items.coal, Items.titanium)));
|
||||
}
|
||||
@@ -69,6 +70,8 @@ public class SectorPresets{
|
||||
return presets.get(x, y);
|
||||
}
|
||||
|
||||
public GridMap<SectorPreset> getPresets() { return presets; }
|
||||
|
||||
private void add(SectorPreset preset){
|
||||
presets.put(preset.x, preset.y, preset);
|
||||
orePresets.put(preset.x, preset.y, preset.ores);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Sectors{
|
||||
private final AsyncExecutor executor = new AsyncExecutor(6);
|
||||
|
||||
public void playSector(Sector sector){
|
||||
if(sector.hasSave() && SaveIO.breakingVersions.contains(sector.getSave().getBuild())){
|
||||
if(!headless && sector.hasSave() && SaveIO.breakingVersions.contains(sector.getSave().getBuild())){
|
||||
sector.getSave().delete();
|
||||
ui.showInfo("$text.save.old");
|
||||
}
|
||||
@@ -88,8 +88,6 @@ public class Sectors{
|
||||
|
||||
public Difficulty getDifficulty(Sector sector){
|
||||
if(sector.difficulty == 0){
|
||||
//yes, this means hard tutorial difficulty
|
||||
//(((have fun)))
|
||||
return Difficulty.hard;
|
||||
}else if(sector.difficulty < 4){
|
||||
return Difficulty.normal;
|
||||
@@ -158,7 +156,7 @@ public class Sectors{
|
||||
}
|
||||
grid.clear();
|
||||
|
||||
Array<Sector> out = Settings.getObject("sectors", Array.class, Array::new);
|
||||
Array<Sector> out = Settings.getObject("sector-data-2", Array.class, Array::new);
|
||||
|
||||
for(Sector sector : out){
|
||||
|
||||
@@ -187,7 +185,7 @@ public class Sectors{
|
||||
}
|
||||
}
|
||||
|
||||
Settings.putObject("sectors", out);
|
||||
Settings.putObject("sector-data-2", out);
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
@@ -229,7 +227,7 @@ public class Sectors{
|
||||
private void generate(Sector sector){
|
||||
|
||||
//50% chance to get a wave mission
|
||||
if(Mathf.randomSeed(sector.getSeed() + 6) < 0.5){
|
||||
if(Mathf.randomSeed(sector.getSeed() + 7) < 0.5){
|
||||
//recipe mission (maybe)
|
||||
addRecipeMission(sector, 3);
|
||||
sector.missions.add(new WaveMission(sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 1, 4)*5));
|
||||
|
||||
@@ -2,12 +2,15 @@ package io.anuke.mindustry.maps;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.UnitTypes;
|
||||
import io.anuke.mindustry.content.blocks.*;
|
||||
import io.anuke.mindustry.maps.generation.Generation;
|
||||
import io.anuke.mindustry.maps.missions.*;
|
||||
import io.anuke.mindustry.content.blocks.CraftingBlocks;
|
||||
import io.anuke.mindustry.content.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||
import io.anuke.mindustry.content.blocks.UnitBlocks;
|
||||
import io.anuke.mindustry.maps.missions.BlockMission;
|
||||
import io.anuke.mindustry.maps.missions.ItemMission;
|
||||
import io.anuke.mindustry.maps.missions.Mission;
|
||||
import io.anuke.mindustry.maps.missions.WaveMission;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -16,7 +19,7 @@ public class TutorialSector{
|
||||
private static int droneIndex;
|
||||
|
||||
public static Array<Mission> getMissions(){
|
||||
|
||||
/*
|
||||
Array<Mission> missions = Array.with(
|
||||
new ItemMission(Items.copper, 60).setMessage("$tutorial.begin"),
|
||||
|
||||
@@ -30,7 +33,8 @@ public class TutorialSector{
|
||||
//TODO fill turret with items mission
|
||||
//new BlockMission(ProductionBlocks.mechanicalDrill).setMessage("$tutorial.drillturret"),
|
||||
|
||||
new WaveMission(2).setMessage("$tutorial.waves"),
|
||||
// Create a wave mission which spawns the core at 60, 60 rather than in the center of the map
|
||||
new WaveMission(2, 60, 60).setMessage("$tutorial.waves"),
|
||||
|
||||
new ItemMission(Items.lead, 150).setMessage("$tutorial.lead"),
|
||||
new ItemMission(Items.copper, 250).setMessage("$tutorial.morecopper"),
|
||||
@@ -82,9 +86,21 @@ public class TutorialSector{
|
||||
droneIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return missions;
|
||||
return Array.with(
|
||||
//intentionally unlocalized
|
||||
new ItemMission(Items.copper, 50).setMessage("An updated tutorial will return next build.\nFor now, you'll have to deal with... this."),
|
||||
|
||||
new BlockMission(ProductionBlocks.mechanicalDrill),
|
||||
|
||||
new ItemMission(Items.copper, 100),
|
||||
new ItemMission(Items.lead, 50),
|
||||
|
||||
new BlockMission(CraftingBlocks.smelter),
|
||||
new ItemMission(Items.densealloy, 10),
|
||||
new WaveMission(5)
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean supressDrone(){
|
||||
|
||||
@@ -57,6 +57,7 @@ public class FortressGenerator{
|
||||
|
||||
void gen(){
|
||||
gen.setBlock(enemyX, enemyY, StorageBlocks.core, team);
|
||||
gen.random.nextBoolean();
|
||||
|
||||
float difficultyScl = Mathf.clamp(gen.sector.difficulty / 20f + gen.random.range(0.25f), 0f, 0.9999f);
|
||||
float dscl2 = Mathf.clamp(0.5f + gen.sector.difficulty / 20f + gen.random.range(0.1f), 0f, 1.5f);
|
||||
|
||||
@@ -312,7 +312,7 @@ public class WorldGenerator{
|
||||
+ sim3.octaveNoise2D(detailed ? 12 : 9, 0.6, 1f / 1100f, x - 120, y);
|
||||
double lake = sim2.octaveNoise2D(1, 1, 1f / 110f, x, y);
|
||||
|
||||
elevation -= lake/3f;
|
||||
elevation -= Math.pow(lake + 0.15, 5);
|
||||
|
||||
int lerpDst = 20;
|
||||
lerpDst *= lerpDst;
|
||||
@@ -330,9 +330,9 @@ public class WorldGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
if(elevation < 0.7 || lake > 0.96){
|
||||
if(elevation < 0.7){
|
||||
floor = Blocks.deepwater;
|
||||
}else if(elevation < 0.79 || lake > 0.948){
|
||||
}else if(elevation < 0.79){
|
||||
floor = Blocks.water;
|
||||
}else if(elevation < 0.85){
|
||||
floor = Blocks.sand;
|
||||
|
||||
@@ -12,8 +12,24 @@ import io.anuke.ucore.util.Bundles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class BattleMission extends Mission{
|
||||
public class BattleMission extends MissionWithStartingCore{
|
||||
final int spacing = 30;
|
||||
public static final int defaultXCorePos = 50;
|
||||
public static final int defaultYCorePos = 50;
|
||||
|
||||
/** Creates a battle mission with the player core being at (@defaultXCorePos, @defaultYCorePos) */
|
||||
public BattleMission(){
|
||||
this(defaultXCorePos, defaultYCorePos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a wave survival with the player core being at a custom location.
|
||||
* @param xCorePos The X coordinate of the custom core position.
|
||||
* @param yCorePos The Y coordinate of the custom core position.
|
||||
*/
|
||||
public BattleMission(int xCorePos, int yCorePos){
|
||||
super(xCorePos, yCorePos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon(){
|
||||
@@ -37,7 +53,7 @@ public class BattleMission extends Mission{
|
||||
|
||||
@Override
|
||||
public void generate(Generation gen){
|
||||
generateCoreAt(gen, 50, 50, defaultTeam);
|
||||
generateCoreAtFirstSpawnPoint(gen, defaultTeam);
|
||||
|
||||
if(state.teams.get(defaultTeam).cores.size == 0){
|
||||
return;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
|
||||
/**A mission that just displays some text.*/
|
||||
public class MessageMission extends ActionMission{
|
||||
|
||||
public MessageMission(String text){
|
||||
super(() -> {
|
||||
if(!Vars.headless){
|
||||
Vars.ui.showInfo(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -100,10 +100,4 @@ public abstract class Mission{
|
||||
}
|
||||
|
||||
public void generate(Generation gen){}
|
||||
|
||||
public void generateCoreAt(Generation gen, int coreX, int coreY, Team team){
|
||||
gen.tiles[coreX][coreY].setBlock(StorageBlocks.core);
|
||||
gen.tiles[coreX][coreY].setTeam(team);
|
||||
state.teams.get(team).cores.add(gen.tiles[coreX][coreY]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.maps.generation.Generation;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
|
||||
public abstract class MissionWithStartingCore extends Mission{
|
||||
/** Stores a custom starting location for the core, or null if the default calculation (map center) shall be used. */
|
||||
private final GridPoint2 customStartingPoint;
|
||||
|
||||
/** Default constructor. Missions created this way will have a player starting core in the center of the map. */
|
||||
MissionWithStartingCore(){
|
||||
this.customStartingPoint = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a mission with a core on a non-default location.
|
||||
* @param xCorePos The x coordinate of the custom core position.
|
||||
* @param yCorePos The y coordinate of the custom core position.
|
||||
*/
|
||||
MissionWithStartingCore(int xCorePos, int yCorePos){
|
||||
this.customStartingPoint = new GridPoint2(xCorePos, yCorePos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a player core based on generation parameters.
|
||||
* @param gen The generation parameters which provide the map size.
|
||||
* @param team The team to generate the core for.
|
||||
*/
|
||||
public void generateCoreAtFirstSpawnPoint(Generation gen, Team team){
|
||||
Array<GridPoint2> spawnPoints = getSpawnPoints(gen);
|
||||
if(spawnPoints == null || spawnPoints.size == 0){
|
||||
throw new IllegalArgumentException("A MissionWithStartingCore subclass did not provide a spawn point in getSpawnPoints(). However, at least one point must always be provided.");
|
||||
}
|
||||
|
||||
Tile startingCoreTile = gen.tiles[spawnPoints.first().x][spawnPoints.first().y];
|
||||
startingCoreTile.setBlock(StorageBlocks.core);
|
||||
startingCoreTile.setTeam(team);
|
||||
state.teams.get(team).cores.add(startingCoreTile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the spawn point in the center of the map or at a custom location which was provided through the constructor.
|
||||
* @param gen The generation parameters which provide the map size.
|
||||
* @return The center of the map or a custom location.
|
||||
* @implNote Must return an array with at least one entry.
|
||||
*/
|
||||
@Override
|
||||
public Array<GridPoint2> getSpawnPoints(Generation gen){
|
||||
if(this.customStartingPoint == null){
|
||||
return Array.with(new GridPoint2(gen.width / 2, gen.height / 2));
|
||||
}else{
|
||||
return Array.with(this.customStartingPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
@@ -9,16 +8,31 @@ import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.game.Waves;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.mindustry.maps.generation.Generation;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.waveTeam;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class WaveMission extends Mission{
|
||||
public class WaveMission extends MissionWithStartingCore{
|
||||
private final int target;
|
||||
|
||||
/**
|
||||
* Creates a wave survival mission with the player core being in the center of the map.
|
||||
* @param target The number of waves to be survived.
|
||||
*/
|
||||
public WaveMission(int target){
|
||||
super();
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a wave survival with the player core being at a custom location.
|
||||
* @param target The number of waves to be survived.
|
||||
* @param xCorePos The X coordinate of the custom core position.
|
||||
* @param yCorePos The Y coordinate of the custom core position.
|
||||
*/
|
||||
public WaveMission(int target, int xCorePos, int yCorePos){
|
||||
super(xCorePos, yCorePos);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@@ -29,8 +43,7 @@ public class WaveMission extends Mission{
|
||||
|
||||
@Override
|
||||
public void generate(Generation gen){
|
||||
int coreX = gen.width/2, coreY = gen.height/2;
|
||||
generateCoreAt(gen, coreX, coreY, Team.blue);
|
||||
generateCoreAtFirstSpawnPoint(gen, Team.blue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +62,7 @@ public class WaveMission extends Mission{
|
||||
public String displayString(){
|
||||
return state.wave > target ?
|
||||
Bundles.format(
|
||||
Vars.unitGroups[Vars.waveTeam.ordinal()].size() > 1 ?
|
||||
Vars.unitGroups[Vars.waveTeam.ordinal()].size() > 1 && !Net.client() ?
|
||||
"text.mission.wave.enemies" :
|
||||
"text.mission.wave.enemy", target, target, Vars.unitGroups[Vars.waveTeam.ordinal()].size()) :
|
||||
Bundles.format("text.mission.wave", state.wave, target, (int)(state.wavetime/60));
|
||||
@@ -71,9 +84,4 @@ public class WaveMission extends Mission{
|
||||
public boolean isComplete(){
|
||||
return state.wave > target && Vars.unitGroups[Vars.waveTeam.ordinal()].size() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Array<GridPoint2> getSpawnPoints(Generation gen){
|
||||
return Array.with(new GridPoint2(gen.width/2, gen.height/2));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user