Place objective

This commit is contained in:
Anuken
2022-04-13 12:56:57 -04:00
parent d5c4f862e7
commit da4c54b734
6 changed files with 54 additions and 21 deletions

View File

@@ -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 = {};