Configurable min squad size

This commit is contained in:
Anuken
2022-04-22 17:46:47 -04:00
parent 520d80a96b
commit 764b1c27bf
5 changed files with 7 additions and 5 deletions

View File

@@ -1079,6 +1079,7 @@ rules.wavetimer = Wave Timer
rules.waves = Waves rules.waves = Waves
rules.attack = Attack Mode rules.attack = Attack Mode
rules.rtsai = RTS AI rules.rtsai = RTS AI
rules.rtsminsquadsize = Min Squad Size
rules.cleanupdeadteams = Clean Up Defeated Team Buildings (PvP) rules.cleanupdeadteams = Clean Up Defeated Team Buildings (PvP)
rules.corecapture = Capture Core On Destruction rules.corecapture = Capture Core On Destruction
rules.polygoncoreprotection = Polygonal Core Protection rules.polygoncoreprotection = Polygonal Core Protection

View File

@@ -34,8 +34,6 @@ public class RtsAI{
//in order of priority?? //in order of priority??
static final BlockFlag[] flags = {BlockFlag.generator, BlockFlag.factory, BlockFlag.core, BlockFlag.battery}; static final BlockFlag[] flags = {BlockFlag.generator, BlockFlag.factory, BlockFlag.core, BlockFlag.battery};
static final ObjectFloatMap<Building> weights = new ObjectFloatMap<>(); static final ObjectFloatMap<Building> weights = new ObjectFloatMap<>();
//TODO configurable, perhaps
static final int minSquadSize = 4;
//TODO max squad size //TODO max squad size
static final boolean debug = OS.hasProp("mindustry.debug"); static final boolean debug = OS.hasProp("mindustry.debug");
@@ -172,7 +170,7 @@ public class RtsAI{
//defend when close, or this is the only squad defending //defend when close, or this is the only squad defending
//TODO will always rush to defense no matter what //TODO will always rush to defense no matter what
if(best instanceof CoreBuild || units.size >= minSquadSize || best.within(ax, ay, 500f)){ if(best instanceof CoreBuild || units.size >= data.team.rules().rtsAiMinSquadSize || best.within(ax, ay, 500f)){
defend = best; defend = best;
if(debug){ if(debug){
@@ -239,7 +237,7 @@ public class RtsAI{
} }
@Nullable Building findTarget(float x, float y, int total, float dps, float health){ @Nullable Building findTarget(float x, float y, int total, float dps, float health){
if(total < minSquadSize) return null; if(total < data.team.rules().rtsAiMinSquadSize) return null;
//flag priority? //flag priority?
//1. generator //1. generator

View File

@@ -224,6 +224,8 @@ public class Rules{
/** Enables "RTS" unit AI. TODO wip */ /** Enables "RTS" unit AI. TODO wip */
public boolean rtsAi; public boolean rtsAi;
/** Minimum size of attack squads. */
public int rtsAiMinSquadSize = 4;
/** How fast unit factories build units. */ /** How fast unit factories build units. */
public float unitBuildSpeedMultiplier = 1f; public float unitBuildSpeedMultiplier = 1f;

View File

@@ -253,6 +253,7 @@ public class CustomRulesDialog extends BaseDialog{
number("@rules.blockdamagemultiplier", f -> teams.blockDamageMultiplier = f, () -> teams.blockDamageMultiplier); number("@rules.blockdamagemultiplier", f -> teams.blockDamageMultiplier = f, () -> teams.blockDamageMultiplier);
check("@rules.rtsai", b -> teams.rtsAi = b, () -> teams.rtsAi, () -> team != rules.defaultTeam); check("@rules.rtsai", b -> teams.rtsAi = b, () -> teams.rtsAi, () -> team != rules.defaultTeam);
numberi("@rules.rtsminsquadsize", f -> teams.rtsAiMinSquadSize = f, () -> teams.rtsAiMinSquadSize, () -> teams.rtsAi, 0, 100);
check("@rules.infiniteresources", b -> teams.infiniteResources = b, () -> teams.infiniteResources); check("@rules.infiniteresources", b -> teams.infiniteResources = b, () -> teams.infiniteResources);
number("@rules.buildspeedmultiplier", f -> teams.buildSpeedMultiplier = f, () -> teams.buildSpeedMultiplier, 0.001f, 50f); number("@rules.buildspeedmultiplier", f -> teams.buildSpeedMultiplier = f, () -> teams.buildSpeedMultiplier, 0.001f, 50f);

View File

@@ -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=b2eb1dd566 archash=99ceda8bf2