Custom wave patterns / Fixed checkbox sprite / Bugfixes

This commit is contained in:
Anuken
2019-03-14 14:01:22 -04:00
parent f2662045ed
commit ed105b102d
46 changed files with 1375 additions and 875 deletions
@@ -17,26 +17,26 @@ import static io.anuke.mindustry.Vars.content;
* Each spawn group can have multiple sub-groups spawned in different areas of the map.
*/
public class SpawnGroup implements Serializable{
protected static final int never = Integer.MAX_VALUE;
public static final int never = Integer.MAX_VALUE;
/**The unit type spawned*/
public UnitType type;
/**When this spawn should end*/
protected int end = never;
public int end = never;
/**When this spawn should start*/
protected int begin;
public int begin;
/**The spacing, in waves, of spawns. For example, 2 = spawns every other wave*/
protected int spacing = 1;
public int spacing = 1;
/**Maximum amount of units that spawn*/
protected int max = 40;
public int max = 40;
/**How many waves need to pass before the amount of units spawned increases by 1*/
protected float unitScaling = 9999f;
public float unitScaling = never;
/**Amount of enemies spawned initially, with no scaling*/
protected int unitAmount = 1;
public int unitAmount = 1;
/**Status effect applied to the spawned unit. Null to disable.*/
protected StatusEffect effect;
public StatusEffect effect;
/**Items this unit spawns with. Null to disable.*/
protected ItemStack items;
public ItemStack items;
public SpawnGroup(UnitType type){
this.type = type;
@@ -76,15 +76,14 @@ public class SpawnGroup implements Serializable{
@Override
public void write (Json json) {
json.writeObjectStart();
json.writeValue("type", type.name);
json.writeValue("begin", begin);
json.writeValue("end", end);
json.writeValue("spacing", spacing);
json.writeValue("max", max);
json.writeValue("scaling", unitScaling);
json.writeValue("amount", unitAmount);
json.writeObjectEnd();
if(begin != 0) json.writeValue("begin", begin);
if(end != never) json.writeValue("end", end);
if(spacing != 1) json.writeValue("spacing", spacing);
if(max != 40) json.writeValue("max", max);
if(unitScaling != never) json.writeValue("scaling", unitScaling);
if(unitAmount != 1) json.writeValue("amount", unitAmount);
if(effect != null) json.writeValue("effect", effect.id);
}
@Override
@@ -96,6 +95,7 @@ public class SpawnGroup implements Serializable{
max = data.getInt("spacing", 40);
unitScaling = data.getFloat("scaling", never);
unitAmount = data.getInt("amount", 1);
effect = content.getByID(ContentType.status, data.getInt("effect", -1));
}
@Override