Fixed compile errors / Refactored sector presets

This commit is contained in:
Anuken 2018-10-05 22:16:40 -04:00
parent 35bc2c9803
commit ed0df64cf9
65 changed files with 386 additions and 354 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 220 B

View File

@ -74,7 +74,7 @@ text.mission.unit=Create {0} Unit
text.mission.command=Send Command {0} To Units
text.mission.linknode=Link Power Node
text.mission.display=[accent]Mission:\n[LIGHT_GRAY]{0}
text.mission.mech=Switch to mech
text.mission.mech=Switch to mech[accent] {0}[]
text.none=<none>
text.close=Close
@ -327,7 +327,7 @@ text.blocks.explosive=Highly explosive!
text.blocks.health=Health
text.blocks.inaccuracy=Inaccuracy
text.blocks.shots=Shots
text.blocks.reload=Reload
text.blocks.reload=Shots/Second
text.blocks.inputfuel=Fuel
text.blocks.fuelburntime=Fuel Burn Time
text.blocks.inputcapacity=Input capacity

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -232,7 +232,6 @@ public class World extends Module{
/**Loads up a sector map. This does not call play(), but calls reset().*/
public void loadSector(Sector sector){
currentSector = sector;
state.mode = sector.mode;
state.difficulty = sectors.getDifficulty(sector);
Timers.mark();
Timers.mark();

View File

@ -0,0 +1,55 @@
package io.anuke.mindustry.maps;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.content.blocks.UnitBlocks;
import io.anuke.mindustry.content.blocks.UpgradeBlocks;
import io.anuke.mindustry.entities.units.UnitCommand;
import io.anuke.mindustry.maps.missions.*;
import io.anuke.mindustry.type.Item;
import io.anuke.ucore.util.GridMap;
import io.anuke.ucore.util.Structs;
import static io.anuke.mindustry.Vars.mobile;
public class SectorPresets{
private final GridMap<SectorPreset> presets = new GridMap<SectorPreset>(){{
//base tutorial mission
put(0, 0, new SectorPreset(TutorialSector.getMissions(), Array.with(Items.copper), 1));
//water mission
put(-2, 0, new SectorPreset(Array.with(), Array.with(Items.copper), 1));
//command center mission
//TODO generate enemy base
//TODO make 2x2
//TODO more gen info
put(0, 1, new SectorPreset(Structs.array(new BlockMission(UnitBlocks.daggerFactory), Missions.blockRecipe(UnitBlocks.commandCenter),
new CommandMission(UnitCommand.retreat), new CommandMission(UnitCommand.attack), new BattleMission()), Array.with(Items.copper), 1));
//reconstructor mission
put(0, -1, new SectorPreset(Structs.array(Missions.blockRecipe(mobile ? UpgradeBlocks.tridentPad : UpgradeBlocks.deltaPad),
new MechMission(Mechs.delta)), Array.with(Items.copper), 1));
//oil mission
put(1, 0, new SectorPreset(Array.with(), Array.with(Items.copper), 1));
}};
public SectorPreset get(int x, int y){
return presets.get(x, y);
}
public static class SectorPreset{
public final Array<Mission> missions;
public final Array<Item> ores;
public final int size;
public SectorPreset(Array<Mission> missions, Array<Item> ores, int size){
this.missions = missions;
this.ores = ores;
this.size = size;
}
void generate(Sector sector){
}
}
}

View File

@ -5,17 +5,15 @@ import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.content.blocks.UnitBlocks;
import io.anuke.mindustry.content.blocks.UpgradeBlocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.UnitCommand;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.maps.SectorPresets.SectorPreset;
import io.anuke.mindustry.maps.generation.WorldGenerator.GenResult;
import io.anuke.mindustry.maps.missions.*;
import io.anuke.mindustry.maps.missions.Mission;
import io.anuke.mindustry.maps.missions.WaveMission;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.ColorMapper;
@ -24,7 +22,10 @@ import io.anuke.ucore.core.Settings;
import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.trait.Entity;
import io.anuke.ucore.util.*;
import io.anuke.ucore.util.Bits;
import io.anuke.ucore.util.GridMap;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.*;
@ -33,24 +34,7 @@ public class Sectors{
private static final boolean checkExpansion = false;
private final GridMap<Sector> grid = new GridMap<>();
private final GridMap<SectorPreset> presets = new GridMap<SectorPreset>(){{
put(0, 0, new SectorPreset(TutorialSector.getMissions(), Array.with(Items.copper), 1));
//water mission
put(-2, 0, new SectorPreset(Array.with(), Array.with(Items.copper), 1));
//command center mission
//TODO generate enemy base
//TODO make 2x2
//TODO more gen info
put(0, 1, new SectorPreset(Structs.array(new BlockMission(UnitBlocks.daggerFactory), Missions.blockRecipe(UnitBlocks.commandCenter),
new CommandMission(UnitCommand.retreat), new CommandMission(UnitCommand.attack), new BattleMission()), Array.with(Items.copper), 1));
//reconstructor mission
put(0, -1, new SectorPreset(Structs.array(Missions.blockRecipe(mobile ? UpgradeBlocks.tridentPad : UpgradeBlocks.deltaPad),
new MechMission(Mechs.delta)), Array.with(Items.copper), 1));
//oil mission
put(1, 0, new SectorPreset(Array.with(), Array.with(Items.copper), 1));
}};
private final SectorPresets presets = new SectorPresets();
public void playSector(Sector sector){
if(sector.hasSave() && SaveIO.breakingVersions.contains(sector.getSave().getBuild())){
@ -310,7 +294,7 @@ public class Sectors{
private void initSector(Sector sector){
sector.difficulty = (int)(Mathf.dst(sector.x, sector.y));
if(presets.containsKey(sector.x, sector.y)){
if(presets.get(sector.x, sector.y) != null){
SectorPreset p = presets.get(sector.x, sector.y);
sector.missions.addAll(p.missions);
}else{
@ -370,19 +354,5 @@ public class Sectors{
pixmap.dispose();
}
private class SectorPreset{
private final Array<Mission> missions;
private final Array<Item> ores;
private final int size;
public SectorPreset(Array<Mission> missions, Array<Item> ores, int size){
this.missions = missions;
this.ores = ores;
this.size = size;
}
void generate(Sector sector){
}
}
}

View File

@ -1,5 +1,7 @@
package io.anuke.mindustry.maps.missions;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.type.Mech;
import io.anuke.ucore.util.Bundles;
@ -12,11 +14,16 @@ public class MechMission extends Mission{
@Override
public boolean isComplete(){
for(Player player : Vars.playerGroup.all()){
if(player.mech == mech){
return true;
}
}
return false;
}
@Override
public String displayString(){
return Bundles.format("te");
return Bundles.format("text.mission.mech", mech.localizedName());
}
}

View File

@ -12,8 +12,7 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
import static io.anuke.mindustry.Vars.headless;
import static io.anuke.mindustry.Vars.ui;
import static io.anuke.mindustry.Vars.*;
public abstract class Mission{
private String extraMessage;
@ -90,7 +89,9 @@ public abstract class Mission{
return Array.with();
}
public void generate(Generation gen){}
public void generate(Generation gen){
generateCoreAt(gen, gen.width/2, gen.height/2, defaultTeam);
}
public void generateCoreAt(Generation gen, int coreX, int coreY, Team team){
gen.tiles[coreX][coreY].setBlock(StorageBlocks.core);