mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 15:27:19 +07:00
Timer objective
This commit is contained in:
@ -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.build = [accent]Build: [][lightgray]{0}[]x\n{1}[lightgray]{2}
|
||||||
objective.buildunit = [accent]Build Unit: [][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.destroyunits = [accent]Destroy: [][lightgray]{0}[]x Units
|
||||||
|
objective.enemiesapproaching = [accent]Enemies approaching in [lightgray]{0}[]
|
||||||
objective.destroycore = [accent]Destroy Enemy Core
|
objective.destroycore = [accent]Destroy Enemy Core
|
||||||
objective.command = [accent]Command Units
|
objective.command = [accent]Command Units
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ import static mindustry.Vars.*;
|
|||||||
public class MapObjectives{
|
public class MapObjectives{
|
||||||
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
public static Prov<MapObjective>[] allObjectiveTypes = new Prov[]{
|
||||||
ResearchObjective::new, BuildCountObjective::new, UnitCountObjective::new, ItemObjective::new,
|
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<ObjectiveMarker>[] allMarkerTypes = new Prov[]{
|
public static Prov<ObjectiveMarker>[] 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. */
|
/** Command any unit to do anything. Always compete in headless mode. */
|
||||||
public static class CommandModeObjective extends MapObjective{
|
public static class CommandModeObjective extends MapObjective{
|
||||||
|
|
||||||
|
@ -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=f21eb00d2e
|
archash=705de3b8ee
|
||||||
|
Reference in New Issue
Block a user