Place objective
This commit is contained in:
@@ -519,7 +519,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
|
||||
@Override
|
||||
public void pause(){
|
||||
if(settings.getBool("backgroundpause", true)){
|
||||
if(settings.getBool("backgroundpause", true) && !net.active()){
|
||||
wasPaused = state.is(State.paused);
|
||||
if(state.is(State.playing)) state.set(State.paused);
|
||||
}
|
||||
@@ -527,7 +527,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
|
||||
@Override
|
||||
public void resume(){
|
||||
if(state.is(State.paused) && !wasPaused && settings.getBool("backgroundpause", true)){
|
||||
if(state.is(State.paused) && !wasPaused && settings.getBool("backgroundpause", true) && !net.active()){
|
||||
state.set(State.playing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,10 @@ public class Logic implements ApplicationListener{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if(event.team == state.rules.defaultTeam){
|
||||
state.stats.placedBlockCount.increment(event.tile.block());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package mindustry.game;
|
||||
|
||||
import arc.struct.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class GameStats{
|
||||
/** Enemy (red team) units destroyed. */
|
||||
public int enemyUnitsDestroyed;
|
||||
@@ -13,4 +16,6 @@ public class GameStats{
|
||||
public int buildingsDestroyed;
|
||||
/** Total units created by any means. */
|
||||
public int unitsCreated;
|
||||
/** Record of blocks that have been placed by count. Used for objectives only. */
|
||||
public ObjectIntMap<Block> placedBlockCount = new ObjectIntMap<>();
|
||||
}
|
||||
|
||||
@@ -11,10 +11,11 @@ import mindustry.ctype.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class MapObjectives{
|
||||
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
||||
ResearchObjective::new
|
||||
ResearchObjective::new, PlaceCountObjective::new, ItemObjective::new
|
||||
};
|
||||
|
||||
public static Prov<ObjectiveMarker>[] allMarkerTypes = new Prov[]{
|
||||
@@ -70,6 +71,29 @@ public class MapObjectives{
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlaceCountObjective extends MapObjective{
|
||||
public Block block = Blocks.conveyor;
|
||||
public int placeCount = 1;
|
||||
|
||||
public PlaceCountObjective(Block block, int placeCount){
|
||||
this.block = block;
|
||||
this.placeCount = placeCount;
|
||||
}
|
||||
|
||||
public PlaceCountObjective(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public String text(){
|
||||
return Core.bundle.format("objective.place", placeCount, block.emoji(), block.localizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean complete(){
|
||||
return Vars.state.stats.placedBlockCount.get(block, 0) >= placeCount;
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class MapObjective{
|
||||
public ObjectiveMarker[] markers = {};
|
||||
|
||||
|
||||
@@ -46,24 +46,24 @@ public class MenuRenderer implements Disposable{
|
||||
shadows = new FrameBuffer(width, height);
|
||||
int offset = Mathf.random(100000);
|
||||
int s1 = offset, s2 = offset + 1, s3 = offset + 2;
|
||||
Block[] selected = Structs.select(
|
||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||
new Block[]{Blocks.moss, Blocks.sporePine},
|
||||
new Block[]{Blocks.dirt, Blocks.dirtWall},
|
||||
new Block[]{Blocks.dacite, Blocks.daciteWall}
|
||||
Block[] selected = Structs.random(
|
||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||
new Block[]{Blocks.moss, Blocks.sporePine},
|
||||
new Block[]{Blocks.dirt, Blocks.dirtWall},
|
||||
new Block[]{Blocks.dacite, Blocks.daciteWall}
|
||||
);
|
||||
Block[] selected2 = Structs.select(
|
||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||
new Block[]{Blocks.moss, Blocks.sporeWall},
|
||||
new Block[]{Blocks.salt, Blocks.saltWall}
|
||||
Block[] selected2 = Structs.random(
|
||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||
new Block[]{Blocks.moss, Blocks.sporeWall},
|
||||
new Block[]{Blocks.salt, Blocks.saltWall}
|
||||
);
|
||||
|
||||
Block ore1 = ores.random();
|
||||
|
||||
Reference in New Issue
Block a user