per-team toggles for core no-build radius / placement range check (#11448)
* per-team toggles for core no-build radius / placement range check * oops * fair enough
This commit is contained in:
@@ -248,7 +248,7 @@ public class Rules{
|
||||
}
|
||||
|
||||
public float buildRadius(Team team){
|
||||
return enemyCoreBuildRadius + teams.get(team).extraCoreBuildRadius;
|
||||
return !teams.get(team).protectCores ? 0f : enemyCoreBuildRadius + teams.get(team).extraCoreBuildRadius;
|
||||
}
|
||||
|
||||
public float unitBuildSpeed(Team team){
|
||||
@@ -299,6 +299,10 @@ public class Rules{
|
||||
public static class TeamRule{
|
||||
/** Whether, when AI is enabled, ships should be spawned from the core. TODO remove / unnecessary? */
|
||||
public boolean aiCoreSpawn = true;
|
||||
/** Whether the core no-build radius/polygonal protection applies to this team, unprotected teams are ignored by team assigner */
|
||||
public boolean protectCores = true;
|
||||
/** Whether the placeRangeCheck applies to this team */
|
||||
public boolean checkPlacement = true;
|
||||
/** If true, blocks don't require power or resources. */
|
||||
public boolean cheat;
|
||||
/** If true, the core is always filled to capacity with all items. */
|
||||
@@ -345,8 +349,18 @@ public class Rules{
|
||||
/** Extra spacing added to the no-build zone around the core. */
|
||||
public float extraCoreBuildRadius = 0f;
|
||||
|
||||
|
||||
//build cost disabled due to technical complexity
|
||||
|
||||
//for reading from json
|
||||
public TeamRule(){
|
||||
}
|
||||
|
||||
public TeamRule(Team team){
|
||||
if(team == Team.derelict){
|
||||
protectCores = false;
|
||||
checkPlacement = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A simple map for storing TeamRules in an efficient way without hashing. */
|
||||
@@ -355,7 +369,7 @@ public class Rules{
|
||||
|
||||
public TeamRule get(Team team){
|
||||
TeamRule out = values[team.id];
|
||||
return out == null ? (values[team.id] = new TeamRule()) : out;
|
||||
return out == null ? (values[team.id] = new TeamRule(team)) : out;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Teams{
|
||||
|
||||
public boolean anyEnemyCoresWithinBuildRadius(Team team, float x, float y){
|
||||
for(TeamData data : active){
|
||||
if(team != data.team){
|
||||
if(team != data.team && data.team.rules().protectCores){
|
||||
for(CoreBuild tile : data.cores){
|
||||
if(tile.within(x, y, state.rules.buildRadius(tile.team) + tilesize)){
|
||||
return true;
|
||||
@@ -71,7 +71,7 @@ public class Teams{
|
||||
|
||||
public boolean anyEnemyCoresWithin(Team team, float x, float y, float radius){
|
||||
for(TeamData data : active){
|
||||
if(team != data.team){
|
||||
if(team != data.team && data.team.rules().protectCores){
|
||||
for(CoreBuild tile : data.cores){
|
||||
if(tile.within(x, y, radius)){
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user