mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-10 10:47:13 +07:00
Build fix / Improved map contour
This commit is contained in:
parent
d5bb1b72b9
commit
b6c0fe8bf7
@ -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);
|
||||
|
@ -40,7 +40,6 @@ public class ServerControl extends Module{
|
||||
private static final int roundExtraTime = 12;
|
||||
|
||||
private final CommandHandler handler = new CommandHandler("");
|
||||
private ShuffleMode mode;
|
||||
private int gameOvers;
|
||||
private boolean inExtraRound;
|
||||
private Team winnerTeam;
|
||||
@ -53,12 +52,11 @@ public class ServerControl extends Module{
|
||||
"admins", "",
|
||||
"sector_x", 0,
|
||||
"sector_y", 1,
|
||||
"shuffle", true,
|
||||
"crashreport", false,
|
||||
"port", port
|
||||
);
|
||||
|
||||
mode = ShuffleMode.valueOf(Settings.getString("shufflemode"));
|
||||
|
||||
Timers.setDeltaProvider(() -> Gdx.graphics.getDeltaTime() * 60f);
|
||||
Effects.setScreenShakeProvider((a, b) -> {});
|
||||
Effects.setEffectProvider((a, b, c, d, e, f) -> {});
|
||||
@ -97,11 +95,10 @@ public class ServerControl extends Module{
|
||||
if(inExtraRound) return;
|
||||
info("Game over!");
|
||||
|
||||
if(mode != ShuffleMode.off){
|
||||
if(Settings.getBool("shuffle")){
|
||||
if(world.getSector() == null){
|
||||
if(world.maps().all().size > 0){
|
||||
Array<Map> maps = mode == ShuffleMode.both ? world.maps().all() :
|
||||
mode == ShuffleMode.normal ? world.maps().defaultMaps() : world.maps().customMaps();
|
||||
Array<Map> maps = world.maps().all();
|
||||
|
||||
Map previous = world.getMap();
|
||||
Map map = previous;
|
||||
@ -358,16 +355,14 @@ public class ServerControl extends Module{
|
||||
}
|
||||
});
|
||||
|
||||
handler.register("shuffle", "<normal/custom/both/off>", "Set map shuffling.", arg -> {
|
||||
|
||||
try{
|
||||
mode = ShuffleMode.valueOf(arg[0]);
|
||||
Settings.putString("shufflemode", arg[0]);
|
||||
Settings.save();
|
||||
info("Shuffle mode set to '{0}'.", arg[0]);
|
||||
}catch(Exception e){
|
||||
err("Unknown shuffle mode '{0}'.", arg[0]);
|
||||
handler.register("shuffle", "<on/off>", "Set map shuffling.", arg -> {
|
||||
if(!arg[0].equals("on") && !arg[0].equals("off")){
|
||||
err("Invalid shuffle mode.");
|
||||
return;
|
||||
}
|
||||
Settings.putBool("shuffle", arg[0].equals("on"));
|
||||
Settings.save();
|
||||
info("Shuffle mode set to '{0}'.", arg[0]);
|
||||
});
|
||||
|
||||
handler.register("kick", "<username...>", "Kick a person by name.", arg -> {
|
||||
@ -898,6 +893,8 @@ public class ServerControl extends Module{
|
||||
checkPvPGameOver();
|
||||
}
|
||||
|
||||
//TODO re implement sector shuffle
|
||||
/*
|
||||
if(state.is(State.playing) && world.getSector() != null && !inExtraRound && netServer.admins.getStrict()){
|
||||
//all assigned missions are complete
|
||||
if(world.getSector().completedMissions >= world.getSector().missions.size){
|
||||
@ -917,10 +914,6 @@ public class ServerControl extends Module{
|
||||
//increment completed missions, check next index next frame
|
||||
world.getSector().completedMissions ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum ShuffleMode{
|
||||
normal, custom, both, off
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user