Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/mod/ClassMap.java
This commit is contained in:
Anuken
2021-07-04 09:52:57 -04:00
34 changed files with 168 additions and 135 deletions

View File

@@ -114,22 +114,6 @@ public class Rules{
/** special tags for additional info. */
public StringMap tags = new StringMap();
/** A team-specific ruleset. */
public static class TeamRule{
/** Whether to use building AI. */
public boolean ai;
/** TODO Tier of blocks/designs that the AI uses for building. [0, 1] */
public float aiTier = 1f;
/** Whether, when AI is enabled, ships should be spawned from the core. */
public boolean aiCoreSpawn = true;
/** If true, blocks don't require power or resources. */
public boolean cheat;
/** If true, resources are not consumed when building. */
public boolean infiniteResources;
/** If true, this team has infinite unit ammo. */
public boolean infiniteAmmo;
}
/** Copies this ruleset exactly. Not efficient at all, do not use often. */
public Rules copy(){
return JsonIO.copy(this);
@@ -150,6 +134,22 @@ public class Rules{
}
}
/** A team-specific ruleset. */
public static class TeamRule{
/** Whether to use building AI. */
public boolean ai;
/** TODO Tier of blocks/designs that the AI uses for building. [0, 1] */
public float aiTier = 1f;
/** Whether, when AI is enabled, ships should be spawned from the core. */
public boolean aiCoreSpawn = true;
/** If true, blocks don't require power or resources. */
public boolean cheat;
/** If true, resources are not consumed when building. */
public boolean infiniteResources;
/** If true, this team has infinite unit ammo. */
public boolean infiniteAmmo;
}
/** A simple map for storing TeamRules in an efficient way without hashing. */
public static class TeamRules implements JsonSerializable{
final TeamRule[] values = new TeamRule[Team.all.length];

View File

@@ -97,7 +97,7 @@ public class Team implements Comparable<Team>{
}
public boolean isEnemy(Team other){
return state.teams.areEnemies(this, other);
return this != other;
}
public Seq<CoreBuild> cores(){

View File

@@ -49,7 +49,7 @@ public class Teams{
public boolean eachEnemyCore(Team team, Boolf<CoreBuild> ret){
for(TeamData data : active){
if(areEnemies(team, data.team)){
if(team != data.team){
for(CoreBuild tile : data.cores){
if(ret.get(tile)){
return true;
@@ -62,7 +62,7 @@ public class Teams{
public void eachEnemyCore(Team team, Cons<Building> ret){
for(TeamData data : active){
if(areEnemies(team, data.team)){
if(team != data.team){
for(Building tile : data.cores){
ret.get(tile);
}
@@ -91,11 +91,6 @@ public class Teams{
return get(team).active();
}
/** Returns whether {@param other} is an enemy of {@param #team}. */
public boolean areEnemies(Team team, Team other){
return team != other;
}
public boolean canInteract(Team team, Team other){
return team == other || other == Team.derelict;
}
@@ -216,7 +211,7 @@ public class Teams{
Seq<Team> enemies = new Seq<>();
for(TeamData other : active){
if(areEnemies(data.team, other.team)){
if(data.team != other.team){
enemies.add(other.team);
}
}