Fixed drones being idiots / Added another PvP map

This commit is contained in:
Anuken
2019-07-24 21:25:33 -04:00
parent 859591cea5
commit c9bd253960
8 changed files with 78 additions and 50 deletions

View File

@@ -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");
}

View 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);
}
}

View File

@@ -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. */