Content mapping, part 1
This commit is contained in:
@@ -7,7 +7,7 @@ import io.anuke.mindustry.content.fx.Fx;
|
|||||||
import io.anuke.mindustry.content.fx.ShootFx;
|
import io.anuke.mindustry.content.fx.ShootFx;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.AmmoType;
|
import io.anuke.mindustry.type.AmmoType;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
|
||||||
public class AmmoTypes implements ContentList{
|
public class AmmoTypes implements ContentList{
|
||||||
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
|
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemType;
|
import io.anuke.mindustry.type.ItemType;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
|
|
||||||
public class Liquids implements ContentList{
|
public class Liquids implements ContentList{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import io.anuke.mindustry.game.Content;
|
|||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
import io.anuke.mindustry.graphics.Shaders;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.Mech;
|
import io.anuke.mindustry.type.Mech;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.blocks.*;
|
import io.anuke.mindustry.content.blocks.*;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.type.Recipe;
|
import io.anuke.mindustry.type.Recipe;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.content.fx.EnvironmentFx;
|
|||||||
import io.anuke.mindustry.entities.StatusController.StatusEntry;
|
import io.anuke.mindustry.entities.StatusController.StatusEntry;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.StatusEffect;
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.badlogic.gdx.utils.ObjectSet;
|
|||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
import io.anuke.mindustry.entities.units.types.*;
|
import io.anuke.mindustry.entities.units.types.*;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
|
||||||
public class UnitTypes implements ContentList{
|
public class UnitTypes implements ContentList{
|
||||||
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fabricator;
|
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fabricator;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.content.fx.ShootFx;
|
import io.anuke.mindustry.content.fx.ShootFx;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.Weapon;
|
import io.anuke.mindustry.type.Weapon;
|
||||||
|
|
||||||
public class Weapons implements ContentList{
|
public class Weapons implements ContentList{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.blocks;
|
|||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
|
|
||||||
public abstract class BlockList implements ContentList{
|
public abstract class BlockList implements ContentList{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.content.Items;
|
|||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.content.StatusEffects;
|
import io.anuke.mindustry.content.StatusEffects;
|
||||||
import io.anuke.mindustry.graphics.CacheLayer;
|
import io.anuke.mindustry.graphics.CacheLayer;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
import io.anuke.mindustry.content.fx.BlockFx;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.production.*;
|
import io.anuke.mindustry.world.blocks.production.*;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import io.anuke.mindustry.content.Liquids;
|
|||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.blocks;
|
|||||||
|
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
import io.anuke.mindustry.content.fx.BlockFx;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.defense.*;
|
import io.anuke.mindustry.world.blocks.defense.*;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package io.anuke.mindustry.content.blocks;
|
package io.anuke.mindustry.content.blocks;
|
||||||
|
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.distribution.*;
|
import io.anuke.mindustry.world.blocks.distribution.*;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package io.anuke.mindustry.content.blocks;
|
package io.anuke.mindustry.content.blocks;
|
||||||
|
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.distribution.*;
|
import io.anuke.mindustry.world.blocks.distribution.*;
|
||||||
import io.anuke.mindustry.world.blocks.production.Pump;
|
import io.anuke.mindustry.world.blocks.production.Pump;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.blocks;
|
|||||||
|
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
import io.anuke.mindustry.content.fx.BlockFx;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.distribution.WarpGate;
|
import io.anuke.mindustry.world.blocks.distribution.WarpGate;
|
||||||
import io.anuke.mindustry.world.blocks.power.*;
|
import io.anuke.mindustry.world.blocks.power.*;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
import io.anuke.mindustry.content.fx.BlockFx;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.production.Cultivator;
|
import io.anuke.mindustry.world.blocks.production.Cultivator;
|
||||||
import io.anuke.mindustry.world.blocks.production.Drill;
|
import io.anuke.mindustry.world.blocks.production.Drill;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package io.anuke.mindustry.content.blocks;
|
package io.anuke.mindustry.content.blocks;
|
||||||
|
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
||||||
import io.anuke.mindustry.world.blocks.storage.SortedUnloader;
|
import io.anuke.mindustry.world.blocks.storage.SortedUnloader;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
|||||||
import io.anuke.mindustry.content.AmmoTypes;
|
import io.anuke.mindustry.content.AmmoTypes;
|
||||||
import io.anuke.mindustry.content.fx.ShootFx;
|
import io.anuke.mindustry.content.fx.ShootFx;
|
||||||
import io.anuke.mindustry.type.AmmoType;
|
import io.anuke.mindustry.type.AmmoType;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.defense.turrets.*;
|
import io.anuke.mindustry.world.blocks.defense.turrets.*;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.blocks;
|
|||||||
|
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.UnitTypes;
|
import io.anuke.mindustry.content.UnitTypes;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.units.*;
|
import io.anuke.mindustry.world.blocks.units.*;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.anuke.mindustry.entities.bullet.ArtilleryBulletType;
|
|||||||
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
|
||||||
public class ArtilleryBullets extends BulletList implements ContentList{
|
public class ArtilleryBullets extends BulletList implements ContentList{
|
||||||
public static BulletType dense, plastic, plasticFrag, homing, incindiary, explosive, surge;
|
public static BulletType dense, plastic, plasticFrag, homing, incindiary, explosive, surge;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.bullets;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
|
||||||
public abstract class BulletList implements ContentList{
|
public abstract class BulletList implements ContentList{
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.anuke.mindustry.entities.bullet.BulletType;
|
|||||||
import io.anuke.mindustry.entities.bullet.FlakBulletType;
|
import io.anuke.mindustry.entities.bullet.FlakBulletType;
|
||||||
import io.anuke.mindustry.entities.effect.Lightning;
|
import io.anuke.mindustry.entities.effect.Lightning;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class FlakBullets extends BulletList implements ContentList{
|
public class FlakBullets extends BulletList implements ContentList{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import io.anuke.mindustry.entities.bullet.BulletType;
|
|||||||
import io.anuke.mindustry.entities.bullet.MissileBulletType;
|
import io.anuke.mindustry.entities.bullet.MissileBulletType;
|
||||||
import io.anuke.mindustry.entities.effect.Lightning;
|
import io.anuke.mindustry.entities.effect.Lightning;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.content.fx.BulletFx;
|
|||||||
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
|
||||||
public class StandardBullets extends BulletList implements ContentList{
|
public class StandardBullets extends BulletList implements ContentList{
|
||||||
public static BulletType copper, dense, thorium, homing, tracer, mechSmall, glaive;
|
public static BulletType copper, dense, thorium, homing, tracer, mechSmall, glaive;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import io.anuke.mindustry.entities.effect.Fire;
|
|||||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||||
import io.anuke.mindustry.entities.effect.Lightning;
|
import io.anuke.mindustry.entities.effect.Lightning;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.distribution.MassDriver.DriverBulletData;
|
import io.anuke.mindustry.world.blocks.distribution.MassDriver.DriverBulletData;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
|
||||||
public abstract class FxList implements ContentList{
|
public abstract class FxList implements ContentList{
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.content.fx;
|
|||||||
|
|
||||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package io.anuke.mindustry.core;
|
package io.anuke.mindustry.core;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.*;
|
||||||
import com.badlogic.gdx.utils.ObjectSet;
|
|
||||||
import com.badlogic.gdx.utils.OrderedMap;
|
|
||||||
import com.badlogic.gdx.utils.OrderedSet;
|
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.content.blocks.*;
|
import io.anuke.mindustry.content.blocks.*;
|
||||||
import io.anuke.mindustry.content.bullets.*;
|
import io.anuke.mindustry.content.bullets.*;
|
||||||
@@ -18,6 +15,8 @@ import io.anuke.mindustry.entities.effect.Puddle;
|
|||||||
import io.anuke.mindustry.entities.traits.TypeTrait;
|
import io.anuke.mindustry.entities.traits.TypeTrait;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
import io.anuke.mindustry.game.MappableContent;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.ColorMapper;
|
import io.anuke.mindustry.world.ColorMapper;
|
||||||
@@ -32,7 +31,8 @@ import io.anuke.ucore.util.Log;
|
|||||||
public class ContentLoader{
|
public class ContentLoader{
|
||||||
private static boolean loaded = false;
|
private static boolean loaded = false;
|
||||||
private static ObjectSet<Array<? extends Content>> contentSet = new OrderedSet<>();
|
private static ObjectSet<Array<? extends Content>> contentSet = new OrderedSet<>();
|
||||||
private static OrderedMap<String, Array<Content>> contentMap = new OrderedMap<>();
|
private static OrderedMap<ContentType, Array<Content>> contentMap = new OrderedMap<>();
|
||||||
|
private static ObjectMap<ContentType, ObjectMap<String, MappableContent>> contentNameMap = new ObjectMap<>();
|
||||||
private static ObjectSet<Consumer<Content>> initialization = new ObjectSet<>();
|
private static ObjectSet<Consumer<Content>> initialization = new ObjectSet<>();
|
||||||
private static ContentList[] content = {
|
private static ContentList[] content = {
|
||||||
//effects
|
//effects
|
||||||
@@ -107,19 +107,25 @@ public class ContentLoader{
|
|||||||
|
|
||||||
registerTypes();
|
registerTypes();
|
||||||
|
|
||||||
for(ContentList list : content){
|
for(io.anuke.mindustry.game.ContentList list : content){
|
||||||
list.load();
|
list.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ContentList list : content){
|
for(ContentList list : content){
|
||||||
if(list.getAll().size != 0){
|
if(list.getAll().size != 0){
|
||||||
String type = list.getAll().first().getContentTypeName();
|
ContentType type = list.getAll().first().getContentType();
|
||||||
|
|
||||||
if(!contentMap.containsKey(type)){
|
if(!contentMap.containsKey(type)){
|
||||||
contentMap.put(type, new Array<>());
|
contentMap.put(type, new Array<>());
|
||||||
|
contentNameMap.put(type, new ObjectMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
contentMap.get(type).addAll(list.getAll());
|
contentMap.get(type).addAll(list.getAll());
|
||||||
|
for(Content c : list.getAll()){
|
||||||
|
if(c instanceof MappableContent){
|
||||||
|
contentNameMap.get(type).put(((MappableContent) c).getContentName(), (MappableContent) c);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
contentSet.add(list.getAll());
|
contentSet.add(list.getAll());
|
||||||
}
|
}
|
||||||
@@ -157,10 +163,17 @@ public class ContentLoader{
|
|||||||
//TODO clear all content.
|
//TODO clear all content.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OrderedMap<String, Array<Content>> getContentMap(){
|
public static OrderedMap<ContentType, Array<Content>> getContentMap(){
|
||||||
return contentMap;
|
return contentMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MappableContent getByName(ContentType type, String name){
|
||||||
|
if(!contentNameMap.containsKey(type)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return contentNameMap.get(type).get(name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers sync IDs for all types of sync entities.
|
* Registers sync IDs for all types of sync entities.
|
||||||
* Do not register units here!
|
* Do not register units here!
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import io.anuke.mindustry.content.StatusEffects;
|
import io.anuke.mindustry.content.StatusEffects;
|
||||||
import io.anuke.mindustry.content.fx.BulletFx;
|
import io.anuke.mindustry.content.fx.BulletFx;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.type.StatusEffect;
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
@@ -69,8 +70,8 @@ public abstract class BulletType extends BaseBulletType<Bullet> implements Conte
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "bullettype";
|
return ContentType.bullet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.entities.traits.TypeTrait;
|
|||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.game.UnlockableContent;
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Weapon;
|
import io.anuke.mindustry.type.Weapon;
|
||||||
import io.anuke.mindustry.ui.ContentDisplay;
|
import io.anuke.mindustry.ui.ContentDisplay;
|
||||||
@@ -77,6 +78,11 @@ public class UnitType implements UnlockableContent{
|
|||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayInfo(Table table){
|
public void displayInfo(Table table){
|
||||||
ContentDisplay.displayUnit(table, this);
|
ContentDisplay.displayUnit(table, this);
|
||||||
@@ -104,8 +110,8 @@ public class UnitType implements UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "unit-type";
|
return ContentType.unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base interface for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}.
|
* Base interface for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}.
|
||||||
@@ -11,7 +12,7 @@ public interface Content{
|
|||||||
* Returns the type name of this piece of content.
|
* Returns the type name of this piece of content.
|
||||||
* This should return the same value for all instances of this content type.
|
* This should return the same value for all instances of this content type.
|
||||||
*/
|
*/
|
||||||
String getContentTypeName();
|
ContentType getContentType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all instances of this content.
|
* Returns a list of all instances of this content.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.ObjectMap;
|
|||||||
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.ucore.core.Events;
|
import io.anuke.ucore.core.Events;
|
||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ import static io.anuke.mindustry.Vars.debug;
|
|||||||
|
|
||||||
public class ContentDatabase{
|
public class ContentDatabase{
|
||||||
/** Maps unlockable type names to a set of unlocked content.*/
|
/** Maps unlockable type names to a set of unlocked content.*/
|
||||||
private ObjectMap<String, ObjectSet<String>> unlocked = new ObjectMap<>();
|
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
|
||||||
/** Whether unlockables have changed since the last save.*/
|
/** Whether unlockables have changed since the last save.*/
|
||||||
private boolean dirty;
|
private boolean dirty;
|
||||||
|
|
||||||
@@ -20,11 +21,11 @@ public class ContentDatabase{
|
|||||||
public boolean isUnlocked(UnlockableContent content){
|
public boolean isUnlocked(UnlockableContent content){
|
||||||
if(debug) return true;
|
if(debug) return true;
|
||||||
|
|
||||||
if(!unlocked.containsKey(content.getContentTypeName())){
|
if(!unlocked.containsKey(content.getContentType())){
|
||||||
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
unlocked.put(content.getContentType(), new ObjectSet<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectSet<String> set = unlocked.get(content.getContentTypeName());
|
ObjectSet<String> set = unlocked.get(content.getContentType());
|
||||||
|
|
||||||
return set.contains(content.getContentName());
|
return set.contains(content.getContentName());
|
||||||
}
|
}
|
||||||
@@ -39,11 +40,11 @@ public class ContentDatabase{
|
|||||||
public boolean unlockContent(UnlockableContent content){
|
public boolean unlockContent(UnlockableContent content){
|
||||||
if(!content.canBeUnlocked()) return false;
|
if(!content.canBeUnlocked()) return false;
|
||||||
|
|
||||||
if(!unlocked.containsKey(content.getContentTypeName())){
|
if(!unlocked.containsKey(content.getContentType())){
|
||||||
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
unlocked.put(content.getContentType(), new ObjectSet<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ret = unlocked.get(content.getContentTypeName()).add(content.getContentName());
|
boolean ret = unlocked.get(content.getContentType()).add(content.getContentName());
|
||||||
|
|
||||||
//fire unlock event so other classes can use it
|
//fire unlock event so other classes can use it
|
||||||
if(ret){
|
if(ret){
|
||||||
@@ -67,9 +68,9 @@ public class ContentDatabase{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void load(){
|
public void load(){
|
||||||
ObjectMap<String, Array<String>> result = Settings.getJson("content-database", ObjectMap.class);
|
ObjectMap<ContentType, Array<String>> result = Settings.getJson("content-database", ObjectMap.class);
|
||||||
|
|
||||||
for(Entry<String, Array<String>> entry : result.entries()){
|
for(Entry<ContentType, Array<String>> entry : result.entries()){
|
||||||
ObjectSet<String> set = new ObjectSet<>();
|
ObjectSet<String> set = new ObjectSet<>();
|
||||||
set.addAll(entry.value);
|
set.addAll(entry.value);
|
||||||
unlocked.put(entry.key, set);
|
unlocked.put(entry.key, set);
|
||||||
@@ -80,9 +81,9 @@ public class ContentDatabase{
|
|||||||
|
|
||||||
public void save(){
|
public void save(){
|
||||||
|
|
||||||
ObjectMap<String, Array<String>> write = new ObjectMap<>();
|
ObjectMap<ContentType, Array<String>> write = new ObjectMap<>();
|
||||||
|
|
||||||
for(Entry<String, ObjectSet<String>> entry : unlocked.entries()){
|
for(Entry<ContentType, ObjectSet<String>> entry : unlocked.entries()){
|
||||||
write.put(entry.key, entry.value.iterator().toArray());
|
write.put(entry.key, entry.value.iterator().toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
core/src/io/anuke/mindustry/game/ContentList.java
Normal file
12
core/src/io/anuke/mindustry/game/ContentList.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
|
/**Interface for a list of content to be loaded in {@link io.anuke.mindustry.core.ContentLoader}.*/
|
||||||
|
public interface ContentList{
|
||||||
|
/**This method should create all the content.*/
|
||||||
|
void load();
|
||||||
|
|
||||||
|
/**This method should return the list of the content of this type, for further loading.*/
|
||||||
|
Array<? extends Content> getAll();
|
||||||
|
}
|
||||||
13
core/src/io/anuke/mindustry/game/MappableContent.java
Normal file
13
core/src/io/anuke/mindustry/game/MappableContent.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
public interface 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.
|
||||||
|
* (e.g. having a recipe and a block, both with name "wall" is fine, as they are different types).
|
||||||
|
*/
|
||||||
|
String getContentName();
|
||||||
|
|
||||||
|
int getID();
|
||||||
|
}
|
||||||
@@ -5,54 +5,31 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.control;
|
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 MappableContent{
|
||||||
*/
|
/**Returns the localized name of this content.*/
|
||||||
public interface UnlockableContent 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.
|
|
||||||
* (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.
|
|
||||||
*/
|
|
||||||
String localizedName();
|
String localizedName();
|
||||||
|
|
||||||
TextureRegion getContentIcon();
|
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);
|
void displayInfo(Table table);
|
||||||
|
|
||||||
/**
|
/**Called when this content is unlocked. Use this to unlock other related content.*/
|
||||||
* Called when this content is unlocked. Use this to unlock other related content.
|
|
||||||
*/
|
|
||||||
default void onUnlock(){
|
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(){
|
default boolean isHidden(){
|
||||||
return false;
|
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(){
|
default UnlockableContent[] getDependencies(){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**Returns whether dependencies are satisfied for unlocking this content.*/
|
||||||
* Returns whether dependencies are satisfied for unlocking this content.
|
|
||||||
*/
|
|
||||||
default boolean canBeUnlocked(){
|
default boolean canBeUnlocked(){
|
||||||
UnlockableContent[] depend = getDependencies();
|
UnlockableContent[] depend = getDependencies();
|
||||||
if(depend == null){
|
if(depend == null){
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
package io.anuke.mindustry.io;
|
package io.anuke.mindustry.io;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import com.badlogic.gdx.utils.IntMap;
|
||||||
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
|
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
||||||
|
import io.anuke.mindustry.core.ContentLoader;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.Difficulty;
|
import io.anuke.mindustry.game.Difficulty;
|
||||||
|
import io.anuke.mindustry.game.MappableContent;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -25,6 +33,50 @@ public abstract class SaveFileVersion{
|
|||||||
return new SaveMeta(version, time, playtime, build, sector, mode, map, wave, Difficulty.values()[difficulty]);
|
return new SaveMeta(version, time, playtime, build, sector, mode, map, wave, Difficulty.values()[difficulty]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ObjectMap<ContentType, IntMap<MappableContent>> readContentHeader(DataInputStream stream) throws IOException{
|
||||||
|
ObjectMap<ContentType, IntMap<MappableContent>> map = new ObjectMap<>();
|
||||||
|
|
||||||
|
byte mapped = stream.readByte();
|
||||||
|
for (int i = 0; i < mapped; i++) {
|
||||||
|
ContentType type = ContentType.values()[stream.readByte()];
|
||||||
|
map.put(type, new IntMap<>());
|
||||||
|
short total = stream.readShort();
|
||||||
|
for (int j = 0; j < total; j++) {
|
||||||
|
byte id = stream.readByte();
|
||||||
|
String name = stream.readUTF();
|
||||||
|
if(ContentLoader.getContentMap().get(type).size == 0) continue;
|
||||||
|
map.get(type).put(id, ContentLoader.getByName(type, name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeContentHeader(DataOutputStream stream) throws IOException{
|
||||||
|
ObjectMap<ContentType, Array<Content>> map = ContentLoader.getContentMap();
|
||||||
|
|
||||||
|
int mappable = 0;
|
||||||
|
for(Entry<ContentType, Array<Content>> entry : map.entries()){
|
||||||
|
if(entry.value.size > 0 && entry.value.first() instanceof MappableContent){
|
||||||
|
mappable ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.writeByte(mappable);
|
||||||
|
for(Entry<ContentType, Array<Content>> entry : map.entries()){
|
||||||
|
if(entry.value.size > 0 && entry.value.first() instanceof MappableContent){
|
||||||
|
stream.writeByte(entry.value.first().getContentType().ordinal());
|
||||||
|
stream.writeShort(entry.value.size);
|
||||||
|
for(Content c : entry.value){
|
||||||
|
MappableContent m = (MappableContent)c;
|
||||||
|
if(m.getID() >= 128) throw new RuntimeException("Content " + c + " has ID > 127!");
|
||||||
|
stream.writeByte(m.getID());
|
||||||
|
stream.writeUTF(m.getContentName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void read(DataInputStream stream) throws IOException;
|
public abstract void read(DataInputStream stream) throws IOException;
|
||||||
|
|
||||||
public abstract void write(DataOutputStream stream) throws IOException;
|
public abstract void write(DataOutputStream stream) throws IOException;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
package io.anuke.mindustry.io.versions;
|
package io.anuke.mindustry.io.versions;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.IntMap;
|
||||||
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||||
import io.anuke.mindustry.entities.traits.SaveTrait;
|
import io.anuke.mindustry.entities.traits.SaveTrait;
|
||||||
import io.anuke.mindustry.entities.traits.TypeTrait;
|
import io.anuke.mindustry.entities.traits.TypeTrait;
|
||||||
import io.anuke.mindustry.game.Difficulty;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.GameMode;
|
|
||||||
import io.anuke.mindustry.game.Team;
|
|
||||||
import io.anuke.mindustry.game.Version;
|
|
||||||
import io.anuke.mindustry.io.SaveFileVersion;
|
import io.anuke.mindustry.io.SaveFileVersion;
|
||||||
import io.anuke.mindustry.maps.Map;
|
import io.anuke.mindustry.maps.Map;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.BlockPart;
|
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
@@ -56,6 +56,9 @@ public class Save16 extends SaveFileVersion{
|
|||||||
state.wave = wave;
|
state.wave = wave;
|
||||||
state.wavetime = wavetime;
|
state.wavetime = wavetime;
|
||||||
|
|
||||||
|
ObjectMap<ContentType, IntMap<MappableContent>> contentMap = readContentHeader(stream);
|
||||||
|
//TODO implement
|
||||||
|
|
||||||
state.spawner.read(stream);
|
state.spawner.read(stream);
|
||||||
|
|
||||||
//entities
|
//entities
|
||||||
@@ -168,7 +171,9 @@ public class Save16 extends SaveFileVersion{
|
|||||||
stream.writeByte(state.difficulty.ordinal()); //difficulty ordinal
|
stream.writeByte(state.difficulty.ordinal()); //difficulty ordinal
|
||||||
stream.writeFloat(state.wavetime); //wave countdown
|
stream.writeFloat(state.wavetime); //wave countdown
|
||||||
|
|
||||||
state.spawner.write(stream);
|
writeContentHeader(stream);
|
||||||
|
|
||||||
|
state.spawner.write(stream); //spawnes
|
||||||
|
|
||||||
//--ENTITIES--
|
//--ENTITIES--
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.anuke.mindustry.entities.bullet.BulletType;
|
|||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
|
|
||||||
public class AmmoType implements Content{
|
public class AmmoType implements Content {
|
||||||
private static int lastID = 0;
|
private static int lastID = 0;
|
||||||
private static Array<AmmoType> allTypes = new Array<>(32);
|
private static Array<AmmoType> allTypes = new Array<>(32);
|
||||||
|
|
||||||
@@ -85,8 +85,8 @@ public class AmmoType implements Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "ammotype";
|
return ContentType.ammo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package io.anuke.mindustry.type;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
|
||||||
import io.anuke.mindustry.game.Content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for a list of content to be loaded in {@link io.anuke.mindustry.core.ContentLoader}.
|
|
||||||
*/
|
|
||||||
public interface ContentList{
|
|
||||||
/**
|
|
||||||
* This method should create all the content.
|
|
||||||
*/
|
|
||||||
void load();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should return the list of the content of this type, for further loading.
|
|
||||||
*/
|
|
||||||
Array<? extends Content> getAll();
|
|
||||||
}
|
|
||||||
16
core/src/io/anuke/mindustry/type/ContentType.java
Normal file
16
core/src/io/anuke/mindustry/type/ContentType.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package io.anuke.mindustry.type;
|
||||||
|
|
||||||
|
/**Do not rearrange, ever!*/
|
||||||
|
public enum ContentType {
|
||||||
|
item,
|
||||||
|
recipe,
|
||||||
|
block,
|
||||||
|
mech,
|
||||||
|
bullet,
|
||||||
|
liquid,
|
||||||
|
weapon,
|
||||||
|
status,
|
||||||
|
unit,
|
||||||
|
ammo,
|
||||||
|
weather
|
||||||
|
}
|
||||||
@@ -69,6 +69,11 @@ public class Item implements Comparable<Item>, UnlockableContent{
|
|||||||
this.region = Draw.region("item-" + name);
|
this.region = Draw.region("item-" + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayInfo(Table table){
|
public void displayInfo(Table table){
|
||||||
ContentDisplay.displayItem(table, this);
|
ContentDisplay.displayItem(table, this);
|
||||||
@@ -100,8 +105,8 @@ public class Item implements Comparable<Item>, UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "item";
|
return ContentType.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ public class Liquid implements UnlockableContent{
|
|||||||
return liquids.get(id);
|
return liquids.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
iconRegion = Draw.region("liquid-icon-" + name);
|
iconRegion = Draw.region("liquid-icon-" + name);
|
||||||
@@ -110,8 +115,8 @@ public class Liquid implements UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "liquid";
|
return ContentType.liquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ public class Mech implements UnlockableContent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
return !flying && mobile;
|
return !flying && mobile;
|
||||||
@@ -108,8 +113,8 @@ public class Mech implements UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "mech";
|
return ContentType.mech;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ public class Recipe implements UnlockableContent{
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHidden(){
|
public boolean isHidden(){
|
||||||
return debugOnly || (desktopOnly && mobile);
|
return debugOnly || (desktopOnly && mobile);
|
||||||
@@ -154,8 +159,8 @@ public class Recipe implements UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "recipe";
|
return ContentType.recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ public class StatusEffect implements Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "statuseffect";
|
return ContentType.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ public class Weapon implements Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "weapon";
|
return ContentType.weapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ public class WeatherEvent implements Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "weatherevent";
|
return ContentType.weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.mindustry.core.ContentLoader;
|
|||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.UnlockableContent;
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.ucore.scene.event.HandCursorListener;
|
import io.anuke.ucore.scene.event.HandCursorListener;
|
||||||
import io.anuke.ucore.scene.ui.Image;
|
import io.anuke.ucore.scene.ui.Image;
|
||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
@@ -34,9 +35,9 @@ public class UnlocksDialog extends FloatingDialog{
|
|||||||
table.margin(20);
|
table.margin(20);
|
||||||
ScrollPane pane = new ScrollPane(table, "clear-black");
|
ScrollPane pane = new ScrollPane(table, "clear-black");
|
||||||
|
|
||||||
OrderedMap<String, Array<Content>> allContent = ContentLoader.getContentMap();
|
OrderedMap<ContentType, Array<Content>> allContent = ContentLoader.getContentMap();
|
||||||
|
|
||||||
for(String key : allContent.orderedKeys()){
|
for(ContentType key : allContent.orderedKeys()){
|
||||||
Array<Content> array = allContent.get(key);
|
Array<Content> array = allContent.get(key);
|
||||||
if(array.size == 0 || !(array.first() instanceof UnlockableContent)) continue;
|
if(array.size == 0 || !(array.first() instanceof UnlockableContent)) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ import io.anuke.mindustry.entities.bullet.Bullet;
|
|||||||
import io.anuke.mindustry.entities.effect.Puddle;
|
import io.anuke.mindustry.entities.effect.Puddle;
|
||||||
import io.anuke.mindustry.entities.effect.RubbleDecal;
|
import io.anuke.mindustry.entities.effect.RubbleDecal;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.game.MappableContent;
|
||||||
import io.anuke.mindustry.game.UnlockableContent;
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
import io.anuke.mindustry.graphics.CacheLayer;
|
import io.anuke.mindustry.graphics.CacheLayer;
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.input.CursorType;
|
import io.anuke.mindustry.input.CursorType;
|
||||||
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.meta.*;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
@@ -32,7 +34,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Block extends BaseBlock implements Content{
|
public class Block extends BaseBlock implements MappableContent {
|
||||||
private static int lastid;
|
private static int lastid;
|
||||||
private static Array<Block> blocks = new Array<>(140);
|
private static Array<Block> blocks = new Array<>(140);
|
||||||
private static ObjectMap<String, Block> map = new ObjectMap<>();
|
private static ObjectMap<String, Block> map = new ObjectMap<>();
|
||||||
@@ -209,6 +211,16 @@ public class Block extends BaseBlock implements Content{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContentName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
/** Called after all blocks are created. */
|
/** Called after all blocks are created. */
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
@@ -495,8 +507,8 @@ public class Block extends BaseBlock implements Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName(){
|
public ContentType getContentType(){
|
||||||
return "block";
|
return ContentType.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.badlogic.gdx.utils.IntMap;
|
|||||||
import com.badlogic.gdx.utils.ObjectIntMap;
|
import com.badlogic.gdx.utils.ObjectIntMap;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class ColorMapper implements ContentList{
|
public class ColorMapper implements ContentList{
|
||||||
|
|||||||
Reference in New Issue
Block a user