Sector tint / Sector preset system

This commit is contained in:
Anuken
2018-10-04 20:59:58 -04:00
parent 244eb91dfb
commit a771dc8787
3 changed files with 23 additions and 7 deletions

View File

@@ -32,7 +32,20 @@ public class Sectors{
private static final int sectorImageSize = 32;
private static final boolean checkExpansion = false;
private GridMap<Sector> grid = new GridMap<>();
private final GridMap<Sector> grid = new GridMap<>();
private final GridMap<Array<Mission>> presets = new GridMap<Array<Mission>>(){{
put(0, 0, TutorialSector.getMissions());
//water mission
put(-2, 0, Array.with());
//command center mission
put(0, 1, Array.with());
//reconstructor mission
put(0, -1, Array.with());
//oil mission
put(1, 0, Array.with());
}};
public void playSector(Sector sector){
if(sector.hasSave() && SaveIO.breakingVersions.contains(sector.getSave().getBuild())){
@@ -292,10 +305,10 @@ public class Sectors{
private void initSector(Sector sector){
sector.difficulty = (int)(Mathf.dst(sector.x, sector.y));
if(sector.difficulty == 0){
sector.missions.addAll(TutorialSector.getMissions());
if(presets.containsKey(sector.x, sector.y)){
sector.missions.addAll(presets.get(sector.x, sector.y));
}else{
sector.missions.add(new WaveMission(Math.min(sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 3)*5, 100)));
genMissions(sector);
}
sector.spawns = new Array<>();
@@ -320,6 +333,10 @@ public class Sectors{
}
}
private void genMissions(Sector sector){
sector.missions.add(new WaveMission(sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 3)*5));
}
private void createTexture(Sector sector){
if(headless) return; //obviously not created or needed on server

View File

@@ -9,8 +9,7 @@ import io.anuke.ucore.util.Bundles;
import static io.anuke.mindustry.Vars.defaultTeam;
import static io.anuke.mindustry.Vars.world;
/**A mission in which the player must place a block.*/
@Deprecated
/**A mission in which the player must place a block somewhere.*/
public class BlockMission extends Mission{
private final Block block;
private boolean complete;

View File

@@ -146,7 +146,7 @@ public class SectorsDialog extends FloatingDialog{
drawY += (height-1)/2f*padSectorSize;
if(sector != null && sector.texture != null){
Draw.color(Color.WHITE);
Draw.colorl(!sector.complete ? 0.3f : 1f);
Draw.rect(sector.texture, drawX, drawY, sectorSize * width + paddingx, sectorSize * height + paddingy);
}