Destructible grey blocks / Content cleanup / Wave fixes / Impact balance

This commit is contained in:
Anuken
2019-02-16 11:10:01 -05:00
parent fbcbca6f24
commit 4677de80c1
51 changed files with 1077 additions and 728 deletions
@@ -6,7 +6,7 @@ import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.content.UnitTypes;
import io.anuke.mindustry.type.ItemStack;
public class Waves{
public class DefaultWaves{
private static Array<SpawnGroup> spawns;
public static Array<SpawnGroup> getDefaultSpawns(){
@@ -165,23 +165,4 @@ public class Waves{
}
return spawns;
}
public static void testWaves(Array<SpawnGroup> spawns, int from, int to){
for(int i = from; i <= to; i++){
System.out.print(i + ": ");
int total = 0;
for(SpawnGroup spawn : spawns){
int a = spawn.getUnitsSpawned(i);
total += a;
if(a > 0){
System.out.print(a + "x" + spawn.type.name);
System.out.print(" ");
}
}
System.out.print(" (" + total + ")");
System.out.println();
}
}
}
@@ -82,7 +82,7 @@ public class GlobalData{
/** Returns whether or not this piece of content is unlocked yet.*/
public boolean isUnlocked(UnlockableContent content){
return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.getContentName());
return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.name);
}
/**
@@ -94,7 +94,7 @@ public class GlobalData{
if(content.alwaysUnlocked()) return;
//fire unlock event so other classes can use it
if(unlocked.getOr(content.getContentType(), ObjectSet::new).add(content.getContentName())){
if(unlocked.getOr(content.getContentType(), ObjectSet::new).add(content.name)){
modified = true;
content.onUnlock();
Events.fire(new UnlockEvent(content));
@@ -1,15 +1,14 @@
package io.anuke.mindustry.game;
public abstract class MappableContent extends Content {
/**
* Returns the unqiue name of this piece of content.
* The name only needs to be unique for all content of this type.
* Do not use IDs for names! Make sure this string stays constant with each update unless removed.
*/
public abstract String getContentName();
public final String name;
public MappableContent(String name){
this.name = name;
}
@Override
public String toString(){
return getContentName();
return name;
}
}
@@ -9,13 +9,13 @@ public enum RulePreset{
waveTimer = true;
waves = true;
unitDrops = true;
spawns = Waves.getDefaultSpawns();
spawns = DefaultWaves.getDefaultSpawns();
}}),
sandbox(() -> new Rules(){{
infiniteResources = true;
waves = true;
waveTimer = false;
spawns = Waves.getDefaultSpawns();
spawns = DefaultWaves.getDefaultSpawns();
}}),
attack(() -> new Rules(){{
enemyCheat = true;
@@ -1,11 +1,24 @@
package io.anuke.mindustry.game;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.Vars;
/**Base interface for an unlockable content type.*/
public abstract class UnlockableContent extends MappableContent{
/**Localized, formal name. Never null. Set to block name if not found in bundle.*/
public String localizedName;
/**Localized description. May be null.*/
public String description;
public UnlockableContent(String name){
super(name);
this.localizedName = Core.bundle.get(getContentType() + "." + name + ".name", name);
this.description = Core.bundle.getOrNull(getContentType() + "." + name + ".description");
}
/**Returns the localized name of this content.*/
public abstract String localizedName();