Place objective
This commit is contained in:
@@ -519,7 +519,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pause(){
|
public void pause(){
|
||||||
if(settings.getBool("backgroundpause", true)){
|
if(settings.getBool("backgroundpause", true) && !net.active()){
|
||||||
wasPaused = state.is(State.paused);
|
wasPaused = state.is(State.paused);
|
||||||
if(state.is(State.playing)) state.set(State.paused);
|
if(state.is(State.playing)) state.set(State.paused);
|
||||||
}
|
}
|
||||||
@@ -527,7 +527,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resume(){
|
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);
|
state.set(State.playing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ public class Logic implements ApplicationListener{
|
|||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.team == state.rules.defaultTeam){
|
||||||
|
state.stats.placedBlockCount.increment(event.tile.block());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package mindustry.game;
|
package mindustry.game;
|
||||||
|
|
||||||
|
import arc.struct.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
public class GameStats{
|
public class GameStats{
|
||||||
/** Enemy (red team) units destroyed. */
|
/** Enemy (red team) units destroyed. */
|
||||||
public int enemyUnitsDestroyed;
|
public int enemyUnitsDestroyed;
|
||||||
@@ -13,4 +16,6 @@ public class GameStats{
|
|||||||
public int buildingsDestroyed;
|
public int buildingsDestroyed;
|
||||||
/** Total units created by any means. */
|
/** Total units created by any means. */
|
||||||
public int unitsCreated;
|
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.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
public class MapObjectives{
|
public class MapObjectives{
|
||||||
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
||||||
ResearchObjective::new
|
ResearchObjective::new, PlaceCountObjective::new, ItemObjective::new
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Prov<ObjectiveMarker>[] allMarkerTypes = new Prov[]{
|
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 static abstract class MapObjective{
|
||||||
public ObjectiveMarker[] markers = {};
|
public ObjectiveMarker[] markers = {};
|
||||||
|
|
||||||
|
|||||||
@@ -46,24 +46,24 @@ public class MenuRenderer implements Disposable{
|
|||||||
shadows = new FrameBuffer(width, height);
|
shadows = new FrameBuffer(width, height);
|
||||||
int offset = Mathf.random(100000);
|
int offset = Mathf.random(100000);
|
||||||
int s1 = offset, s2 = offset + 1, s3 = offset + 2;
|
int s1 = offset, s2 = offset + 1, s3 = offset + 2;
|
||||||
Block[] selected = Structs.select(
|
Block[] selected = Structs.random(
|
||||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||||
new Block[]{Blocks.moss, Blocks.sporePine},
|
new Block[]{Blocks.moss, Blocks.sporePine},
|
||||||
new Block[]{Blocks.dirt, Blocks.dirtWall},
|
new Block[]{Blocks.dirt, Blocks.dirtWall},
|
||||||
new Block[]{Blocks.dacite, Blocks.daciteWall}
|
new Block[]{Blocks.dacite, Blocks.daciteWall}
|
||||||
);
|
);
|
||||||
Block[] selected2 = Structs.select(
|
Block[] selected2 = Structs.random(
|
||||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||||
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.stone, Blocks.stoneWall},
|
new Block[]{Blocks.stone, Blocks.stoneWall},
|
||||||
new Block[]{Blocks.moss, Blocks.sporeWall},
|
new Block[]{Blocks.moss, Blocks.sporeWall},
|
||||||
new Block[]{Blocks.salt, Blocks.saltWall}
|
new Block[]{Blocks.salt, Blocks.saltWall}
|
||||||
);
|
);
|
||||||
|
|
||||||
Block ore1 = ores.random();
|
Block ore1 = ores.random();
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=2eb7608c5d
|
archash=2fd232cbb5
|
||||||
|
|||||||
Reference in New Issue
Block a user