Formatting
This commit is contained in:
@@ -2,20 +2,32 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
/**Base interface for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}.*/
|
||||
public interface Content {
|
||||
/**
|
||||
* Base interface for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}.
|
||||
*/
|
||||
public interface Content{
|
||||
|
||||
/**Returns the type name of this piece of content.
|
||||
* This should return the same value for all instances of this content type.*/
|
||||
/**
|
||||
* Returns the type name of this piece of content.
|
||||
* This should return the same value for all instances of this content type.
|
||||
*/
|
||||
String getContentTypeName();
|
||||
|
||||
/**Returns a list of all instances of this content.*/
|
||||
/**
|
||||
* Returns a list of all instances of this content.
|
||||
*/
|
||||
Array<? extends Content> getAll();
|
||||
|
||||
/**Called after all content is created. Do not use to load regions or texture data!*/
|
||||
default void init(){}
|
||||
/**
|
||||
* Called after all content is created. Do not use to load regions or texture data!
|
||||
*/
|
||||
default void init(){
|
||||
}
|
||||
|
||||
/**Called after all content is created, only on non-headless versions.
|
||||
* Use for loading regions or other image data.*/
|
||||
default void load(){}
|
||||
/**
|
||||
* Called after all content is created, only on non-headless versions.
|
||||
* Use for loading regions or other image data.
|
||||
*/
|
||||
default void load(){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,19 @@ import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||
import io.anuke.ucore.core.Events;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
|
||||
public class ContentDatabase {
|
||||
/**Maps unlockable type names to a set of unlocked content.*/
|
||||
public class ContentDatabase{
|
||||
/**
|
||||
* Maps unlockable type names to a set of unlocked content.
|
||||
*/
|
||||
private ObjectMap<String, ObjectSet<String>> unlocked = new ObjectMap<>();
|
||||
/**Whether unlockables have changed since the last save.*/
|
||||
/**
|
||||
* Whether unlockables have changed since the last save.
|
||||
*/
|
||||
private boolean dirty;
|
||||
|
||||
/**Returns whether or not this piece of content is unlocked yet.*/
|
||||
/**
|
||||
* Returns whether or not this piece of content is unlocked yet.
|
||||
*/
|
||||
public boolean isUnlocked(UnlockableContent content){
|
||||
if(!unlocked.containsKey(content.getContentTypeName())){
|
||||
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
||||
@@ -25,10 +31,13 @@ public class ContentDatabase {
|
||||
return set.contains(content.getContentName());
|
||||
}
|
||||
|
||||
/**Makes this piece of content 'unlocked', if possible.
|
||||
/**
|
||||
* Makes this piece of content 'unlocked', if possible.
|
||||
* If this piece of content is already unlocked or cannot be unlocked due to dependencies, nothing changes.
|
||||
* Results are not saved until you call {@link #save()}.
|
||||
* @return whether or not this content was newly unlocked.*/
|
||||
*
|
||||
* @return whether or not this content was newly unlocked.
|
||||
*/
|
||||
public boolean unlockContent(UnlockableContent content){
|
||||
if(!content.canBeUnlocked()) return false;
|
||||
|
||||
@@ -48,12 +57,16 @@ public class ContentDatabase {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**Returns whether unlockables have changed since the last save.*/
|
||||
/**
|
||||
* Returns whether unlockables have changed since the last save.
|
||||
*/
|
||||
public boolean isDirty(){
|
||||
return dirty;
|
||||
}
|
||||
|
||||
/**Clears all unlocked content.*/
|
||||
/**
|
||||
* Clears all unlocked content.
|
||||
*/
|
||||
public void reset(){
|
||||
unlocked.clear();
|
||||
dirty = true;
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public enum Difficulty {
|
||||
public enum Difficulty{
|
||||
easy(4f, 2f, 1f),
|
||||
normal(2f, 1f, 1f),
|
||||
hard(1.5f, 0.5f, 0.75f),
|
||||
@@ -10,13 +10,19 @@ public enum Difficulty {
|
||||
//purge removed due to new wave system
|
||||
/*purge(0.25f, 0.01f, 0.25f)*/;
|
||||
|
||||
/**The scaling of how many waves it takes for one more enemy of a type to appear.
|
||||
/**
|
||||
* The scaling of how many waves it takes for one more enemy of a type to appear.
|
||||
* For example: with enemeyScaling = 2 and the default scaling being 2, it would take 4 waves for
|
||||
* an enemy spawn to go from 1->2 enemies.*/
|
||||
* an enemy spawn to go from 1->2 enemies.
|
||||
*/
|
||||
public final float enemyScaling;
|
||||
/**Multiplier of the time between waves.*/
|
||||
/**
|
||||
* Multiplier of the time between waves.
|
||||
*/
|
||||
public final float timeScaling;
|
||||
/**Scaling of max time between waves. Default time is 4 minutes.*/
|
||||
/**
|
||||
* Scaling of max time between waves. Default time is 4 minutes.
|
||||
*/
|
||||
public final float maxTimeScaling;
|
||||
|
||||
private String value;
|
||||
@@ -28,7 +34,7 @@ public enum Difficulty {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String toString(){
|
||||
if(value == null){
|
||||
value = Bundles.get("setting.difficulty." + name());
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.function.Event;
|
||||
|
||||
public class EventType {
|
||||
public class EventType{
|
||||
|
||||
public interface PlayEvent extends Event{
|
||||
void handle();
|
||||
@@ -22,19 +22,25 @@ public class EventType {
|
||||
void handle();
|
||||
}
|
||||
|
||||
/**This event is called from the logic thread.
|
||||
* DO NOT INITIALIZE GRAPHICS HERE.*/
|
||||
/**
|
||||
* This event is called from the logic thread.
|
||||
* DO NOT INITIALIZE GRAPHICS HERE.
|
||||
*/
|
||||
public interface WorldLoadEvent extends Event{
|
||||
void handle();
|
||||
}
|
||||
|
||||
/**Called after the WorldLoadEvent is, and all logic has been loaded.
|
||||
* It is safe to intialize graphics here.*/
|
||||
/**
|
||||
* Called after the WorldLoadEvent is, and all logic has been loaded.
|
||||
* It is safe to intialize graphics here.
|
||||
*/
|
||||
public interface WorldLoadGraphicsEvent extends Event{
|
||||
void handle();
|
||||
}
|
||||
|
||||
/**Called from the logic thread. Do not access graphics here!*/
|
||||
/**
|
||||
* Called from the logic thread. Do not access graphics here!
|
||||
*/
|
||||
public interface TileChangeEvent extends Event{
|
||||
void handle(Tile tile);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package io.anuke.mindustry.game;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public enum GameMode{
|
||||
waves,
|
||||
//disabled for technical reasons
|
||||
waves,
|
||||
//disabled for technical reasons
|
||||
/*sandbox{
|
||||
{
|
||||
infiniteResources = true;
|
||||
@@ -16,16 +16,16 @@ public enum GameMode{
|
||||
disableWaveTimer = true;
|
||||
}
|
||||
};
|
||||
public boolean infiniteResources;
|
||||
public boolean disableWaveTimer;
|
||||
public boolean infiniteResources;
|
||||
public boolean disableWaveTimer;
|
||||
|
||||
public String description(){
|
||||
return Bundles.get("mode."+name()+".description");
|
||||
}
|
||||
public String description(){
|
||||
return Bundles.get("mode." + name() + ".description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return Bundles.get("mode."+name()+".name");
|
||||
}
|
||||
@Override
|
||||
public String toString(){
|
||||
return Bundles.get("mode." + name() + ".name");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,84 +8,118 @@ import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.StatusEffect;
|
||||
import io.anuke.mindustry.type.Weapon;
|
||||
|
||||
/**A spawn group defines spawn information for a specific type of unit, with optional extra information like
|
||||
/**
|
||||
* A spawn group defines spawn information for a specific type of unit, with optional extra information like
|
||||
* weapon equipped, ammo used, and status effects.
|
||||
* Each spawn group can have multiple sub-groups spawned in different areas of the map.*/
|
||||
public class SpawnGroup {
|
||||
/**The unit type spawned*/
|
||||
public final UnitType type;
|
||||
/**When this spawn should end*/
|
||||
protected int end = Integer.MAX_VALUE;
|
||||
/**When this spawn should start*/
|
||||
protected int begin;
|
||||
/**The spacing, in waves, of spawns. For example, 2 = spawns every other wave*/
|
||||
protected int spacing = 1;
|
||||
/**Maximum amount of units that spawn*/
|
||||
protected int max = 60;
|
||||
/**How many waves need to pass before the amount of units spawned increases by 1*/
|
||||
protected float unitScaling = 9999f;
|
||||
/**How many waves need to pass before the amount of instances of this group increases by 1*/
|
||||
protected float groupScaling = 9999f;
|
||||
/**Amount of enemies spawned initially, with no scaling*/
|
||||
protected int unitAmount = 1;
|
||||
/**Amount of enemies spawned initially, with no scaling*/
|
||||
protected int groupAmount = 1;
|
||||
/**Weapon used by the spawned unit. Null to disable. Only applicable to ground units.*/
|
||||
protected Weapon weapon;
|
||||
/**Status effect applied to the spawned unit. Null to disable.*/
|
||||
protected StatusEffect effect;
|
||||
/**Items this unit spawns with. Null to disable.*/
|
||||
protected ItemStack items;
|
||||
/**Ammo type this unit spawns with. Null to use the first available ammo.*/
|
||||
protected Item ammoItem;
|
||||
|
||||
public SpawnGroup(UnitType type){
|
||||
this.type = type;
|
||||
}
|
||||
* Each spawn group can have multiple sub-groups spawned in different areas of the map.
|
||||
*/
|
||||
public class SpawnGroup{
|
||||
/**
|
||||
* The unit type spawned
|
||||
*/
|
||||
public final UnitType type;
|
||||
/**
|
||||
* When this spawn should end
|
||||
*/
|
||||
protected int end = Integer.MAX_VALUE;
|
||||
/**
|
||||
* When this spawn should start
|
||||
*/
|
||||
protected int begin;
|
||||
/**
|
||||
* The spacing, in waves, of spawns. For example, 2 = spawns every other wave
|
||||
*/
|
||||
protected int spacing = 1;
|
||||
/**
|
||||
* Maximum amount of units that spawn
|
||||
*/
|
||||
protected int max = 60;
|
||||
/**
|
||||
* How many waves need to pass before the amount of units spawned increases by 1
|
||||
*/
|
||||
protected float unitScaling = 9999f;
|
||||
/**
|
||||
* How many waves need to pass before the amount of instances of this group increases by 1
|
||||
*/
|
||||
protected float groupScaling = 9999f;
|
||||
/**
|
||||
* Amount of enemies spawned initially, with no scaling
|
||||
*/
|
||||
protected int unitAmount = 1;
|
||||
/**
|
||||
* Amount of enemies spawned initially, with no scaling
|
||||
*/
|
||||
protected int groupAmount = 1;
|
||||
/**
|
||||
* Weapon used by the spawned unit. Null to disable. Only applicable to ground units.
|
||||
*/
|
||||
protected Weapon weapon;
|
||||
/**
|
||||
* Status effect applied to the spawned unit. Null to disable.
|
||||
*/
|
||||
protected StatusEffect effect;
|
||||
/**
|
||||
* Items this unit spawns with. Null to disable.
|
||||
*/
|
||||
protected ItemStack items;
|
||||
/**
|
||||
* Ammo type this unit spawns with. Null to use the first available ammo.
|
||||
*/
|
||||
protected Item ammoItem;
|
||||
|
||||
/**Returns the amount of units spawned on a specific wave.*/
|
||||
public int getUnitsSpawned(int wave){
|
||||
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
|
||||
return 0;
|
||||
}
|
||||
float scaling = this.unitScaling;
|
||||
|
||||
return Math.min(unitAmount-1 + Math.max((int)((wave / spacing) / scaling), 1), max);
|
||||
}
|
||||
public SpawnGroup(UnitType type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**Returns the amount of different unit groups at a specific wave.*/
|
||||
public int getGroupsSpawned(int wave){
|
||||
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
|
||||
return 0;
|
||||
}
|
||||
float scaling = this.groupScaling;
|
||||
/**
|
||||
* Returns the amount of units spawned on a specific wave.
|
||||
*/
|
||||
public int getUnitsSpawned(int wave){
|
||||
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
|
||||
return 0;
|
||||
}
|
||||
float scaling = this.unitScaling;
|
||||
|
||||
return Math.min(groupAmount-1 + Math.max((int)((wave / spacing) / groupScaling), 1), max);
|
||||
}
|
||||
return Math.min(unitAmount - 1 + Math.max((int) ((wave / spacing) / scaling), 1), max);
|
||||
}
|
||||
|
||||
/**Creates a unit, and assigns correct values based on this group's data.
|
||||
* This method does not add() the unit.*/
|
||||
public BaseUnit createUnit(Team team){
|
||||
BaseUnit unit = type.create(team);
|
||||
/**
|
||||
* Returns the amount of different unit groups at a specific wave.
|
||||
*/
|
||||
public int getGroupsSpawned(int wave){
|
||||
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
|
||||
return 0;
|
||||
}
|
||||
float scaling = this.groupScaling;
|
||||
|
||||
if(unit instanceof GroundUnit && weapon != null){
|
||||
((GroundUnit) unit).setWeapon(weapon);
|
||||
}
|
||||
return Math.min(groupAmount - 1 + Math.max((int) ((wave / spacing) / groupScaling), 1), max);
|
||||
}
|
||||
|
||||
if(effect != null){
|
||||
unit.applyEffect(effect, 10000f);
|
||||
}
|
||||
/**
|
||||
* Creates a unit, and assigns correct values based on this group's data.
|
||||
* This method does not add() the unit.
|
||||
*/
|
||||
public BaseUnit createUnit(Team team){
|
||||
BaseUnit unit = type.create(team);
|
||||
|
||||
if(items != null){
|
||||
unit.inventory.addItem(items.item, items.amount);
|
||||
}
|
||||
if(unit instanceof GroundUnit && weapon != null){
|
||||
((GroundUnit) unit).setWeapon(weapon);
|
||||
}
|
||||
|
||||
if(ammoItem != null){
|
||||
unit.inventory.addAmmo(unit.getWeapon().getAmmoType(ammoItem));
|
||||
}else{
|
||||
unit.inventory.addAmmo(unit.getWeapon().getAmmoType(unit.getWeapon().getAcceptedItems().iterator().next()));
|
||||
}
|
||||
if(effect != null){
|
||||
unit.applyEffect(effect, 10000f);
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
if(items != null){
|
||||
unit.inventory.addItem(items.item, items.amount);
|
||||
}
|
||||
|
||||
if(ammoItem != null){
|
||||
unit.inventory.addAmmo(unit.getWeapon().getAmmoType(ammoItem));
|
||||
}else{
|
||||
unit.inventory.addAmmo(unit.getWeapon().getAmmoType(unit.getWeapon().getAcceptedItems().iterator().next()));
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
public enum Team {
|
||||
public enum Team{
|
||||
none(Color.DARK_GRAY),
|
||||
blue(Color.ROYAL),
|
||||
red(Color.valueOf("e84737")),
|
||||
@@ -10,11 +10,10 @@ public enum Team {
|
||||
purple(Color.valueOf("ba5bd9")),
|
||||
orange(Color.valueOf("e8c66a"));
|
||||
|
||||
public final static Team[] all = values();
|
||||
public final Color color;
|
||||
public final int intColor;
|
||||
|
||||
public final static Team[] all = values();
|
||||
|
||||
Team(Color color){
|
||||
this.color = color;
|
||||
intColor = Color.rgba8888(color);
|
||||
|
||||
@@ -6,8 +6,10 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.util.ThreadArray;
|
||||
import io.anuke.ucore.util.ThreadSet;
|
||||
|
||||
/**Class for various team-based utilities.*/
|
||||
public class TeamInfo {
|
||||
/**
|
||||
* Class for various team-based utilities.
|
||||
*/
|
||||
public class TeamInfo{
|
||||
private ObjectMap<Team, TeamData> map = new ObjectMap<>();
|
||||
private ThreadSet<Team> allies = new ThreadSet<>(),
|
||||
enemies = new ThreadSet<>();
|
||||
@@ -18,30 +20,37 @@ public class TeamInfo {
|
||||
private int allyBits = 0;
|
||||
private int enemyBits = 0;
|
||||
|
||||
/**Returns all teams on a side.*/
|
||||
public ObjectSet<TeamData> getTeams(boolean ally) {
|
||||
/**
|
||||
* Returns all teams on a side.
|
||||
*/
|
||||
public ObjectSet<TeamData> getTeams(boolean ally){
|
||||
return ally ? allyData : enemyData;
|
||||
}
|
||||
|
||||
/**Returns all team data.*/
|
||||
public ObjectSet<TeamData> getTeams() {
|
||||
/**
|
||||
* Returns all team data.
|
||||
*/
|
||||
public ObjectSet<TeamData> getTeams(){
|
||||
return allTeamData;
|
||||
}
|
||||
|
||||
/**Register a team.
|
||||
/**
|
||||
* Register a team.
|
||||
*
|
||||
* @param team The team type enum.
|
||||
* @param ally Whether this team is an ally with the player or an enemy with the player.
|
||||
* In PvP situations with dedicated servers, the sides can be arbitrary.*/
|
||||
* In PvP situations with dedicated servers, the sides can be arbitrary.
|
||||
*/
|
||||
public void add(Team team, boolean ally){
|
||||
if(has(team)) throw new RuntimeException("Can't define team information twice!");
|
||||
|
||||
TeamData data = new TeamData(team, ally);
|
||||
|
||||
if(ally) {
|
||||
if(ally){
|
||||
allies.add(team);
|
||||
allyData.add(data);
|
||||
allyBits |= (1 << team.ordinal());
|
||||
}else {
|
||||
}else{
|
||||
enemies.add(team);
|
||||
enemyData.add(data);
|
||||
enemyBits |= (1 << team.ordinal());
|
||||
@@ -53,20 +62,26 @@ public class TeamInfo {
|
||||
map.put(team, data);
|
||||
}
|
||||
|
||||
/**Returns team data by type. Call {@link #has(Team)} first to make sure it's active!*/
|
||||
/**
|
||||
* Returns team data by type. Call {@link #has(Team)} first to make sure it's active!
|
||||
*/
|
||||
public TeamData get(Team team){
|
||||
if(!has(team)) throw new RuntimeException("This team is not active! Check has() before calling get().");
|
||||
return map.get(team);
|
||||
}
|
||||
|
||||
/**Returns whether the specified team is active, e.g. whether it is participating in the game.*/
|
||||
/**
|
||||
* Returns whether the specified team is active, e.g. whether it is participating in the game.
|
||||
*/
|
||||
public boolean has(Team team){
|
||||
return map.containsKey(team);
|
||||
}
|
||||
|
||||
/**Returns a set of all teams that are enemies of this team.
|
||||
* For teams not active, an empty set is returned.*/
|
||||
public ObjectSet<Team> enemiesOf(Team team) {
|
||||
/**
|
||||
* Returns a set of all teams that are enemies of this team.
|
||||
* For teams not active, an empty set is returned.
|
||||
*/
|
||||
public ObjectSet<Team> enemiesOf(Team team){
|
||||
boolean ally = allies.contains(team);
|
||||
boolean enemy = enemies.contains(team);
|
||||
|
||||
@@ -76,9 +91,11 @@ public class TeamInfo {
|
||||
return ally ? enemies : allies;
|
||||
}
|
||||
|
||||
/**Returns a set of all teams that are allies of this team.
|
||||
* For teams not active, an empty set is returned.*/
|
||||
public ObjectSet<Team> alliesOf(Team team) {
|
||||
/**
|
||||
* Returns a set of all teams that are allies of this team.
|
||||
* For teams not active, an empty set is returned.
|
||||
*/
|
||||
public ObjectSet<Team> alliesOf(Team team){
|
||||
boolean ally = allies.contains(team);
|
||||
boolean enemy = enemies.contains(team);
|
||||
|
||||
@@ -88,9 +105,11 @@ public class TeamInfo {
|
||||
return !ally ? enemies : allies;
|
||||
}
|
||||
|
||||
/**Returns a set of all teams that are enemies of this team.
|
||||
* For teams not active, an empty set is returned.*/
|
||||
public ObjectSet<TeamData> enemyDataOf(Team team) {
|
||||
/**
|
||||
* Returns a set of all teams that are enemies of this team.
|
||||
* For teams not active, an empty set is returned.
|
||||
*/
|
||||
public ObjectSet<TeamData> enemyDataOf(Team team){
|
||||
boolean ally = allies.contains(team);
|
||||
boolean enemy = enemies.contains(team);
|
||||
|
||||
@@ -100,7 +119,9 @@ public class TeamInfo {
|
||||
return ally ? enemyData : allyData;
|
||||
}
|
||||
|
||||
/**Returns whether or not these two teams are enemies.*/
|
||||
/**
|
||||
* Returns whether or not these two teams are enemies.
|
||||
*/
|
||||
public boolean areEnemies(Team team, Team other){
|
||||
if(team == other) return false; //fast fail to be more efficient
|
||||
boolean ally = (allyBits & (1 << team.ordinal())) != 0;
|
||||
@@ -108,12 +129,12 @@ public class TeamInfo {
|
||||
return (ally == enemy) || !ally; //if it's not in the game, target everything.
|
||||
}
|
||||
|
||||
public class TeamData {
|
||||
public class TeamData{
|
||||
public final ThreadArray<Tile> cores = new ThreadArray<>();
|
||||
public final Team team;
|
||||
public final boolean ally;
|
||||
|
||||
public TeamData(Team team, boolean ally) {
|
||||
public TeamData(Team team, boolean ally){
|
||||
this.team = team;
|
||||
this.ally = ally;
|
||||
}
|
||||
|
||||
@@ -5,37 +5,54 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
|
||||
/**Base interface for an unlockable content type.*/
|
||||
/**
|
||||
* Base interface for an unlockable content type.
|
||||
*/
|
||||
public interface UnlockableContent extends Content{
|
||||
|
||||
/**Returns the unqiue name of this piece of 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.
|
||||
* (e.g. having a recipe and a block, both with name "wall" is fine, as they are different types).*/
|
||||
* (e.g. having a recipe and a block, both with name "wall" is fine, as they are different types).
|
||||
*/
|
||||
String getContentName();
|
||||
|
||||
/**Returns the localized name of this content.*/
|
||||
/**
|
||||
* Returns the localized name of this content.
|
||||
*/
|
||||
String localizedName();
|
||||
|
||||
TextureRegion getContentIcon();
|
||||
|
||||
/**This should show all necessary info about this content in the specified table.*/
|
||||
/**
|
||||
* This should show all necessary info about this content in the specified table.
|
||||
*/
|
||||
void displayInfo(Table table);
|
||||
|
||||
/**Called when this content is unlocked. Use this to unlock other related content.*/
|
||||
default void onUnlock(){}
|
||||
/**
|
||||
* Called when this content is unlocked. Use this to unlock other related content.
|
||||
*/
|
||||
default void onUnlock(){
|
||||
}
|
||||
|
||||
/**Whether this content is always hidden in the content info dialog.*/
|
||||
/**
|
||||
* Whether this content is always hidden in the content info dialog.
|
||||
*/
|
||||
default boolean isHidden(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**Lists the content that must be unlocked in order for this specific content to become unlocked. May return null.*/
|
||||
/**
|
||||
* Lists the content that must be unlocked in order for this specific content to become unlocked. May return null.
|
||||
*/
|
||||
default UnlockableContent[] getDependencies(){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**Returns whether dependencies are satisfied for unlocking this content.*/
|
||||
/**
|
||||
* Returns whether dependencies are satisfied for unlocking this content.
|
||||
*/
|
||||
default boolean canBeUnlocked(){
|
||||
UnlockableContent[] depend = getDependencies();
|
||||
if(depend == null){
|
||||
|
||||
@@ -8,183 +8,183 @@ import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
|
||||
public class WaveCreator{
|
||||
|
||||
public static Array<SpawnGroup> getSpawns(){
|
||||
return Array.with(
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
end = 8;
|
||||
unitScaling = 2;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
begin = 12;
|
||||
end = 14;
|
||||
}},
|
||||
public static Array<SpawnGroup> getSpawns(){
|
||||
return Array.with(
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
end = 8;
|
||||
unitScaling = 2;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 11;
|
||||
unitScaling = 2;
|
||||
spacing = 2;
|
||||
max = 4;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
begin = 12;
|
||||
end = 14;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 9;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 11;
|
||||
unitScaling = 2;
|
||||
spacing = 2;
|
||||
max = 4;
|
||||
}},
|
||||
|
||||
end = 30;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 9;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 10;
|
||||
unitScaling = 2;
|
||||
unitAmount = 1;
|
||||
spacing = 2;
|
||||
ammoItem = Items.tungsten;
|
||||
end = 30;
|
||||
}},
|
||||
end = 30;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 28;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
weapon = Weapons.flamethrower;
|
||||
end = 40;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 10;
|
||||
unitScaling = 2;
|
||||
unitAmount = 1;
|
||||
spacing = 2;
|
||||
ammoItem = Items.tungsten;
|
||||
end = 30;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 45;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
weapon = Weapons.flamethrower;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 28;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
weapon = Weapons.flamethrower;
|
||||
end = 40;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 120;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
unitAmount = 5;
|
||||
weapon = Weapons.flakgun;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 45;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
weapon = Weapons.flamethrower;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
begin = 16;
|
||||
unitScaling = 2;
|
||||
spacing = 2;
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 120;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
unitAmount = 5;
|
||||
weapon = Weapons.flakgun;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
end = 39;
|
||||
max = 7;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
begin = 16;
|
||||
unitScaling = 2;
|
||||
spacing = 2;
|
||||
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 82;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
groupAmount = 2;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.overdrive;
|
||||
ammoItem = Items.silicon;
|
||||
}},
|
||||
end = 39;
|
||||
max = 7;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 41;
|
||||
spacing = 5;
|
||||
unitAmount = 1;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.shielded;
|
||||
ammoItem = Items.thorium;
|
||||
max = 10;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 82;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
groupAmount = 2;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.overdrive;
|
||||
ammoItem = Items.silicon;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 35;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
groupAmount = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.blastCompound, 60);
|
||||
end = 60;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 41;
|
||||
spacing = 5;
|
||||
unitAmount = 1;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.shielded;
|
||||
ammoItem = Items.thorium;
|
||||
max = 10;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 42;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
groupAmount = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.pyratite, 100);
|
||||
end = 130;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 35;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
groupAmount = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.blastCompound, 60);
|
||||
end = 60;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
begin = 40;
|
||||
ammoItem = Items.blastCompound;
|
||||
unitAmount = 2;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
max = 8;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.scout){{
|
||||
begin = 42;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
groupAmount = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.pyratite, 100);
|
||||
end = 130;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
begin = 50;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
spacing = 5;
|
||||
groupAmount = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
max = 8;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
begin = 40;
|
||||
ammoItem = Items.blastCompound;
|
||||
unitAmount = 2;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
begin = 53;
|
||||
ammoItem = Items.pyratite;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
end = 74;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.vtol){{
|
||||
begin = 50;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
spacing = 5;
|
||||
groupAmount = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
begin = 53;
|
||||
ammoItem = Items.coal;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
end = 74;
|
||||
}}
|
||||
);
|
||||
}
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
begin = 53;
|
||||
ammoItem = Items.pyratite;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
end = 74;
|
||||
}},
|
||||
|
||||
public static void testWaves(int from, int to){
|
||||
Array<SpawnGroup> spawns = getSpawns();
|
||||
for(int i = from; i <= to; i ++){
|
||||
System.out.print(i+": ");
|
||||
int total = 0;
|
||||
for(SpawnGroup spawn : spawns){
|
||||
int a = spawn.getUnitsSpawned(i) * spawn.getGroupsSpawned(i);
|
||||
total += a;
|
||||
|
||||
if(a > 0){
|
||||
System.out.print(a+"x" + spawn.type.name);
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
begin = 53;
|
||||
ammoItem = Items.coal;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
end = 74;
|
||||
}}
|
||||
);
|
||||
}
|
||||
|
||||
if(spawn.weapon != null){
|
||||
System.out.print(":" + spawn.weapon.name);
|
||||
}
|
||||
public static void testWaves(int from, int to){
|
||||
Array<SpawnGroup> spawns = getSpawns();
|
||||
for(int i = from; i <= to; i++){
|
||||
System.out.print(i + ": ");
|
||||
int total = 0;
|
||||
for(SpawnGroup spawn : spawns){
|
||||
int a = spawn.getUnitsSpawned(i) * spawn.getGroupsSpawned(i);
|
||||
total += a;
|
||||
|
||||
if(spawn.ammoItem != null){
|
||||
System.out.print(":" + spawn.ammoItem.name);
|
||||
}
|
||||
if(a > 0){
|
||||
System.out.print(a + "x" + spawn.type.name);
|
||||
|
||||
System.out.print(" ");
|
||||
}
|
||||
}
|
||||
System.out.print(" (" + total + ")");
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
if(spawn.weapon != null){
|
||||
System.out.print(":" + spawn.weapon.name);
|
||||
}
|
||||
|
||||
if(spawn.ammoItem != null){
|
||||
System.out.print(":" + spawn.ammoItem.name);
|
||||
}
|
||||
|
||||
System.out.print(" ");
|
||||
}
|
||||
}
|
||||
System.out.print(" (" + total + ")");
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user