Build fix / Improved map contour
This commit is contained in:
@@ -13,7 +13,6 @@ import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.game.Content;
|
||||
import io.anuke.mindustry.game.ContentDatabase;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Saves;
|
||||
import io.anuke.mindustry.input.DefaultKeybinds;
|
||||
import io.anuke.mindustry.input.DesktopInput;
|
||||
@@ -341,32 +340,6 @@ public class Control extends Module{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSectors(){
|
||||
if(world.getSector() == null) return;
|
||||
|
||||
world.getSector().currentMission().update();
|
||||
|
||||
//TODO move sector code into logic class
|
||||
//check unlocked sectors
|
||||
while(!world.getSector().complete && world.getSector().currentMission().isComplete()){
|
||||
world.getSector().currentMission().onComplete();
|
||||
world.getSector().completedMissions ++;
|
||||
|
||||
state.mode = world.getSector().currentMission().getMode();
|
||||
world.getSector().currentMission().onBegin();
|
||||
world.sectors().save();
|
||||
}
|
||||
|
||||
//check if all assigned missions are complete
|
||||
if(!world.getSector().complete && world.getSector().completedMissions >= world.getSector().missions.size){
|
||||
state.mode = GameMode.victory;
|
||||
|
||||
world.sectors().completeSector(world.getSector().x, world.getSector().y);
|
||||
world.sectors().save();
|
||||
ui.missions.show(world.getSector());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
|
||||
@@ -392,8 +365,6 @@ public class Control extends Module{
|
||||
Platform.instance.updateRPC();
|
||||
}
|
||||
|
||||
updateSectors();
|
||||
|
||||
//check unlocks every 2 seconds
|
||||
if(world.getSector() != null && Timers.get("timerCheckUnlock", 120)){
|
||||
checkUnlockableBlocks();
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||
import io.anuke.mindustry.game.EventType.PlayEvent;
|
||||
import io.anuke.mindustry.game.EventType.ResetEvent;
|
||||
import io.anuke.mindustry.game.EventType.WaveEvent;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Teams;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
@@ -87,6 +88,33 @@ public class Logic extends Module{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSectors(){
|
||||
if(world.getSector() == null) return;
|
||||
|
||||
world.getSector().currentMission().update();
|
||||
|
||||
//check unlocked sectors
|
||||
while(!world.getSector().complete && world.getSector().currentMission().isComplete()){
|
||||
world.getSector().currentMission().onComplete();
|
||||
world.getSector().completedMissions ++;
|
||||
|
||||
state.mode = world.getSector().currentMission().getMode();
|
||||
world.getSector().currentMission().onBegin();
|
||||
world.sectors().save();
|
||||
}
|
||||
|
||||
//check if all assigned missions are complete
|
||||
if(!world.getSector().complete && world.getSector().completedMissions >= world.getSector().missions.size){
|
||||
state.mode = GameMode.victory;
|
||||
|
||||
world.sectors().completeSector(world.getSector().x, world.getSector().y);
|
||||
world.sectors().save();
|
||||
if(!headless){
|
||||
ui.missions.show(world.getSector());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(threads.isEnabled() && !threads.isOnThread()) return;
|
||||
@@ -103,6 +131,8 @@ public class Logic extends Module{
|
||||
Timers.update();
|
||||
}
|
||||
|
||||
updateSectors();
|
||||
|
||||
if(!Net.client() && !world.isInvalidMap()){
|
||||
checkGameOver();
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class World extends Module{
|
||||
public void loadSector(Sector sector){
|
||||
currentSector = sector;
|
||||
state.mode = sector.missions.peek().getMode();
|
||||
state.difficulty = sector.getDifficulty();
|
||||
state.difficulty = sectors.getDifficulty(sector);
|
||||
Timers.mark();
|
||||
Timers.mark();
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.anuke.mindustry.maps;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.annotations.Annotations.Serialize;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||
import io.anuke.mindustry.game.SpawnGroup;
|
||||
import io.anuke.mindustry.maps.missions.Mission;
|
||||
@@ -38,21 +37,6 @@ public class Sector{
|
||||
/**Items the player starts with on this sector.*/
|
||||
public transient Array<ItemStack> startingItems;
|
||||
|
||||
/**Returns scaled difficulty. This is not just the difficulty ordinal.*/
|
||||
public Difficulty getDifficulty(){
|
||||
if(difficulty == 0){
|
||||
//yes, this means insane tutorial difficulty
|
||||
//(((have fun)))
|
||||
return Difficulty.hard;
|
||||
}else if(difficulty < 4){
|
||||
return Difficulty.normal;
|
||||
}else if(difficulty < 9){
|
||||
return Difficulty.hard;
|
||||
}else{
|
||||
return Difficulty.insane;
|
||||
}
|
||||
}
|
||||
|
||||
public Mission currentMission(){
|
||||
return completedMissions >= missions.size ? victoryMission : missions.get(completedMissions);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.SaveIO;
|
||||
import io.anuke.mindustry.maps.generation.WorldGenerator.GenResult;
|
||||
import io.anuke.mindustry.maps.missions.BattleMission;
|
||||
import io.anuke.mindustry.maps.missions.Mission;
|
||||
import io.anuke.mindustry.maps.missions.WaveMission;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
@@ -189,6 +189,20 @@ public class Sectors{
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}else if(sector.difficulty < 9){
|
||||
return Difficulty.hard;
|
||||
}else{
|
||||
return Difficulty.insane;
|
||||
}
|
||||
}
|
||||
|
||||
public Array<Item> getOres(int x, int y){
|
||||
if(x == 0 && y == 0){
|
||||
return Array.with(Items.copper);
|
||||
@@ -281,8 +295,7 @@ public class Sectors{
|
||||
//TODO make specfic expansion sector have specific ores
|
||||
sector.missions.addAll(TutorialSector.getMissions());
|
||||
}else{
|
||||
sector.missions.add(Mathf.randomSeed(sector.getSeed() + 1) < waveChance ? new WaveMission(Math.min(sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 3)*5, 100))
|
||||
: new BattleMission());
|
||||
sector.missions.add(new WaveMission(Math.min(sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 3)*5, 100)));
|
||||
}
|
||||
|
||||
sector.spawns = new Array<>();
|
||||
@@ -325,7 +338,7 @@ public class Sectors{
|
||||
int toY = y * sectorSize / sectorImageSize;
|
||||
|
||||
GenResult result = world.generator().generateTile(sector.x, sector.y, toX, toY, false);
|
||||
world.generator().generateTile(secResult, sector.x, sector.y, toX, toY + sectorSize / sectorImageSize, false, null, null);
|
||||
world.generator().generateTile(secResult, sector.x, sector.y, toX, ((y+1) * sectorSize / sectorImageSize), false, null, null);
|
||||
|
||||
int color = ColorMapper.colorFor(result.floor, result.wall, Team.none, result.elevation, secResult.elevation > result.elevation ? (byte)(1 << 6) : (byte)0);
|
||||
pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, color);
|
||||
|
||||
Reference in New Issue
Block a user