Map rule for air spawns (#9922)
* air use spawns Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> * add the rule Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> * add rule in ui Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> * bundle Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> * tie it to rules.waves Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> * :) Contributing.md says yes Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> * indent Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com> --------- Signed-off-by: Jason <131086642+JasonP01@users.noreply.github.com>
This commit is contained in:
@@ -1336,6 +1336,7 @@ rules.schematic = Schematics Allowed
|
|||||||
rules.wavetimer = Wave Timer
|
rules.wavetimer = Wave Timer
|
||||||
rules.wavesending = Wave Sending
|
rules.wavesending = Wave Sending
|
||||||
rules.waves = Waves
|
rules.waves = Waves
|
||||||
|
rules.airUseSpawns = Air units use spawn points
|
||||||
rules.attack = Attack Mode
|
rules.attack = Attack Mode
|
||||||
rules.buildai = Base Builder AI
|
rules.buildai = Base Builder AI
|
||||||
rules.buildaitier = Builder AI Tier
|
rules.buildaitier = Builder AI Tier
|
||||||
|
|||||||
@@ -166,3 +166,4 @@ BalaM314
|
|||||||
Redstonneur1256
|
Redstonneur1256
|
||||||
ApsZoldat
|
ApsZoldat
|
||||||
hexagon-recursion
|
hexagon-recursion
|
||||||
|
JasonP01
|
||||||
|
|||||||
@@ -152,14 +152,21 @@ public class WaveSpawner{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void eachFlyerSpawn(int filterPos, Floatc2 cons){
|
private void eachFlyerSpawn(int filterPos, Floatc2 cons){
|
||||||
|
boolean airUseSpawns = state.rules.airUseSpawns;
|
||||||
|
|
||||||
for(Tile tile : spawns){
|
for(Tile tile : spawns){
|
||||||
if(filterPos != -1 && filterPos != tile.pos()) continue;
|
if(filterPos != -1 && filterPos != tile.pos()) continue;
|
||||||
|
|
||||||
float angle = Angles.angle(world.width() / 2f, world.height() / 2f, tile.x, tile.y);
|
if(!airUseSpawns){
|
||||||
float trns = Math.max(world.width(), world.height()) * Mathf.sqrt2 * tilesize;
|
|
||||||
float spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(angle, trns), -margin, world.width() * tilesize + margin);
|
float angle = Angles.angle(world.width() / 2f, world.height() / 2f, tile.x, tile.y);
|
||||||
float spawnY = Mathf.clamp(world.height() * tilesize / 2f + Angles.trnsy(angle, trns), -margin, world.height() * tilesize + margin);
|
float trns = Math.max(world.width(), world.height()) * Mathf.sqrt2 * tilesize;
|
||||||
cons.get(spawnX, spawnY);
|
float spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(angle, trns), -margin, world.width() * tilesize + margin);
|
||||||
|
float spawnY = Mathf.clamp(world.height() * tilesize / 2f + Angles.trnsy(angle, trns), -margin, world.height() * tilesize + margin);
|
||||||
|
cons.get(spawnX, spawnY);
|
||||||
|
}else{
|
||||||
|
cons.get(tile.worldx(), tile.worldy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam)){
|
if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam)){
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class Rules{
|
|||||||
public boolean waveSending = true;
|
public boolean waveSending = true;
|
||||||
/** Whether waves are spawnable at all. */
|
/** Whether waves are spawnable at all. */
|
||||||
public boolean waves;
|
public boolean waves;
|
||||||
|
/** Whether air units spawn at spawns instead of the edge of the map */
|
||||||
|
public boolean airUseSpawns = false;
|
||||||
/** Whether the game objective is PvP. Note that this enables automatic hosting. */
|
/** Whether the game objective is PvP. Note that this enables automatic hosting. */
|
||||||
public boolean pvp;
|
public boolean pvp;
|
||||||
/** Whether is waiting for players enabled in PvP. */
|
/** Whether is waiting for players enabled in PvP. */
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
check("@rules.wavesending", b -> rules.waveSending = b, () -> rules.waveSending, () -> rules.waves);
|
check("@rules.wavesending", b -> rules.waveSending = b, () -> rules.waveSending, () -> rules.waves);
|
||||||
check("@rules.wavetimer", b -> rules.waveTimer = b, () -> rules.waveTimer, () -> rules.waves);
|
check("@rules.wavetimer", b -> rules.waveTimer = b, () -> rules.waveTimer, () -> rules.waves);
|
||||||
check("@rules.waitForWaveToEnd", b -> rules.waitEnemies = b, () -> rules.waitEnemies, () -> rules.waves && rules.waveTimer);
|
check("@rules.waitForWaveToEnd", b -> rules.waitEnemies = b, () -> rules.waitEnemies, () -> rules.waves && rules.waveTimer);
|
||||||
|
check("@rules.airUseSpawns", b -> rules.airUseSpawns = b, () -> rules.airUseSpawns, () -> rules.waves);
|
||||||
numberi("@rules.wavelimit", f -> rules.winWave = f, () -> rules.winWave, () -> rules.waves, 0, Integer.MAX_VALUE);
|
numberi("@rules.wavelimit", f -> rules.winWave = f, () -> rules.winWave, () -> rules.waves, 0, Integer.MAX_VALUE);
|
||||||
number("@rules.wavespacing", false, f -> rules.waveSpacing = f * 60f, () -> rules.waveSpacing / 60f, () -> rules.waves && rules.waveTimer, 1, Float.MAX_VALUE);
|
number("@rules.wavespacing", false, f -> rules.waveSpacing = f * 60f, () -> rules.waveSpacing / 60f, () -> rules.waves && rules.waveTimer, 1, Float.MAX_VALUE);
|
||||||
//this is experimental, because it's not clear that 0 makes it default.
|
//this is experimental, because it's not clear that 0 makes it default.
|
||||||
|
|||||||
Reference in New Issue
Block a user