diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 1a69e95855..a5862bca14 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -579,6 +579,7 @@ objective.coreitem = [accent]Move into Core:\n[][lightgray]{0}[]/{1}\n{2}[lightg objective.build = [accent]Build: [][lightgray]{0}[]x\n{1}[lightgray]{2} objective.buildunit = [accent]Build Unit: [][lightgray]{0}[]x\n{1}[lightgray]{2} objective.destroyunits = [accent]Destroy: [][lightgray]{0}[]x Units +objective.enemiesapproaching = [accent]Enemies approaching in [lightgray]{0}[] objective.destroycore = [accent]Destroy Enemy Core objective.command = [accent]Command Units diff --git a/core/src/mindustry/game/MapObjectives.java b/core/src/mindustry/game/MapObjectives.java index 0daf564b2c..a20c870ef4 100644 --- a/core/src/mindustry/game/MapObjectives.java +++ b/core/src/mindustry/game/MapObjectives.java @@ -17,7 +17,8 @@ import static mindustry.Vars.*; public class MapObjectives{ public static Prov[] allObjectiveTypes = new Prov[]{ ResearchObjective::new, BuildCountObjective::new, UnitCountObjective::new, ItemObjective::new, - CommandModeObjective::new, CoreItemObjective::new, DestroyCoreObjective::new, DestroyUnitsObjective::new + CommandModeObjective::new, CoreItemObjective::new, DestroyCoreObjective::new, DestroyUnitsObjective::new, + TimerObjective::new }; public static Prov[] allMarkerTypes = new Prov[]{ @@ -164,6 +165,48 @@ public class MapObjectives{ } } + public static class TimerObjective extends MapObjective{ + public String text; + public float countup; + public float duration = 60f * 30f; + + public TimerObjective(float duration){ + this.duration = duration; + } + + public TimerObjective(){ + } + + @Override + public boolean complete(){ + return countup >= duration; + } + + @Override + public void update(){ + countup += Time.delta; + } + + @Override + public void reset(){ + countup = 0f; + } + + @Nullable + @Override + public String text(){ + if(text != null){ + int time = (int)((duration - countup) / 60f); + if(text.startsWith("@")){ + return Core.bundle.format(text.substring(1), time); + }else{ + return Core.bundle.formatString(text, time); + } + } + return text; + } + } + /** Command any unit to do anything. Always compete in headless mode. */ public static class CommandModeObjective extends MapObjective{ diff --git a/gradle.properties b/gradle.properties index 8921ff667d..ca51e02948 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=f21eb00d2e +archash=705de3b8ee