Fixed drones being idiots / Added another PvP map
This commit is contained in:
@@ -74,6 +74,10 @@ public class Map implements Comparable<Map>{
|
||||
return tags.get("othercore", "true").equals("true");
|
||||
}
|
||||
|
||||
public boolean attribute(MapAttribute attr){
|
||||
return tags.getBool(attr.name());
|
||||
}
|
||||
|
||||
public String author(){
|
||||
return tag("author");
|
||||
}
|
||||
|
||||
29
core/src/io/anuke/mindustry/maps/MapAttribute.java
Normal file
29
core/src/io/anuke/mindustry/maps/MapAttribute.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package io.anuke.mindustry.maps;
|
||||
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.function.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
/** Defines a specific type of attribute for a map, usually whether or not it supports a certain type of mode.*/
|
||||
public enum MapAttribute{
|
||||
/** Whether a map has a player spawnpoint in it.*/
|
||||
spawnpoint(teams -> teams.contains(defaultTeam.ordinal())),
|
||||
/** Whether a map has a wave team core to attack.*/
|
||||
attack(teams -> teams.contains(waveTeam.ordinal())),
|
||||
/** Whether this map supports PvP.*/
|
||||
pvp(teams -> teams.size > 1);
|
||||
|
||||
private final Predicate<IntSet> validator;
|
||||
|
||||
public static final MapAttribute[] all = values();
|
||||
|
||||
MapAttribute(Predicate<IntSet> set){
|
||||
this.validator = set;
|
||||
}
|
||||
|
||||
//todo also take into account enemy spawnpoints
|
||||
public boolean validate(IntSet teams){
|
||||
return validator.test(teams);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Maps implements Disposable{
|
||||
/** List of all built-in maps. Filenames only. */
|
||||
private static String[] defaultMapNames = {"fortress", "labyrinth", "islands", "tendrils", "caldera", "glacier"};
|
||||
private static String[] defaultMapNames = {"fortress", "labyrinth", "islands", "tendrils", "caldera", "glacier", "vein"};
|
||||
/** All maps stored in an ordered array. */
|
||||
private Array<Map> maps = new Array<>();
|
||||
/** Serializer for meta. */
|
||||
|
||||
Reference in New Issue
Block a user