Do not allow various negative rule values

This commit is contained in:
Anuken 2023-08-05 13:29:15 -04:00
parent 4b38f667e7
commit b7d707e8ba

View File

@ -1433,15 +1433,15 @@ public class LExecutor{
public void run(LExecutor exec){
switch(rule){
case waveTimer -> state.rules.waveTimer = exec.bool(value);
case wave -> state.wave = exec.numi(value);
case currentWaveTime -> state.wavetime = exec.numf(value) * 60f;
case wave -> state.wave = Math.max(exec.numi(value), 1);
case currentWaveTime -> state.wavetime = Math.max(exec.numf(value) * 60f, 0f);
case waves -> state.rules.waves = exec.bool(value);
case waveSending -> state.rules.waveSending = exec.bool(value);
case attackMode -> state.rules.attackMode = exec.bool(value);
case waveSpacing -> state.rules.waveSpacing = exec.numf(value) * 60f;
case enemyCoreBuildRadius -> state.rules.enemyCoreBuildRadius = exec.numf(value) * 8f;
case dropZoneRadius -> state.rules.dropZoneRadius = exec.numf(value) * 8f;
case unitCap -> state.rules.unitCap = exec.numi(value);
case unitCap -> state.rules.unitCap = Math.max(exec.numi(value), 0);
case lighting -> state.rules.lighting = exec.bool(value);
case mapArea -> {
int x = exec.numi(p1), y = exec.numi(p2), w = exec.numi(p3), h = exec.numi(p4);
@ -1450,7 +1450,7 @@ public class LExecutor{
}
}
case ambientLight -> state.rules.ambientLight.fromDouble(exec.num(value));
case solarMultiplier -> state.rules.solarMultiplier = exec.numf(value);
case solarMultiplier -> state.rules.solarMultiplier = Math.max(exec.numf(value), 0f);
case unitHealth, unitBuildSpeed, unitCost, unitDamage, blockHealth, blockDamage, buildSpeed, rtsMinSquad, rtsMinWeight -> {
Team team = exec.team(p1);
if(team != null){