Memory optimizations, multithreading fixes, uCore updated
This commit is contained in:
@@ -27,7 +27,7 @@ allprojects {
|
|||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = '8a2faf0'
|
uCoreVersion = '32c8405'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
|
|||||||
BIN
core/assets-raw/sprites/blocks/extra/shadow-6.png
Normal file
BIN
core/assets-raw/sprites/blocks/extra/shadow-6.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 112 KiB |
@@ -2,6 +2,7 @@ package io.anuke.mindustry;
|
|||||||
|
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.io.BundleLoader;
|
import io.anuke.mindustry.io.BundleLoader;
|
||||||
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.modules.ModuleCore;
|
import io.anuke.ucore.modules.ModuleCore;
|
||||||
import io.anuke.ucore.util.Log;
|
import io.anuke.ucore.util.Log;
|
||||||
|
|
||||||
@@ -15,10 +16,14 @@ public class Mindustry extends ModuleCore {
|
|||||||
|
|
||||||
debug = Platform.instance.isDebug();
|
debug = Platform.instance.isDebug();
|
||||||
|
|
||||||
|
Timers.mark();
|
||||||
|
|
||||||
Log.setUseColors(false);
|
Log.setUseColors(false);
|
||||||
BundleLoader.load();
|
BundleLoader.load();
|
||||||
ContentLoader.load();
|
ContentLoader.load();
|
||||||
|
|
||||||
|
Log.info("Time to load content: {0}", Timers.elapsed());
|
||||||
|
|
||||||
module(logic = new Logic());
|
module(logic = new Logic());
|
||||||
module(world = new World());
|
module(world = new World());
|
||||||
module(control = new Control());
|
module(control = new Control());
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import io.anuke.ucore.util.OS;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Vars{
|
public class Vars{
|
||||||
public static final boolean testMobile = true;
|
public static final boolean testMobile = false;
|
||||||
//shorthand for whether or not this is running on android or ios
|
//shorthand for whether or not this is running on android or ios
|
||||||
public static boolean mobile;
|
public static boolean mobile;
|
||||||
public static boolean ios;
|
public static boolean ios;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.bullets.*;
|
import io.anuke.mindustry.content.bullets.*;
|
||||||
import io.anuke.mindustry.content.fx.ShootFx;
|
import io.anuke.mindustry.content.fx.ShootFx;
|
||||||
|
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.type.ContentList;
|
||||||
|
|
||||||
@@ -160,4 +162,9 @@ public class AmmoTypes implements ContentList {
|
|||||||
cryofluid = new AmmoType(Liquids.cryofluid, TurretBullets.cryoShot, 0.3f);
|
cryofluid = new AmmoType(Liquids.cryofluid, TurretBullets.cryoShot, 0.3f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return AmmoType.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.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;
|
||||||
@@ -80,4 +82,9 @@ public class Items implements ContentList{
|
|||||||
explosiveness = 0.2f;
|
explosiveness = 0.2f;
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Item.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
|
|
||||||
@@ -43,6 +45,10 @@ public class Liquids implements ContentList {
|
|||||||
effect = StatusEffects.freezing;
|
effect = StatusEffects.freezing;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Liquid.all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
import io.anuke.mindustry.type.Mech;
|
import io.anuke.mindustry.type.Mech;
|
||||||
|
import io.anuke.mindustry.type.Upgrade;
|
||||||
|
|
||||||
public class Mechs implements ContentList {
|
public class Mechs implements ContentList {
|
||||||
public static Mech standard, standardShip;
|
public static Mech standard, standardShip;
|
||||||
@@ -17,4 +20,9 @@ public class Mechs implements ContentList {
|
|||||||
drillPower = 1;
|
drillPower = 1;
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Upgrade.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
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.type.ContentList;
|
import io.anuke.mindustry.type.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;
|
||||||
@@ -127,4 +129,9 @@ public class Recipes implements ContentList{
|
|||||||
new Recipe(units, DebugBlocks.powerVoid, new ItemStack(Items.steel, 10)).setDebug();
|
new Recipe(units, DebugBlocks.powerVoid, new ItemStack(Items.steel, 10)).setDebug();
|
||||||
new Recipe(units, DebugBlocks.powerInfinite, new ItemStack(Items.steel, 10), new ItemStack(Items.surgealloy, 5)).setDebug();
|
new Recipe(units, DebugBlocks.powerInfinite, new ItemStack(Items.steel, 10), new ItemStack(Items.surgealloy, 5)).setDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Recipe.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.fx.EnvironmentFx;
|
import io.anuke.mindustry.content.fx.EnvironmentFx;
|
||||||
import io.anuke.mindustry.entities.StatusController.TransitionResult;
|
import io.anuke.mindustry.entities.StatusController.TransitionResult;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.StatusEffect;
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
@@ -124,4 +126,9 @@ public class StatusEffects implements ContentList {
|
|||||||
freezing.setOpposites(burning, melting);
|
freezing.setOpposites(burning, melting);
|
||||||
burning.setOpposites(wet, freezing);
|
burning.setOpposites(wet, freezing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return StatusEffect.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
import io.anuke.mindustry.entities.units.types.Drone;
|
import io.anuke.mindustry.entities.units.types.Drone;
|
||||||
import io.anuke.mindustry.entities.units.types.Scout;
|
import io.anuke.mindustry.entities.units.types.Scout;
|
||||||
import io.anuke.mindustry.entities.units.types.Vtol;
|
import io.anuke.mindustry.entities.units.types.Vtol;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
|
|
||||||
public class UnitTypes implements ContentList {
|
public class UnitTypes implements ContentList {
|
||||||
public static UnitType drone, scout, vtol;
|
public static UnitType drone, scout, vtol;
|
||||||
@@ -36,4 +39,9 @@ public class UnitTypes implements ContentList {
|
|||||||
setAmmo(AmmoTypes.bulletIron);
|
setAmmo(AmmoTypes.bulletIron);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return StatusEffect.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.fx.ShootFx;
|
import io.anuke.mindustry.content.fx.ShootFx;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
import io.anuke.mindustry.type.Upgrade;
|
||||||
import io.anuke.mindustry.type.Weapon;
|
import io.anuke.mindustry.type.Weapon;
|
||||||
|
|
||||||
public class Weapons implements ContentList {
|
public class Weapons implements ContentList {
|
||||||
@@ -18,4 +21,9 @@ public class Weapons implements ContentList {
|
|||||||
setAmmo(AmmoTypes.bulletIron);
|
setAmmo(AmmoTypes.bulletIron);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Upgrade.all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
core/src/io/anuke/mindustry/content/blocks/BlockList.java
Normal file
14
core/src/io/anuke/mindustry/content/blocks/BlockList.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package io.anuke.mindustry.content.blocks;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
import io.anuke.mindustry.world.Block;
|
||||||
|
|
||||||
|
public abstract class BlockList implements ContentList {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Block.all();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import io.anuke.mindustry.world.Block;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.*;
|
import io.anuke.mindustry.world.blocks.types.*;
|
||||||
|
|
||||||
public class Blocks implements ContentList{
|
public class Blocks extends BlockList implements ContentList{
|
||||||
public static Block air, spawn, blockpart, build1, build2, build3, build4, build5, build6, defaultFloor, space, metalfloor, deepwater, water, lava, oil, stone, blackstone, iron, lead, coal, titanium, thorium, dirt, sand, ice, snow, grass, sandblock, snowblock, stoneblock, blackstoneblock, grassblock, mossblock, shrub, rock, icerock, blackrock, dirtblock;
|
public static Block air, spawn, blockpart, build1, build2, build3, build4, build5, build6, defaultFloor, space, metalfloor, deepwater, water, lava, oil, stone, blackstone, iron, lead, coal, titanium, thorium, dirt, sand, ice, snow, grass, sandblock, snowblock, stoneblock, blackstoneblock, grassblock, mossblock, shrub, rock, icerock, blackrock, dirtblock;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.mindustry.type.ItemStack;
|
|||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.types.production.*;
|
import io.anuke.mindustry.world.blocks.types.production.*;
|
||||||
|
|
||||||
public class CraftingBlocks implements ContentList {
|
public class CraftingBlocks extends BlockList implements ContentList {
|
||||||
public static Block smelter, alloysmelter, siliconsmelter, poweralloysmelter, powersmelter, cryofluidmixer, melter, separator, centrifuge, plasticFormer, biomatterCompressor, pulverizer, oilRefinery, stoneFormer, weaponFactory, incinerator;
|
public static Block smelter, alloysmelter, siliconsmelter, poweralloysmelter, powersmelter, cryofluidmixer, melter, separator, centrifuge, plasticFormer, biomatterCompressor, pulverizer, oilRefinery, stoneFormer, weaponFactory, incinerator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class DebugBlocks implements ContentList{
|
public class DebugBlocks extends BlockList implements ContentList{
|
||||||
public static Block powerVoid, powerInfinite, itemSource, liquidSource, itemVoid;
|
public static Block powerVoid, powerInfinite, itemSource, liquidSource, itemVoid;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import io.anuke.mindustry.world.blocks.types.Wall;
|
|||||||
import io.anuke.mindustry.world.blocks.types.defense.Door;
|
import io.anuke.mindustry.world.blocks.types.defense.Door;
|
||||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldedWallBlock;
|
import io.anuke.mindustry.world.blocks.types.defense.ShieldedWallBlock;
|
||||||
|
|
||||||
public class DefenseBlocks implements ContentList {
|
public class DefenseBlocks extends BlockList implements ContentList {
|
||||||
public static Block stonewall, ironwall, steelwall, titaniumwall, diriumwall, compositewall, steelwalllarge, titaniumwalllarge, diriumwalllarge, titaniumshieldwall, door, largedoor;
|
public static Block stonewall, ironwall, steelwall, titaniumwall, diriumwall, compositewall, steelwalllarge, titaniumwalllarge, diriumwalllarge, titaniumshieldwall, door, largedoor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import io.anuke.mindustry.type.ContentList;
|
|||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
||||||
|
|
||||||
public class DistributionBlocks implements ContentList{
|
public class DistributionBlocks extends BlockList implements ContentList{
|
||||||
public static Block conveyor, steelconveyor, pulseconveyor, router, multiplexer, junction, bridgeconveyor, laserconveyor, sorter, splitter, overflowgate;
|
public static Block conveyor, steelconveyor, pulseconveyor, router, multiplexer, junction, bridgeconveyor, laserconveyor, sorter, splitter, overflowgate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.world.Block;
|
|||||||
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
||||||
import io.anuke.mindustry.world.blocks.types.production.Pump;
|
import io.anuke.mindustry.world.blocks.types.production.Pump;
|
||||||
|
|
||||||
public class LiquidBlocks implements ContentList{
|
public class LiquidBlocks extends BlockList implements ContentList{
|
||||||
public static Block pump, fluxpump, conduit, pulseconduit, liquidrouter, liquidtank, liquidjunction, bridgeconduit, laserconduit;
|
public static Block pump, fluxpump, conduit, pulseconduit, liquidrouter, liquidtank, liquidjunction, bridgeconduit, laserconduit;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
|
|||||||
import io.anuke.mindustry.world.blocks.types.distribution.Teleporter;
|
import io.anuke.mindustry.world.blocks.types.distribution.Teleporter;
|
||||||
import io.anuke.mindustry.world.blocks.types.power.*;
|
import io.anuke.mindustry.world.blocks.types.power.*;
|
||||||
|
|
||||||
public class PowerBlocks implements ContentList {
|
public class PowerBlocks extends BlockList implements ContentList {
|
||||||
public static Block combustiongenerator, thermalgenerator, liquidcombustiongenerator, rtgenerator, solarpanel, largesolarpanel, nuclearReactor, fusionReactor, repairturret, megarepairturret, shieldgenerator, battery, batteryLarge, powernode, powernodelarge, teleporter;
|
public static Block combustiongenerator, thermalgenerator, liquidcombustiongenerator, rtgenerator, solarpanel, largesolarpanel, nuclearReactor, fusionReactor, repairturret, megarepairturret, shieldgenerator, battery, batteryLarge, powernode, powernodelarge, teleporter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -95,7 +95,7 @@ public class PowerBlocks implements ContentList {
|
|||||||
powerSpeed = 1f;
|
powerSpeed = 1f;
|
||||||
maxNodes = 5;
|
maxNodes = 5;
|
||||||
laserRange = 7.5f;
|
laserRange = 7.5f;
|
||||||
shadow = "powernodelarge-shadow";
|
shadow = "shadow-round-2";
|
||||||
}};
|
}};
|
||||||
|
|
||||||
teleporter = new Teleporter("teleporter");
|
teleporter = new Teleporter("teleporter");
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.anuke.mindustry.world.blocks.types.production.Drill;
|
|||||||
import io.anuke.mindustry.world.blocks.types.production.Fracker;
|
import io.anuke.mindustry.world.blocks.types.production.Fracker;
|
||||||
import io.anuke.mindustry.world.blocks.types.production.SolidPump;
|
import io.anuke.mindustry.world.blocks.types.production.SolidPump;
|
||||||
|
|
||||||
public class ProductionBlocks implements ContentList {
|
public class ProductionBlocks extends BlockList implements ContentList {
|
||||||
public static Block ironDrill, reinforcedDrill, steelDrill, titaniumDrill, laserdrill, nucleardrill, plasmadrill, waterextractor, oilextractor, cultivator;
|
public static Block ironDrill, reinforcedDrill, steelDrill, titaniumDrill, laserdrill, nucleardrill, plasmadrill, waterextractor, oilextractor, cultivator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import io.anuke.mindustry.world.blocks.types.storage.SortedUnloader;
|
|||||||
import io.anuke.mindustry.world.blocks.types.storage.Unloader;
|
import io.anuke.mindustry.world.blocks.types.storage.Unloader;
|
||||||
import io.anuke.mindustry.world.blocks.types.storage.Vault;
|
import io.anuke.mindustry.world.blocks.types.storage.Vault;
|
||||||
|
|
||||||
public class StorageBlocks implements ContentList {
|
public class StorageBlocks extends BlockList implements ContentList {
|
||||||
public static Block core, vault, unloader, sortedunloader;
|
public static Block core, vault, unloader, sortedunloader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.mindustry.world.blocks.types.units.RepairPoint;
|
|||||||
import io.anuke.mindustry.world.blocks.types.units.ResupplyPoint;
|
import io.anuke.mindustry.world.blocks.types.units.ResupplyPoint;
|
||||||
import io.anuke.mindustry.world.blocks.types.units.UnitFactory;
|
import io.anuke.mindustry.world.blocks.types.units.UnitFactory;
|
||||||
|
|
||||||
public class UnitBlocks implements ContentList {
|
public class UnitBlocks extends BlockList implements ContentList {
|
||||||
public static Block resupplyPoint, repairPoint, droneFactory, dropPoint;
|
public static Block resupplyPoint, repairPoint, droneFactory, dropPoint;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import io.anuke.ucore.util.Angles;
|
|||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
public class WeaponBlocks implements ContentList {
|
public class WeaponBlocks extends BlockList implements ContentList {
|
||||||
public static Block duo, scatter, scorch, hail, wave, crux, lancer, arc, swarmer, ripple, cyclone, fuse, spectre, eraser, meltdown;
|
public static Block duo, scatter, scorch, hail, wave, crux, lancer, arc, swarmer, ripple, cyclone, fuse, spectre, eraser, meltdown;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,80 +5,74 @@ 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.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
public class ArtilleryBullets implements ContentList{
|
public class ArtilleryBullets extends BulletList implements ContentList{
|
||||||
public static BulletType lead, thorium, plastic, homing, incindiary, surge;
|
public static BulletType lead, thorium, plastic, homing, incindiary, surge;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
lead = new BasicBulletType(3f, 0) {
|
lead = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
thorium = new BasicBulletType(3f, 0) {
|
thorium = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
plastic = new BasicBulletType(3f, 0) {
|
plastic = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
homing = new BasicBulletType(3f, 0) {
|
homing = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
incindiary = new BasicBulletType(3f, 0) {
|
incindiary = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
surge = new BasicBulletType(3f, 0) {
|
surge = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
lifetime = 90f;
|
lifetime = 90f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
14
core/src/io/anuke/mindustry/content/bullets/BulletList.java
Normal file
14
core/src/io/anuke/mindustry/content/bullets/BulletList.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package io.anuke.mindustry.content.bullets;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
|
public abstract class BulletList implements ContentList {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return BulletType.all();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,34 +4,34 @@ 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.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
public class FlakBullets implements ContentList {
|
public class FlakBullets extends BulletList implements ContentList {
|
||||||
public static BulletType lead, plastic, explosive, surge;
|
public static BulletType lead, plastic, explosive, surge;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
lead = new BasicBulletType(3f, 5) {
|
lead = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
plastic = new BasicBulletType(3f, 5) {
|
plastic = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
explosive = new BasicBulletType(3f, 5) {
|
explosive = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
surge = new BasicBulletType(3f, 5) {
|
surge = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
|
|||||||
@@ -4,27 +4,27 @@ 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.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
public class MissileBullets implements ContentList {
|
public class MissileBullets extends BulletList implements ContentList {
|
||||||
public static BulletType explosive, incindiary, surge;
|
public static BulletType explosive, incindiary, surge;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
explosive = new BasicBulletType(3f, 5) {
|
explosive = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
incindiary = new BasicBulletType(3f, 5) {
|
incindiary = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
surge = new BasicBulletType(3f, 5) {
|
surge = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ 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.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
public class ShellBullets implements ContentList {
|
public class ShellBullets extends BulletList implements ContentList {
|
||||||
public static BulletType lead, leadShard, thorium, thoriumShard, plastic, plasticShard, explosive, explosiveShard, incindiary;
|
public static BulletType lead, leadShard, thorium, thoriumShard, plastic, plasticShard, explosive, explosiveShard, incindiary;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
lead = new BasicBulletType(3f, 0) {
|
lead = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
@@ -20,12 +20,11 @@ public class ShellBullets implements ContentList {
|
|||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
fragBullet = leadShard;
|
fragBullet = leadShard;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
leadShard = new BasicBulletType(3f, 0) {
|
leadShard = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
hiteffect = Fx.none;
|
hiteffect = Fx.none;
|
||||||
@@ -38,7 +37,7 @@ public class ShellBullets implements ContentList {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
thorium = new BasicBulletType(3f, 0) {
|
thorium = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
@@ -46,12 +45,11 @@ public class ShellBullets implements ContentList {
|
|||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
fragBullet = leadShard;
|
fragBullet = leadShard;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
thoriumShard = new BasicBulletType(3f, 0) {
|
thoriumShard = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
hiteffect = Fx.none;
|
hiteffect = Fx.none;
|
||||||
@@ -64,7 +62,7 @@ public class ShellBullets implements ContentList {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
plastic = new BasicBulletType(3f, 0) {
|
plastic = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
@@ -72,12 +70,11 @@ public class ShellBullets implements ContentList {
|
|||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
fragBullet = leadShard;
|
fragBullet = leadShard;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
plasticShard = new BasicBulletType(3f, 0) {
|
plasticShard = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
hiteffect = Fx.none;
|
hiteffect = Fx.none;
|
||||||
@@ -90,7 +87,7 @@ public class ShellBullets implements ContentList {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
explosive = new BasicBulletType(3f, 0) {
|
explosive = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
@@ -98,12 +95,11 @@ public class ShellBullets implements ContentList {
|
|||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
fragBullet = leadShard;
|
fragBullet = leadShard;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
explosiveShard = new BasicBulletType(3f, 0) {
|
explosiveShard = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
hiteffect = Fx.none;
|
hiteffect = Fx.none;
|
||||||
@@ -116,7 +112,7 @@ public class ShellBullets implements ContentList {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
incindiary = new BasicBulletType(3f, 0) {
|
incindiary = new BasicBulletType(3f, 0, "shell") {
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.flakExplosion;
|
hiteffect = BulletFx.flakExplosion;
|
||||||
knockback = 0.8f;
|
knockback = 0.8f;
|
||||||
@@ -124,7 +120,6 @@ public class ShellBullets implements ContentList {
|
|||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
bulletWidth = bulletHeight = 9f;
|
bulletWidth = bulletHeight = 9f;
|
||||||
fragBullet = leadShard;
|
fragBullet = leadShard;
|
||||||
bulletSprite = "frag";
|
|
||||||
bulletShrink = 0.1f;
|
bulletShrink = 0.1f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,48 +4,48 @@ 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.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
public class StandardBullets implements ContentList {
|
public class StandardBullets extends BulletList implements ContentList {
|
||||||
public static BulletType iron, lead, steel, thorium, homing, tracer;
|
public static BulletType iron, lead, steel, thorium, homing, tracer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
iron = new BasicBulletType(3f, 5) {
|
iron = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
lead = new BasicBulletType(3f, 5) {
|
lead = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
steel = new BasicBulletType(3f, 5) {
|
steel = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
thorium = new BasicBulletType(3f, 5) {
|
thorium = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
homing = new BasicBulletType(3f, 5) {
|
homing = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tracer = new BasicBulletType(3f, 5) {
|
tracer = new BasicBulletType(3f, 5, "bullet") {
|
||||||
{
|
{
|
||||||
bulletWidth = 7f;
|
bulletWidth = 7f;
|
||||||
bulletHeight = 9f;
|
bulletHeight = 9f;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class TurretBullets implements ContentList {
|
public class TurretBullets extends BulletList implements ContentList {
|
||||||
public static BulletType fireball, basicFlame, lancerLaser, fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning;
|
public static BulletType fireball, basicFlame, lancerLaser, fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import io.anuke.ucore.util.Tmp;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class BlockFx implements ContentList{
|
public class BlockFx extends FxList implements ContentList{
|
||||||
public static Effect reactorsmoke, nuclearsmoke, nuclearcloud, redgeneratespark, generatespark, fuelburn, plasticburn, pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium, producesmoke, smeltsmoke, formsmoke, blastsmoke, lava, dooropen, doorclose, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate, mine, mineBig, mineHuge, smelt, teleportActivate, teleport, teleportOut, ripple, bubble;
|
public static Effect reactorsmoke, nuclearsmoke, nuclearcloud, redgeneratespark, generatespark, fuelburn, plasticburn, pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium, producesmoke, smeltsmoke, formsmoke, blastsmoke, lava, dooropen, doorclose, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate, mine, mineBig, mineHuge, smelt, teleportActivate, teleport, teleportOut, ripple, bubble;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,7 +48,7 @@ public class BlockFx implements ContentList{
|
|||||||
redgeneratespark = new Effect(18, e -> {
|
redgeneratespark = new Effect(18, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
|
Angles.randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
|
||||||
float len = e.fout() * 4f;
|
float len = e.fout() * 4f;
|
||||||
Draw.color(Color.valueOf("fbb97f"), Color.GRAY, e.fin());
|
Draw.color(Palette.redSpark, Color.GRAY, e.fin());
|
||||||
//Draw.alpha(e.fout());
|
//Draw.alpha(e.fout());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
@@ -57,7 +57,7 @@ public class BlockFx implements ContentList{
|
|||||||
generatespark = new Effect(18, e -> {
|
generatespark = new Effect(18, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
|
Angles.randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
|
||||||
float len = e.fout() * 4f;
|
float len = e.fout() * 4f;
|
||||||
Draw.color(Color.valueOf("d2b29c"), Color.GRAY, e.fin());
|
Draw.color(Palette.orangeSpark, Color.GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
@@ -86,14 +86,14 @@ public class BlockFx implements ContentList{
|
|||||||
});
|
});
|
||||||
pulverizeRed = new Effect(40, e -> {
|
pulverizeRed = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
|
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
|
||||||
Draw.color(Color.valueOf("ffa480"), Palette.stoneGray, e.fin());
|
Draw.color(Palette.redDust, Palette.stoneGray, e.fin());
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
pulverizeRedder = new Effect(40, e -> {
|
pulverizeRedder = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 9f, (x, y) -> {
|
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 9f, (x, y) -> {
|
||||||
Draw.color(Color.valueOf("ff7b69"), Palette.stoneGray, e.fin());
|
Draw.color(Palette.redderDust, Palette.stoneGray, e.fin());
|
||||||
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2.5f + 0.5f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2.5f + 0.5f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
@@ -128,7 +128,7 @@ public class BlockFx implements ContentList{
|
|||||||
});
|
});
|
||||||
formsmoke = new Effect(40, e -> {
|
formsmoke = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 6, 5f + e.fin() * 8f, (x, y) -> {
|
Angles.randLenVectors(e.id, 6, 5f + e.fin() * 8f, (x, y) -> {
|
||||||
Draw.color(Color.valueOf("f1e479"), Color.LIGHT_GRAY, e.fin());
|
Draw.color(Palette.plasticSmoke, Color.LIGHT_GRAY, e.fin());
|
||||||
Fill.poly(e.x + x, e.y + y, 4, 0.2f + e.fout() * 2f, 45);
|
Fill.poly(e.x + x, e.y + y, 4, 0.2f + e.fout() * 2f, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.ucore.graphics.Lines;
|
|||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class BulletFx implements ContentList {
|
public class BulletFx extends FxList implements ContentList {
|
||||||
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLancer, despawn, flakExplosion;
|
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLancer, despawn, flakExplosion;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.ucore.graphics.Fill;
|
|||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class EnvironmentFx implements ContentList {
|
public class EnvironmentFx extends FxList implements ContentList {
|
||||||
public static Effect burning, fire, smoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily;
|
public static Effect burning, fire, smoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.ucore.graphics.Lines;
|
|||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class ExplosionFx implements ContentList {
|
public class ExplosionFx extends FxList implements ContentList {
|
||||||
public static Effect shockwave, bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke;
|
public static Effect shockwave, bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class Fx implements ContentList {
|
public class Fx extends FxList implements ContentList {
|
||||||
public static Effect none, placeBlock, breakBlock, smoke, spawn, tapBlock, select;
|
public static Effect none, placeBlock, breakBlock, smoke, spawn, tapBlock, select;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,7 +53,7 @@ public class Fx implements ContentList {
|
|||||||
});
|
});
|
||||||
|
|
||||||
smoke = new Effect(100, e -> {
|
smoke = new Effect(100, e -> {
|
||||||
Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.fin());
|
Draw.color(Color.GRAY, Palette.darkishGray, e.fin());
|
||||||
float size = 7f - e.fin() * 7f;
|
float size = 7f - e.fin() * 7f;
|
||||||
Draw.rect("circle", e.x, e.y, size, size);
|
Draw.rect("circle", e.x, e.y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
13
core/src/io/anuke/mindustry/content/fx/FxList.java
Normal file
13
core/src/io/anuke/mindustry/content/fx/FxList.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package io.anuke.mindustry.content.fx;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
|
public abstract class FxList implements ContentList{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return Array.with();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import io.anuke.ucore.graphics.Shapes;
|
|||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class ShootFx implements ContentList {
|
public class ShootFx extends FxList implements ContentList {
|
||||||
public static Effect shootSmall, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot;
|
public static Effect shootSmall, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.ucore.graphics.Lines;
|
|||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class UnitFx implements ContentList {
|
public class UnitFx extends FxList implements ContentList {
|
||||||
public static Effect vtolHover, unitDrop, unitPickup;
|
public static Effect vtolHover, unitDrop, unitPickup;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,22 +1,28 @@
|
|||||||
package io.anuke.mindustry.core;
|
package io.anuke.mindustry.core;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
|
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.*;
|
||||||
import io.anuke.mindustry.content.fx.*;
|
import io.anuke.mindustry.content.fx.*;
|
||||||
import io.anuke.mindustry.type.StatusEffect;
|
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.util.Log;
|
import io.anuke.ucore.util.Log;
|
||||||
|
|
||||||
/**Loads all game content.
|
/**Loads all game content.
|
||||||
* Call load() before doing anything with content.*/
|
* Call load() before doing anything with content.*/
|
||||||
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 ContentList[] content = {
|
private static ContentList[] content = {
|
||||||
//effects
|
//effects
|
||||||
new BlockFx(),
|
new BlockFx(),
|
||||||
@@ -73,7 +79,7 @@ public class ContentLoader {
|
|||||||
new Recipes(),
|
new Recipes(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**Creates all content types.*/
|
||||||
public static void load(){
|
public static void load(){
|
||||||
if(loaded){
|
if(loaded){
|
||||||
Log.info("Content already loaded, skipping.");
|
Log.info("Content already loaded, skipping.");
|
||||||
@@ -84,20 +90,30 @@ public class ContentLoader {
|
|||||||
list.load();
|
list.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Block block : Block.getAllBlocks()){
|
for (ContentList list : content){
|
||||||
block.init();
|
contentSet.add(list.getAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("--- CONTENT INFO ---");
|
Log.info("--- CONTENT INFO ---");
|
||||||
Log.info("Blocks loaded: {0}\nItems loaded: {1}\nLiquids loaded: {2}\nUpgrades loaded: {3}\nUnits loaded: {4}\nAmmo types loaded: {5}\nBullet types loaded: {6}\nStatus effects loaded: {7}\nRecipes loaded: {8}\nEffects loaded: {9}\nTotal content classes: {10}",
|
Log.info("Blocks loaded: {0}\nItems loaded: {1}\nLiquids loaded: {2}\nUpgrades loaded: {3}\nUnits loaded: {4}\nAmmo types loaded: {5}\nBullet types loaded: {6}\nStatus effects loaded: {7}\nRecipes loaded: {8}\nEffects loaded: {9}\nTotal content classes: {10}",
|
||||||
Block.getAllBlocks().size, io.anuke.mindustry.type.Item.all().size, Liquid.all().size,
|
Block.all().size, io.anuke.mindustry.type.Item.all().size, Liquid.all().size,
|
||||||
io.anuke.mindustry.type.Mech.all().size, UnitType.getAllTypes().size, io.anuke.mindustry.type.AmmoType.all().size, BulletType.all().size, StatusEffect.getAllEffects().size, io.anuke.mindustry.type.Recipe.all().size, Effects.all().size, content.length);
|
io.anuke.mindustry.type.Mech.all().size, UnitType.getAllTypes().size, io.anuke.mindustry.type.AmmoType.all().size, BulletType.all().size, StatusEffect.all().size, io.anuke.mindustry.type.Recipe.all().size, Effects.all().size, content.length);
|
||||||
|
|
||||||
Log.info("-------------------");
|
Log.info("-------------------");
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Initializes all content with the specified function.*/
|
||||||
|
public static void initialize(Consumer<Content> callable){
|
||||||
|
|
||||||
|
for(Array<? extends Content> arr : contentSet){
|
||||||
|
for(Content content : arr){
|
||||||
|
callable.accept(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void dispose(){
|
public static void dispose(){
|
||||||
//TODO clear all content.
|
//TODO clear all content.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.content.Mechs;
|
|||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
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.game.Content;
|
||||||
import io.anuke.mindustry.game.ContentDatabase;
|
import io.anuke.mindustry.game.ContentDatabase;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.input.AndroidInput;
|
import io.anuke.mindustry.input.AndroidInput;
|
||||||
@@ -19,7 +20,6 @@ import io.anuke.mindustry.input.InputHandler;
|
|||||||
import io.anuke.mindustry.io.Map;
|
import io.anuke.mindustry.io.Map;
|
||||||
import io.anuke.mindustry.io.Saves;
|
import io.anuke.mindustry.io.Saves;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.Item;
|
|
||||||
import io.anuke.mindustry.type.Recipe;
|
import io.anuke.mindustry.type.Recipe;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
@@ -59,11 +59,11 @@ public class Control extends Module{
|
|||||||
|
|
||||||
Effects.setShakeFalloff(10000f);
|
Effects.setShakeFalloff(10000f);
|
||||||
|
|
||||||
|
ContentLoader.initialize(Content::init);
|
||||||
|
|
||||||
Core.atlas = new Atlas("sprites.atlas");
|
Core.atlas = new Atlas("sprites.atlas");
|
||||||
|
|
||||||
for(Item item : Item.all()){
|
ContentLoader.initialize(Content::load);
|
||||||
item.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
db.load();
|
db.load();
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Gdx.input = proxy;
|
//Gdx.input = proxy;
|
||||||
|
|
||||||
Sounds.load("shoot.mp3", "place.mp3", "explosion.mp3", "enemyshoot.mp3",
|
Sounds.load("shoot.mp3", "place.mp3", "explosion.mp3", "enemyshoot.mp3",
|
||||||
"corexplode.mp3", "break.mp3", "spawn.mp3", "flame.mp3", "die.mp3",
|
"corexplode.mp3", "break.mp3", "spawn.mp3", "flame.mp3", "die.mp3",
|
||||||
@@ -255,7 +255,7 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void triggerUpdateInput(){
|
public void triggerUpdateInput(){
|
||||||
Gdx.input = proxy;
|
//Gdx.input = proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playMap(Map map){
|
public void playMap(Map map){
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class Logic extends Module {
|
|||||||
public void runWave(){
|
public void runWave(){
|
||||||
|
|
||||||
//TODO spawn enemies
|
//TODO spawn enemies
|
||||||
for(int i = 0; i < 10; i ++){
|
for(int i = 0; i < 100; i ++){
|
||||||
BaseUnit unit = UnitTypes.vtol.create(Team.red);
|
BaseUnit unit = UnitTypes.vtol.create(Team.red);
|
||||||
Vector2 offset = new Vector2().setToRandomDirection().scl(world.width()/2f*tilesize).add(world.width()/2f*tilesize, world.height()/2f*tilesize);
|
Vector2 offset = new Vector2().setToRandomDirection().scl(world.width()/2f*tilesize).add(world.width()/2f*tilesize, world.height()/2f*tilesize);
|
||||||
unit.inventory.addAmmo(AmmoTypes.bulletIron);
|
unit.inventory.addAmmo(AmmoTypes.bulletIron);
|
||||||
|
|||||||
@@ -14,13 +14,12 @@ import io.anuke.mindustry.content.fx.Fx;
|
|||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.entities.traits.BelowLiquidTrait;
|
|
||||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity;
|
import io.anuke.mindustry.entities.effect.GroundEffectEntity;
|
||||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
||||||
|
import io.anuke.mindustry.entities.traits.BelowLiquidTrait;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
|
||||||
import io.anuke.mindustry.world.BlockFlag;
|
import io.anuke.mindustry.world.BlockFlag;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
@@ -29,8 +28,8 @@ import io.anuke.ucore.core.Graphics;
|
|||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.entities.EntityDraw;
|
import io.anuke.ucore.entities.EntityDraw;
|
||||||
import io.anuke.ucore.entities.EntityGroup;
|
import io.anuke.ucore.entities.EntityGroup;
|
||||||
import io.anuke.ucore.entities.impl.EffectEntity;
|
|
||||||
import io.anuke.ucore.entities.impl.BaseEntity;
|
import io.anuke.ucore.entities.impl.BaseEntity;
|
||||||
|
import io.anuke.ucore.entities.impl.EffectEntity;
|
||||||
import io.anuke.ucore.function.Callable;
|
import io.anuke.ucore.function.Callable;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Hue;
|
import io.anuke.ucore.graphics.Hue;
|
||||||
@@ -113,10 +112,6 @@ public class Renderer extends RendererModule{
|
|||||||
clearColor.a = 1f;
|
clearColor.a = 1f;
|
||||||
|
|
||||||
background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
||||||
|
|
||||||
for(Block block : Block.getAllBlocks()){
|
|
||||||
block.load();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class UI extends SceneModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean hasMouse() {
|
public boolean hasMouse() {
|
||||||
return super.hasMouse();
|
return super.hasMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import io.anuke.ucore.core.Events;
|
|||||||
import io.anuke.ucore.entities.EntityPhysics;
|
import io.anuke.ucore.entities.EntityPhysics;
|
||||||
import io.anuke.ucore.modules.Module;
|
import io.anuke.ucore.modules.Module;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
import io.anuke.ucore.util.ThreadArray;
|
||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.threads;
|
import static io.anuke.mindustry.Vars.threads;
|
||||||
@@ -32,7 +33,7 @@ public class World extends Module{
|
|||||||
private BlockIndexer indexer = new BlockIndexer();
|
private BlockIndexer indexer = new BlockIndexer();
|
||||||
private Maps maps = new Maps();
|
private Maps maps = new Maps();
|
||||||
|
|
||||||
private Array<Tile> tempTiles = new Array<>();
|
private Array<Tile> tempTiles = new ThreadArray<>();
|
||||||
private boolean generating;
|
private boolean generating;
|
||||||
|
|
||||||
public World(){
|
public World(){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.editor;
|
package io.anuke.mindustry.editor;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
@@ -33,13 +34,17 @@ import io.anuke.ucore.scene.builders.table;
|
|||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
import io.anuke.ucore.scene.utils.UIUtils;
|
import io.anuke.ucore.scene.utils.UIUtils;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
import io.anuke.ucore.util.Log;
|
import io.anuke.ucore.util.Log;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -377,7 +382,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void build(){
|
public void build(){
|
||||||
float size = 60;
|
float size = mobile ? (int)(Gdx.graphics.getHeight() / 9.5f / Unit.dp.scl(1f)) : 60;
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
aleft();
|
aleft();
|
||||||
@@ -537,7 +542,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for(Block block : Block.getAllBlocks()){
|
for(Block block : Block.all()){
|
||||||
TextureRegion[] regions = block.getCompactIcon();
|
TextureRegion[] regions = block.getCompactIcon();
|
||||||
|
|
||||||
if(regions.length == 0) continue;
|
if(regions.length == 0) continue;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class MapRenderer implements Disposable{
|
|||||||
PixmapPacker packer = new PixmapPacker(512, 512, Format.RGBA8888, 2, true);
|
PixmapPacker packer = new PixmapPacker(512, 512, Format.RGBA8888, 2, true);
|
||||||
Pixmap pixmap = Core.atlas.getPixmapOf("blank");
|
Pixmap pixmap = Core.atlas.getPixmapOf("blank");
|
||||||
|
|
||||||
for(Block block : Block.getAllBlocks()){
|
for(Block block : Block.all()){
|
||||||
TextureRegion[] regions = block.getBlockIcon();
|
TextureRegion[] regions = block.getBlockIcon();
|
||||||
if(regions.length > 0){
|
if(regions.length > 0){
|
||||||
Pixmap result = new Pixmap(regions[0].getRegionWidth(), regions[0].getRegionHeight(), Format.RGBA8888);
|
Pixmap result = new Pixmap(regions[0].getRegionWidth(), regions[0].getRegionHeight(), Format.RGBA8888);
|
||||||
|
|||||||
@@ -28,10 +28,7 @@ import io.anuke.ucore.entities.trait.SolidTrait;
|
|||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.*;
|
||||||
import io.anuke.ucore.util.Geometry;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
|
||||||
import io.anuke.ucore.util.Timer;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -69,7 +66,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||||||
|
|
||||||
private boolean respawning;
|
private boolean respawning;
|
||||||
private float walktime;
|
private float walktime;
|
||||||
private Queue<BuildRequest> placeQueue = new Queue<>();
|
private Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
||||||
private Tile mining;
|
private Tile mining;
|
||||||
private CarriableTrait carrying;
|
private CarriableTrait carrying;
|
||||||
private Trail trail = new Trail(16);
|
private Trail trail = new Trail(16);
|
||||||
@@ -239,13 +236,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i : Mathf.signs) {
|
for (int i : Mathf.signs) {
|
||||||
Draw.rect(mname + "-leg",
|
Draw.rect(mech.legRegion,
|
||||||
x + Angles.trnsx(baseRotation, ft * i),
|
x + Angles.trnsx(baseRotation, ft * i),
|
||||||
y + Angles.trnsy(baseRotation, ft * i),
|
y + Angles.trnsy(baseRotation, ft * i),
|
||||||
12f * i, 12f - Mathf.clamp(ft * i, 0, 2), baseRotation - 90);
|
12f * i, 12f - Mathf.clamp(ft * i, 0, 2), baseRotation - 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.rect(mname + "-base", x, y,baseRotation- 90);
|
Draw.rect(mech.baseRegion, x, y, baseRotation- 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(floor.liquid) {
|
if(floor.liquid) {
|
||||||
@@ -254,13 +251,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||||||
Draw.tint(Color.WHITE);
|
Draw.tint(Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.rect(mname, x, y, rotation -90);
|
Draw.rect(mech.region, x, y, rotation -90);
|
||||||
|
|
||||||
for (int i : Mathf.signs) {
|
for (int i : Mathf.signs) {
|
||||||
float tra = rotation - 90,
|
float tra = rotation - 90,
|
||||||
trX = 4*i, trY = 3 - weapon.getRecoil(this, i > 0)*1.5f;
|
trX = 4*i, trY = 3 - weapon.getRecoil(this, i > 0)*1.5f;
|
||||||
float w = i > 0 ? -8 : 8;
|
float w = i > 0 ? -8 : 8;
|
||||||
Draw.rect(weapon.name + "-equip",
|
Draw.rect(weapon.equipRegion,
|
||||||
x + Angles.trnsx(tra, trX, trY),
|
x + Angles.trnsx(tra, trX, trY),
|
||||||
y + Angles.trnsy(tra, trX, trY), w, 8, rotation - 90);
|
y + Angles.trnsy(tra, trX, trY), w, 8, rotation - 90);
|
||||||
}
|
}
|
||||||
@@ -413,11 +410,15 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||||||
if(ui.chatfrag.chatOpen()) return;
|
if(ui.chatfrag.chatOpen()) return;
|
||||||
|
|
||||||
float speed = Inputs.keyDown("dash") ? (debug ? Player.dashSpeed * 5f : Player.dashSpeed) : Player.walkSpeed;
|
float speed = Inputs.keyDown("dash") ? (debug ? Player.dashSpeed * 5f : Player.dashSpeed) : Player.walkSpeed;
|
||||||
|
|
||||||
float carrySlowdown = 0.3f;
|
float carrySlowdown = 0.3f;
|
||||||
|
|
||||||
speed *= ((1f-carrySlowdown) + (inventory.hasItem() ? (float)inventory.getItem().amount/inventory.capacity(): 1f) * carrySlowdown);
|
speed *= ((1f-carrySlowdown) + (inventory.hasItem() ? (float)inventory.getItem().amount/inventory.capacity(): 1f) * carrySlowdown);
|
||||||
|
|
||||||
|
//drop from carrier on key press
|
||||||
|
if(Inputs.keyTap("drop_unit") && getCarrier() != null){
|
||||||
|
getCarrier().dropCarry();
|
||||||
|
}
|
||||||
|
|
||||||
movement.set(0, 0);
|
movement.set(0, 0);
|
||||||
|
|
||||||
String section = "player_" + (playerIndex + 1);
|
String section = "player_" + (playerIndex + 1);
|
||||||
@@ -549,6 +550,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||||||
placeQueue.clear();
|
placeQueue.clear();
|
||||||
dead = true;
|
dead = true;
|
||||||
respawning = false;
|
respawning = false;
|
||||||
|
trail.clear();
|
||||||
|
|
||||||
add();
|
add();
|
||||||
heal();
|
heal();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.entities.bullet;
|
package io.anuke.mindustry.entities.bullet;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
@@ -9,16 +10,26 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
/**A BulletType for most ammo-based bullets shot from turrets and units.*/
|
/**A BulletType for most ammo-based bullets shot from turrets and units.*/
|
||||||
public class BasicBulletType extends BulletType {
|
public class BasicBulletType extends BulletType {
|
||||||
public Color backColor = Palette.bulletYellowBack, frontColor = Palette.bulletYellow;
|
public Color backColor = Palette.bulletYellowBack, frontColor = Palette.bulletYellow;
|
||||||
public String bulletSprite = "bullet";
|
|
||||||
public float bulletWidth = 5f, bulletHeight = 7f;
|
public float bulletWidth = 5f, bulletHeight = 7f;
|
||||||
public float bulletShrink = 0.5f;
|
public float bulletShrink = 0.5f;
|
||||||
|
public String bulletSprite;
|
||||||
|
|
||||||
public int fragBullets = 9;
|
public int fragBullets = 9;
|
||||||
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f;
|
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f;
|
||||||
public BulletType fragBullet = null;
|
public BulletType fragBullet = null;
|
||||||
|
|
||||||
public BasicBulletType(float speed, float damage) {
|
public TextureRegion backRegion;
|
||||||
|
public TextureRegion frontRegion;
|
||||||
|
|
||||||
|
public BasicBulletType(float speed, float damage, String bulletSprite) {
|
||||||
super(speed, damage);
|
super(speed, damage);
|
||||||
|
this.bulletSprite = bulletSprite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load() {
|
||||||
|
backRegion = Draw.region(bulletSprite + "-back");
|
||||||
|
frontRegion = Draw.region(bulletSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -26,9 +37,9 @@ public class BasicBulletType extends BulletType {
|
|||||||
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
|
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
|
||||||
|
|
||||||
Draw.color(backColor);
|
Draw.color(backColor);
|
||||||
Draw.rect(bulletSprite + "-back", b.x, b.y, bulletWidth, height, b.angle() - 90);
|
Draw.rect(backRegion, b.x, b.y, bulletWidth, height, b.angle() - 90);
|
||||||
Draw.color(frontColor);
|
Draw.color(frontColor);
|
||||||
Draw.rect(bulletSprite, b.x, b.y, bulletWidth, height, b.angle() - 90);
|
Draw.rect(frontRegion, b.x, b.y, bulletWidth, height, b.angle() - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package io.anuke.mindustry.entities.bullet;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
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.type.StatusEffect;
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.entities.impl.BaseBulletType;
|
import io.anuke.ucore.entities.impl.BaseBulletType;
|
||||||
|
|
||||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
public abstract class BulletType extends BaseBulletType<Bullet> implements Content{
|
||||||
private static int lastid = 0;
|
private static int lastid = 0;
|
||||||
private static Array<BulletType> types = new Array<>();
|
private static Array<BulletType> types = new Array<>();
|
||||||
|
|
||||||
@@ -46,6 +47,16 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
Effects.effect(despawneffect, b.x, b.y, b.angle());
|
Effects.effect(despawneffect, b.x, b.y, b.angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContentTypeName() {
|
||||||
|
return "bullettype";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
public static BulletType getByID(int id){
|
public static BulletType getByID(int id){
|
||||||
return types.get(id);
|
return types.get(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float lifetime() {
|
public float lifetime() {
|
||||||
return 7000f;
|
return 8200f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public interface BuilderTrait {
|
|||||||
}else if(current.remove){
|
}else if(current.remove){
|
||||||
if(Build.validBreak(unit.getTeam(), current.x, current.y) && current.recipe == Recipe.getByResult(tile.block())){ //if it's valid, break it
|
if(Build.validBreak(unit.getTeam(), current.x, current.y) && current.recipe == Recipe.getByResult(tile.block())){ //if it's valid, break it
|
||||||
|
|
||||||
float progress = 1f / tile.getBreakTime();
|
float progress = 1f / tile.getBreakTime() * Timers.delta() * getBuildPower(tile);
|
||||||
TileEntity core = unit.getClosestCore();
|
TileEntity core = unit.getClosestCore();
|
||||||
|
|
||||||
//update accumulation of resources to add
|
//update accumulation of resources to add
|
||||||
@@ -164,7 +164,7 @@ public interface BuilderTrait {
|
|||||||
//otherwise, update it.
|
//otherwise, update it.
|
||||||
BuildEntity entity = tile.entity();
|
BuildEntity entity = tile.entity();
|
||||||
|
|
||||||
entity.addProgress(core.items, 1f / entity.recipe.cost);
|
entity.addProgress(core.items, 1f / entity.recipe.cost * Timers.delta() * getBuildPower(tile));
|
||||||
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(entity), 0.4f);
|
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(entity), 0.4f);
|
||||||
getCurrentRequest().progress = entity.progress();
|
getCurrentRequest().progress = entity.progress();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class FlyingUnit extends BaseUnit implements CarryTrait{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UnitState getStartState(){
|
public UnitState getStartState(){
|
||||||
return attack;
|
return attack;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.blocks.types.Floor;
|
import io.anuke.mindustry.world.blocks.types.Floor;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Hue;
|
|
||||||
import io.anuke.ucore.util.*;
|
import io.anuke.ucore.util.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
@@ -67,7 +66,7 @@ public abstract class GroundUnit extends BaseUnit {
|
|||||||
Floor floor = getFloorOn();
|
Floor floor = getFloorOn();
|
||||||
|
|
||||||
if(floor.liquid){
|
if(floor.liquid){
|
||||||
Draw.tint(Hue.mix(Color.WHITE, floor.liquidColor, 0.5f));
|
Draw.tint(Color.WHITE, floor.liquidColor, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i : Mathf.signs) {
|
for (int i : Mathf.signs) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package io.anuke.mindustry.entities.units.types;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.utils.Queue;
|
import com.badlogic.gdx.utils.Queue;
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
|
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||||
import io.anuke.mindustry.entities.units.UnitState;
|
import io.anuke.mindustry.entities.units.UnitState;
|
||||||
@@ -25,6 +25,7 @@ import io.anuke.ucore.graphics.Shapes;
|
|||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Geometry;
|
import io.anuke.ucore.util.Geometry;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
import io.anuke.ucore.util.ThreadQueue;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.unitGroups;
|
import static io.anuke.mindustry.Vars.unitGroups;
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
@@ -35,7 +36,7 @@ public class Drone extends FlyingUnit implements BuilderTrait {
|
|||||||
protected static boolean initialized;
|
protected static boolean initialized;
|
||||||
|
|
||||||
protected Tile mineTile;
|
protected Tile mineTile;
|
||||||
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
protected Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
||||||
|
|
||||||
/**Initialize placement event notifier system.
|
/**Initialize placement event notifier system.
|
||||||
* Static initialization is to be avoided, thus, this is done lazily.*/
|
* Static initialization is to be avoided, thus, this is done lazily.*/
|
||||||
|
|||||||
@@ -1,43 +1,31 @@
|
|||||||
package io.anuke.mindustry.entities.units.types;
|
package io.anuke.mindustry.entities.units.types;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Angles;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class Vtol extends FlyingUnit {
|
public class Vtol extends FlyingUnit {
|
||||||
|
static TextureRegion
|
||||||
|
booster1 = Draw.region("vtol-booster-1"),
|
||||||
|
booster2 = Draw.region("vtol-booster-2"),
|
||||||
|
region = Draw.region("vtol");
|
||||||
|
|
||||||
public Vtol(UnitType type, Team team) {
|
public Vtol(UnitType type, Team team) {
|
||||||
super(type, team);
|
super(type, team);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawUnder() {
|
|
||||||
float rotation = this.rotation - 90;
|
|
||||||
float scl = 0.6f + Mathf.absin(Timers.time(), 1f, 0.3f);
|
|
||||||
float dy = -6f*scl;
|
|
||||||
|
|
||||||
Draw.color(Palette.lighterOrange, Palette.lightFlame, Mathf.absin(Timers.time(), 3f, 0.7f));
|
|
||||||
|
|
||||||
Draw.rect("vtol-flame",
|
|
||||||
x + Angles.trnsx(rotation, 0, dy),
|
|
||||||
y + Angles.trnsy(rotation, 0, dy), Mathf.atan2(0, dy) + rotation);
|
|
||||||
|
|
||||||
Draw.color();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
Draw.alpha(hitTime / hitDuration);
|
Draw.alpha(hitTime / hitDuration);
|
||||||
|
|
||||||
Draw.rect(type.name, x, y, rotation - 90);
|
Draw.rect(region, x, y, rotation - 90);
|
||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
Draw.rect(type.name + "-booster-1", x, y, 12*i, 12, rotation - 90);
|
Draw.rect(booster1, x, y, 12*i, 12, rotation - 90);
|
||||||
Draw.rect(type.name + "-booster-2", x, y, 12*i, 12, rotation - 90);
|
Draw.rect(booster2, x, y, 12*i, 12, rotation - 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.alpha(1f);
|
Draw.alpha(1f);
|
||||||
|
|||||||
@@ -1,14 +1,22 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
/**Base interface for an unlockable content type.*/
|
/**Base interface for an unlockable content type.*/
|
||||||
public interface Content {
|
public interface 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 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();
|
String getContentTypeName();
|
||||||
|
|
||||||
|
/**Returns a list of all instances of this content.*/
|
||||||
|
Array<? extends Content> getAll();
|
||||||
|
|
||||||
|
/**Called after all content is created. Use for loading texture regions and other data.
|
||||||
|
* Do not use to load regions!*/
|
||||||
|
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(){}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ContentDatabase {
|
|||||||
private boolean dirty;
|
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(Content content){
|
public boolean isUnlocked(UnlockableContent content){
|
||||||
if(!unlocked.containsKey(content.getContentTypeName())){
|
if(!unlocked.containsKey(content.getContentTypeName())){
|
||||||
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ public class ContentDatabase {
|
|||||||
* If this piece of content is already unlocked, nothing changes.
|
* If this piece of content is already unlocked, nothing changes.
|
||||||
* Results are not saved until you call {@link #save()}.
|
* 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(Content content){
|
public boolean unlockContent(UnlockableContent content){
|
||||||
if(!unlocked.containsKey(content.getContentTypeName())){
|
if(!unlocked.containsKey(content.getContentTypeName())){
|
||||||
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
|
||||||
import com.badlogic.gdx.utils.ObjectMap;
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.ucore.util.ThreadArray;
|
||||||
|
import io.anuke.ucore.util.ThreadSet;
|
||||||
|
|
||||||
/**Class for various team-based utilities.*/
|
/**Class for various team-based utilities.*/
|
||||||
public class TeamInfo {
|
public class TeamInfo {
|
||||||
private ObjectMap<Team, TeamData> map = new ObjectMap<>();
|
private ObjectMap<Team, TeamData> map = new ObjectMap<>();
|
||||||
private ObjectSet<Team> allies = new ObjectSet<>(),
|
private ThreadSet<Team> allies = new ThreadSet<>(),
|
||||||
enemies = new ObjectSet<>();
|
enemies = new ThreadSet<>();
|
||||||
private ObjectSet<TeamData> allyData = new ObjectSet<>(),
|
private ThreadSet<TeamData> allyData = new ThreadSet<>(),
|
||||||
enemyData = new ObjectSet<>();
|
enemyData = new ThreadSet<>();
|
||||||
private ObjectSet<TeamData> allTeamData = new ObjectSet<>();
|
private ThreadSet<TeamData> allTeamData = new ThreadSet<>();
|
||||||
private ObjectSet<Team> allTeams = new ObjectSet<>();
|
private ThreadSet<Team> allTeams = new ThreadSet<>();
|
||||||
|
|
||||||
/**Returns all teams on a side.*/
|
/**Returns all teams on a side.*/
|
||||||
public ObjectSet<TeamData> getTeams(boolean ally) {
|
public ObjectSet<TeamData> getTeams(boolean ally) {
|
||||||
@@ -93,7 +94,7 @@ public class TeamInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class TeamData {
|
public class TeamData {
|
||||||
public final Array<Tile> cores = new Array<>();
|
public final ThreadArray<Tile> cores = new ThreadArray<>();
|
||||||
public final Team team;
|
public final Team team;
|
||||||
public final boolean ally;
|
public final boolean ally;
|
||||||
|
|
||||||
|
|||||||
11
core/src/io/anuke/mindustry/game/UnlockableContent.java
Normal file
11
core/src/io/anuke/mindustry/game/UnlockableContent.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
/**Base interface for an unlockable content type.*/
|
||||||
|
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();
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.ObjectSet.ObjectSetIterator;
|
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
@@ -163,9 +162,8 @@ public class OverlayRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((!debug || showUI) && Settings.getBool("healthbars")){
|
if((!debug || showUI) && Settings.getBool("healthbars")){
|
||||||
ObjectSetIterator<TeamData> iterator = new ObjectSetIterator<>((debug ? state.teams.getTeams() : state.teams.getTeams(true)));
|
|
||||||
|
|
||||||
for(TeamData ally : iterator){
|
for(TeamData ally : (debug ? state.teams.getTeams() : state.teams.getTeams(true))){
|
||||||
for(Unit e : unitGroups[ally.team.ordinal()].all()){
|
for(Unit e : unitGroups[ally.team.ordinal()].all()){
|
||||||
drawStats(e);
|
drawStats(e);
|
||||||
}
|
}
|
||||||
@@ -189,8 +187,8 @@ public class OverlayRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawEncloser(x, y - 8f, 2f);
|
drawEncloser(x, y - 8f, 2f);
|
||||||
drawBar(Color.SCARLET, x, y - 8f, unit.healthf());
|
drawBar(Palette.healthstats, x, y - 8f, unit.healthf());
|
||||||
drawBar(Color.valueOf("32cf6d"), x, y - 9f, unit.inventory.totalAmmo() / (float) unit.inventory.ammoCapacity());
|
drawBar(Palette.ammo, x, y - 9f, unit.inventory.totalAmmo() / (float) unit.inventory.ammoCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawBar(Color color, float x, float y, float finion){
|
void drawBar(Color color, float x, float y, float finion){
|
||||||
@@ -220,7 +218,7 @@ public class OverlayRenderer {
|
|||||||
float len = 3;
|
float len = 3;
|
||||||
|
|
||||||
Lines.stroke(2f + height);
|
Lines.stroke(2f + height);
|
||||||
Draw.color(Color.SLATE);
|
Draw.color(Palette.bar);
|
||||||
Lines.line(x - len - 0.5f, y, x + len + 1.5f, y, CapStyle.none);
|
Lines.line(x - len - 0.5f, y, x + len + 1.5f, y, CapStyle.none);
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class Palette {
|
|||||||
public static final Color lighterOrange = Color.valueOf("f6e096");
|
public static final Color lighterOrange = Color.valueOf("f6e096");
|
||||||
|
|
||||||
public static final Color lightishGray = Color.valueOf("a2a2a2");
|
public static final Color lightishGray = Color.valueOf("a2a2a2");
|
||||||
|
public static final Color darkishGray = new Color(0.3f, 0.3f, 0.3f, 1f);
|
||||||
|
|
||||||
public static final Color lancerLaser = Color.valueOf("a9d8ff");
|
public static final Color lancerLaser = Color.valueOf("a9d8ff");
|
||||||
|
|
||||||
@@ -37,7 +38,9 @@ public class Palette {
|
|||||||
|
|
||||||
public static final Color missingitems = Color.SCARLET;
|
public static final Color missingitems = Color.SCARLET;
|
||||||
public static final Color health = Color.YELLOW;
|
public static final Color health = Color.YELLOW;
|
||||||
|
public static final Color ammo = Color.valueOf("32cf6d");
|
||||||
public static final Color healthstats = Color.SCARLET;
|
public static final Color healthstats = Color.SCARLET;
|
||||||
|
public static final Color bar = Color.SLATE;
|
||||||
public static final Color interact = Color.ORANGE;
|
public static final Color interact = Color.ORANGE;
|
||||||
public static final Color accent = Color.valueOf("f4ba6e");
|
public static final Color accent = Color.valueOf("f4ba6e");
|
||||||
public static final Color place = Color.valueOf("6335f8");
|
public static final Color place = Color.valueOf("6335f8");
|
||||||
@@ -46,4 +49,13 @@ public class Palette {
|
|||||||
public static final Color breakInvalid = Color.valueOf("d44b3d");
|
public static final Color breakInvalid = Color.valueOf("d44b3d");
|
||||||
public static final Color range = Color.valueOf("f4ba6e");
|
public static final Color range = Color.valueOf("f4ba6e");
|
||||||
public static final Color power = Color.valueOf("fbd367");
|
public static final Color power = Color.valueOf("fbd367");
|
||||||
|
|
||||||
|
public static final Color redSpark = Color.valueOf("fbb97f");
|
||||||
|
public static final Color orangeSpark = Color.valueOf("d2b29c");
|
||||||
|
|
||||||
|
public static final Color redDust = Color.valueOf("ffa480");
|
||||||
|
public static final Color redderDust = Color.valueOf("ff7b69");
|
||||||
|
|
||||||
|
public static final Color plasticSmoke = Color.valueOf("f1e479");
|
||||||
|
public static final Color plasticBurn = Color.valueOf("e9ead3");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,13 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
/**Class that renders a trail.*/
|
/**Class that renders a trail.*/
|
||||||
public class Trail {
|
public class Trail {
|
||||||
private final int length;
|
private final int length;
|
||||||
|
private final FloatArray points = new FloatArray();
|
||||||
private FloatArray points = new FloatArray();
|
|
||||||
|
|
||||||
public Trail(int length){
|
public Trail(int length){
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(float curx, float cury){
|
public synchronized void update(float curx, float cury){
|
||||||
points.add(curx, cury);
|
points.add(curx, cury);
|
||||||
|
|
||||||
if(points.size > length*2) {
|
if(points.size > length*2) {
|
||||||
@@ -27,7 +26,11 @@ public class Trail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Color start, Color end, float stroke){
|
public synchronized void clear(){
|
||||||
|
points.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void draw(Color start, Color end, float stroke){
|
||||||
|
|
||||||
for(int i = 0; i < points.size - 2; i += 2){
|
for(int i = 0; i < points.size - 2; i += 2){
|
||||||
float x = points.get(i);
|
float x = points.get(i);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import io.anuke.mindustry.type.Recipe;
|
|||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.scene.Group;
|
import io.anuke.ucore.scene.Group;
|
||||||
@@ -80,16 +81,18 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
/**Check and assign targets for a specific position.*/
|
/**Check and assign targets for a specific position.*/
|
||||||
void checkTargets(float x, float y){
|
void checkTargets(float x, float y){
|
||||||
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> true);
|
synchronized (Entities.entityLock) {
|
||||||
|
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> true);
|
||||||
|
|
||||||
if(unit != null){
|
if (unit != null) {
|
||||||
player.target = unit;
|
player.target = unit;
|
||||||
}else{
|
} else {
|
||||||
Tile tile = world.tileWorld(x, y);
|
Tile tile = world.tileWorld(x, y);
|
||||||
if(tile != null) tile = tile.target();
|
if (tile != null) tile = tile.target();
|
||||||
|
|
||||||
if(tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
|
if (tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())) {
|
||||||
player.target = tile.entity;
|
player.target = tile.entity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DefaultKeybinds {
|
|||||||
for(String section : sections) {
|
for(String section : sections) {
|
||||||
|
|
||||||
KeyBinds.defaultSection(section, DeviceType.keyboard,
|
KeyBinds.defaultSection(section, DeviceType.keyboard,
|
||||||
new Category("General"),
|
new Category("General"),
|
||||||
"move_x", new Axis(Input.A, Input.D),
|
"move_x", new Axis(Input.A, Input.D),
|
||||||
"move_y", new Axis(Input.S, Input.W),
|
"move_y", new Axis(Input.S, Input.W),
|
||||||
"select", Input.MOUSE_LEFT,
|
"select", Input.MOUSE_LEFT,
|
||||||
@@ -25,6 +25,7 @@ public class DefaultKeybinds {
|
|||||||
"rotate_alt", new Axis(Input.R, Input.E),
|
"rotate_alt", new Axis(Input.R, Input.E),
|
||||||
"rotate", new Axis(Input.SCROLL),
|
"rotate", new Axis(Input.SCROLL),
|
||||||
"dash", Input.SHIFT_LEFT,
|
"dash", Input.SHIFT_LEFT,
|
||||||
|
"drop_unit", Input.SHIFT_LEFT,
|
||||||
new Category("View"),
|
new Category("View"),
|
||||||
"zoom_hold", Input.CONTROL_LEFT,
|
"zoom_hold", Input.CONTROL_LEFT,
|
||||||
"zoom", new Axis(Input.SCROLL),
|
"zoom", new Axis(Input.SCROLL),
|
||||||
@@ -45,7 +46,7 @@ public class DefaultKeybinds {
|
|||||||
);
|
);
|
||||||
|
|
||||||
KeyBinds.defaultSection(section, DeviceType.controller,
|
KeyBinds.defaultSection(section, DeviceType.controller,
|
||||||
new Category("General"),
|
new Category("General"),
|
||||||
"move_x", new Axis(Input.CONTROLLER_L_STICK_HORIZONTAL_AXIS),
|
"move_x", new Axis(Input.CONTROLLER_L_STICK_HORIZONTAL_AXIS),
|
||||||
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
|
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
|
||||||
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
|
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class MapIO {
|
|||||||
private static IntIntMap defaultBlockMap = new IntIntMap();
|
private static IntIntMap defaultBlockMap = new IntIntMap();
|
||||||
|
|
||||||
private static void loadDefaultBlocks(){
|
private static void loadDefaultBlocks(){
|
||||||
for(Block block : Block.getAllBlocks()){
|
for(Block block : Block.all()){
|
||||||
defaultBlockMap.put(block.id, block.id);
|
defaultBlockMap.put(block.id, block.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,8 +151,8 @@ public class MapIO {
|
|||||||
stream.writeUTF(entry.value);
|
stream.writeUTF(entry.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.writeShort(Block.getAllBlocks().size);
|
stream.writeShort(Block.all().size);
|
||||||
for(Block block : Block.getAllBlocks()){
|
for(Block block : Block.all()){
|
||||||
stream.writeShort(block.id);
|
stream.writeShort(block.id);
|
||||||
stream.writeUTF(block.name);
|
stream.writeUTF(block.name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ package io.anuke.mindustry.io;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.utils.*;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import com.badlogic.gdx.utils.Base64Coder;
|
||||||
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.function.Supplier;
|
import io.anuke.ucore.function.Supplier;
|
||||||
import io.anuke.ucore.util.Log;
|
import io.anuke.ucore.util.Log;
|
||||||
|
import io.anuke.ucore.util.ThreadArray;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -21,9 +25,9 @@ public class Maps implements Disposable{
|
|||||||
/**Maps map names to the real maps.*/
|
/**Maps map names to the real maps.*/
|
||||||
private ObjectMap<String, Map> maps = new ObjectMap<>();
|
private ObjectMap<String, Map> maps = new ObjectMap<>();
|
||||||
/**All maps stored in an ordered array.*/
|
/**All maps stored in an ordered array.*/
|
||||||
private Array<Map> allMaps = new Array<>();
|
private Array<Map> allMaps = new ThreadArray<>();
|
||||||
/**Temporary array used for returning things.*/
|
/**Temporary array used for returning things.*/
|
||||||
private Array<Map> returnArray = new Array<>();
|
private Array<Map> returnArray = new ThreadArray<>();
|
||||||
/**Used for storing a list of custom map names for GWT.*/
|
/**Used for storing a list of custom map names for GWT.*/
|
||||||
private Array<String> customMapNames;
|
private Array<String> customMapNames;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.mindustry.game.Difficulty;
|
|||||||
import io.anuke.mindustry.game.GameMode;
|
import io.anuke.mindustry.game.GameMode;
|
||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
|
import io.anuke.ucore.util.ThreadArray;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class Saves {
|
public class Saves {
|
||||||
private int nextSlot;
|
private int nextSlot;
|
||||||
private Array<SaveSlot> saves = new Array<>();
|
private Array<SaveSlot> saves = new ThreadArray<>();
|
||||||
private SaveSlot current;
|
private SaveSlot current;
|
||||||
private boolean saving;
|
private boolean saving;
|
||||||
private float time;
|
private float time;
|
||||||
|
|||||||
@@ -148,10 +148,10 @@ public class Save16 extends SaveFileVersion {
|
|||||||
|
|
||||||
//--BLOCK HEADER--
|
//--BLOCK HEADER--
|
||||||
|
|
||||||
stream.writeInt(Block.getAllBlocks().size);
|
stream.writeInt(Block.all().size);
|
||||||
|
|
||||||
for(int i = 0; i < Block.getAllBlocks().size; i ++){
|
for(int i = 0; i < Block.all().size; i ++){
|
||||||
Block block = Block.getAllBlocks().get(i);
|
Block block = Block.all().get(i);
|
||||||
stream.writeUTF(block.name);
|
stream.writeUTF(block.name);
|
||||||
stream.writeShort(block.id);
|
stream.writeShort(block.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,17 +64,16 @@ public class AmmoType implements Content{
|
|||||||
return bullet.speed * bullet.lifetime;
|
return bullet.speed * bullet.lifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement content name?
|
|
||||||
@Override
|
|
||||||
public String getContentName() {
|
|
||||||
return "???";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContentTypeName() {
|
public String getContentTypeName() {
|
||||||
return "ammotype";
|
return "ammotype";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return allTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public static Array<AmmoType> all() {
|
public static Array<AmmoType> all() {
|
||||||
return allTypes;
|
return allTypes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
package io.anuke.mindustry.type;
|
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 {
|
public interface ContentList {
|
||||||
|
/**This method should create all the content.*/
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
/**This method should return the list of the content of this type, for further loading.*/
|
||||||
|
Array<? extends Content> getAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
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.game.UnlockableContent;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
|
|
||||||
public class Item implements Comparable<Item>, Content{
|
public class Item implements Comparable<Item>, UnlockableContent{
|
||||||
private static final Array<Item> items = new Array<>();
|
private static final Array<Item> items = new Array<>();
|
||||||
|
|
||||||
public final int id;
|
public final int id;
|
||||||
@@ -70,6 +71,11 @@ public class Item implements Comparable<Item>, Content{
|
|||||||
return "item";
|
return "item";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return all();
|
||||||
|
}
|
||||||
|
|
||||||
public static Array<Item> all() {
|
public static Array<Item> all() {
|
||||||
return Item.items;
|
return Item.items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.StatusEffects;
|
import io.anuke.mindustry.content.StatusEffects;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
|
|
||||||
public class Liquid implements Content{
|
public class Liquid implements UnlockableContent{
|
||||||
private static final Array<Liquid> liquids = new Array<>();
|
private static final Array<Liquid> liquids = new Array<>();
|
||||||
|
|
||||||
public final Color color;
|
public final Color color;
|
||||||
@@ -56,6 +57,11 @@ public class Liquid implements Content{
|
|||||||
return "liquid";
|
return "liquid";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return all();
|
||||||
|
}
|
||||||
|
|
||||||
public static Array<Liquid> all() {
|
public static Array<Liquid> all() {
|
||||||
return Liquid.liquids;
|
return Liquid.liquids;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
package io.anuke.mindustry.type;
|
package io.anuke.mindustry.type;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
|
||||||
public class Mech extends Upgrade {
|
public class Mech extends Upgrade {
|
||||||
public boolean flying;
|
public boolean flying;
|
||||||
public float mass = 1f;
|
public float mass = 1f;
|
||||||
public int drillPower = -1;
|
public int drillPower = -1;
|
||||||
public float carryWeight = 1f;
|
public float carryWeight = 1f;
|
||||||
|
|
||||||
|
public TextureRegion baseRegion, legRegion, region;
|
||||||
|
|
||||||
public Mech(String name, boolean flying){
|
public Mech(String name, boolean flying){
|
||||||
super(name);
|
super(name);
|
||||||
this.flying = flying;
|
this.flying = flying;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load() {
|
||||||
|
if (!flying){
|
||||||
|
legRegion = Draw.region(name + "-leg");
|
||||||
|
baseRegion = Draw.region(name + "-base");
|
||||||
|
}
|
||||||
|
|
||||||
|
region = Draw.region(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import com.badlogic.gdx.utils.ObjectMap;
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.headless;
|
import static io.anuke.mindustry.Vars.headless;
|
||||||
|
|
||||||
public class Recipe implements Content{
|
public class Recipe implements UnlockableContent{
|
||||||
private static int lastid;
|
private static int lastid;
|
||||||
private static Array<Recipe> allRecipes = new Array<>();
|
private static Array<Recipe> allRecipes = new Array<>();
|
||||||
private static ObjectMap<Block, Recipe> recipeMap = new ObjectMap<>();
|
private static ObjectMap<Block, Recipe> recipeMap = new ObjectMap<>();
|
||||||
@@ -58,6 +59,11 @@ public class Recipe implements Content{
|
|||||||
return "recipe";
|
return "recipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return allRecipes;
|
||||||
|
}
|
||||||
|
|
||||||
/**Returns unlocked recipes in a category.
|
/**Returns unlocked recipes in a category.
|
||||||
* Do not call on the server backend, as unlocking does not exist!*/
|
* Do not call on the server backend, as unlocking does not exist!*/
|
||||||
public static void getUnlockedByCategory(Category category, Array<Recipe> r){
|
public static void getUnlockedByCategory(Category category, Array<Recipe> r){
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.entities.StatusController.TransitionResult;
|
import io.anuke.mindustry.entities.StatusController.TransitionResult;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
|
|
||||||
public class StatusEffect{
|
public class StatusEffect implements Content{
|
||||||
private static final Array<StatusEffect> array = new Array<>();
|
private static final Array<StatusEffect> array = new Array<>();
|
||||||
private static int lastid;
|
private static int lastid;
|
||||||
|
|
||||||
@@ -52,11 +53,21 @@ public class StatusEffect{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContentTypeName() {
|
||||||
|
return "statuseffect";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static StatusEffect getByID(int id){
|
public static StatusEffect getByID(int id){
|
||||||
return array.get(id);
|
return array.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Array<StatusEffect> getAllEffects(){
|
public static Array<StatusEffect> all(){
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package io.anuke.mindustry.type;
|
|||||||
|
|
||||||
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.game.UnlockableContent;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
|
|
||||||
public abstract class Upgrade implements Content{
|
public abstract class Upgrade implements UnlockableContent{
|
||||||
private static Array<Upgrade> upgrades = new Array<>();
|
private static Array<Upgrade> upgrades = new Array<>();
|
||||||
private static byte lastid;
|
private static byte lastid;
|
||||||
|
|
||||||
@@ -39,6 +40,11 @@ public abstract class Upgrade implements Content{
|
|||||||
return "upgrade";
|
return "upgrade";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return all();
|
||||||
|
}
|
||||||
|
|
||||||
public static Array<Upgrade> all() {
|
public static Array<Upgrade> all() {
|
||||||
return upgrades;
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.type;
|
package io.anuke.mindustry.type;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.ObjectMap;
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
@@ -7,6 +8,7 @@ import io.anuke.mindustry.entities.Unit;
|
|||||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Translator;
|
import io.anuke.ucore.util.Translator;
|
||||||
@@ -35,10 +37,18 @@ public class Weapon extends Upgrade {
|
|||||||
/**translator for vector calulations*/
|
/**translator for vector calulations*/
|
||||||
protected Translator tr = new Translator();
|
protected Translator tr = new Translator();
|
||||||
|
|
||||||
|
public TextureRegion equipRegion, region;
|
||||||
|
|
||||||
protected Weapon(String name){
|
protected Weapon(String name){
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load() {
|
||||||
|
equipRegion = Draw.region(name + "-equip");
|
||||||
|
region = Draw.region(name);
|
||||||
|
}
|
||||||
|
|
||||||
public void update(Player p, boolean left, float pointerX, float pointerY){
|
public void update(Player p, boolean left, float pointerX, float pointerY){
|
||||||
int t = left ? 1 : 2;
|
int t = left ? 1 : 2;
|
||||||
int t2 = !left ? 1 : 2;
|
int t2 = !left ? 1 : 2;
|
||||||
@@ -78,7 +88,7 @@ public class Weapon extends Upgrade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setAmmo(AmmoType... types){
|
protected void setAmmo(AmmoType... types){
|
||||||
for(io.anuke.mindustry.type.AmmoType type : types){
|
for(AmmoType type : types){
|
||||||
ammoMap.put(type.item, type);
|
ammoMap.put(type.item, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package io.anuke.mindustry.type;
|
|||||||
|
|
||||||
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.game.UnlockableContent;
|
||||||
|
|
||||||
//TODO implement this class
|
//TODO implement this class
|
||||||
public class WeatherEvent implements Content{
|
public class WeatherEvent implements UnlockableContent{
|
||||||
private static final Array<WeatherEvent> all = new Array<>();
|
private static final Array<WeatherEvent> all = new Array<>();
|
||||||
private static int lastid;
|
private static int lastid;
|
||||||
|
|
||||||
@@ -28,6 +29,11 @@ public class WeatherEvent implements Content{
|
|||||||
return "weatherevent";
|
return "weatherevent";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return all();
|
||||||
|
}
|
||||||
|
|
||||||
public static Array<WeatherEvent> all(){
|
public static Array<WeatherEvent> all(){
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import com.badlogic.gdx.utils.ObjectMap;
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
|
import io.anuke.mindustry.entities.Damage;
|
||||||
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.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.entities.Damage;
|
|
||||||
import io.anuke.mindustry.entities.effect.Puddle;
|
import io.anuke.mindustry.entities.effect.Puddle;
|
||||||
import io.anuke.mindustry.entities.effect.Rubble;
|
import io.anuke.mindustry.entities.effect.Rubble;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
|
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;
|
||||||
@@ -30,7 +31,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 UnlockableContent{
|
||||||
private static int lastid;
|
private static int lastid;
|
||||||
private static Array<Block> blocks = new Array<>();
|
private static Array<Block> blocks = new Array<>();
|
||||||
private static ObjectMap<String, Block> map = new ObjectMap<>();
|
private static ObjectMap<String, Block> map = new ObjectMap<>();
|
||||||
@@ -70,8 +71,6 @@ public class Block extends BaseBlock implements Content{
|
|||||||
public int health = 40;
|
public int health = 40;
|
||||||
/**base block explosiveness*/
|
/**base block explosiveness*/
|
||||||
public float baseExplosiveness = 0f;
|
public float baseExplosiveness = 0f;
|
||||||
/**the shadow drawn under the block. use 'null' to indicate the default shadow for this block.*/
|
|
||||||
public String shadow = null;
|
|
||||||
/**whether to display a different shadow per variant*/
|
/**whether to display a different shadow per variant*/
|
||||||
public boolean varyShadow = false;
|
public boolean varyShadow = false;
|
||||||
/**edge fallback, used mainly for ores*/
|
/**edge fallback, used mainly for ores*/
|
||||||
@@ -108,6 +107,12 @@ public class Block extends BaseBlock implements Content{
|
|||||||
public EnumSet<BlockFlag> flags;
|
public EnumSet<BlockFlag> flags;
|
||||||
/**Whether to automatically set the entity to 'sleeping' when created.*/
|
/**Whether to automatically set the entity to 'sleeping' when created.*/
|
||||||
public boolean autoSleep;
|
public boolean autoSleep;
|
||||||
|
/**Name of shadow region to load. Null to indicate normal shadow.*/
|
||||||
|
public String shadow = null;
|
||||||
|
/**Region used for drawing shadows.*/
|
||||||
|
public TextureRegion shadowRegion;
|
||||||
|
/**Texture region array for drawing multiple shadows.*/
|
||||||
|
public TextureRegion[] shadowRegions;
|
||||||
|
|
||||||
public Block(String name) {
|
public Block(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -145,13 +150,23 @@ public class Block extends BaseBlock implements Content{
|
|||||||
public boolean canPlaceOn(Tile tile){ return true; }
|
public boolean canPlaceOn(Tile tile){ return true; }
|
||||||
|
|
||||||
/**Called after all blocks are created.*/
|
/**Called after all blocks are created.*/
|
||||||
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
setStats();
|
setStats();
|
||||||
setBars();
|
setBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Called after texture atlas is loaded.*/
|
@Override
|
||||||
public void load(){}
|
public void load() {
|
||||||
|
shadowRegion = Draw.region(shadow == null ? "shadow-" + size : shadow);
|
||||||
|
|
||||||
|
if(varyShadow && variants > 0) {
|
||||||
|
shadowRegions = new TextureRegion[variants];
|
||||||
|
for(int i = 0; i < variants; i ++){
|
||||||
|
shadowRegions[i] = Draw.region(name + "shadow" + (i + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**Called when the block is tapped.*/
|
/**Called when the block is tapped.*/
|
||||||
public boolean tapped(Tile tile, Player player){
|
public boolean tapped(Tile tile, Player player){
|
||||||
@@ -394,12 +409,10 @@ public class Block extends BaseBlock implements Content{
|
|||||||
|
|
||||||
public void drawShadow(Tile tile){
|
public void drawShadow(Tile tile){
|
||||||
|
|
||||||
if(varyShadow && variants > 0 && shadow != null) {
|
if(shadowRegions != null) {
|
||||||
Draw.rect(shadow + (Mathf.randomSeed(tile.id(), 1, variants)), tile.worldx(), tile.worldy());
|
Draw.rect(shadowRegions[(Mathf.randomSeed(tile.id(), 0, variants - 1))], tile.worldx(), tile.worldy());
|
||||||
}else if(shadow != null){
|
|
||||||
Draw.rect(shadow, tile.drawx(), tile.drawy());
|
|
||||||
}else{
|
}else{
|
||||||
Draw.rect("shadow-" + size, tile.drawx(), tile.drawy());
|
Draw.rect(shadowRegion, tile.drawx(), tile.drawy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,24 +424,6 @@ public class Block extends BaseBlock implements Content{
|
|||||||
public boolean isMultiblock(){
|
public boolean isMultiblock(){
|
||||||
return size > 1;
|
return size > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Array<Block> getAllBlocks(){
|
|
||||||
return blocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block getByName(String name){
|
|
||||||
return map.get(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block getByID(int id){
|
|
||||||
if(id < 0){ //offset negative values by 256, as they are a product of byte overflow
|
|
||||||
id += 256;
|
|
||||||
}
|
|
||||||
if(id >= blocks.size || id < 0){
|
|
||||||
throw new RuntimeException("No block with ID '" + id + "' found!");
|
|
||||||
}
|
|
||||||
return blocks.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Array<Object> getDebugInfo(Tile tile){
|
public Array<Object> getDebugInfo(Tile tile){
|
||||||
return Array.with(
|
return Array.with(
|
||||||
@@ -454,8 +449,31 @@ public class Block extends BaseBlock implements Content{
|
|||||||
return "block";
|
return "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends Content> getAll() {
|
||||||
|
return all();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Array<Block> all(){
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block getByName(String name){
|
||||||
|
return map.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block getByID(int id){
|
||||||
|
if(id < 0){ //offset negative values by 256, as they are a product of byte overflow
|
||||||
|
id += 256;
|
||||||
|
}
|
||||||
|
if(id >= blocks.size || id < 0){
|
||||||
|
throw new RuntimeException("No block with ID '" + id + "' found!");
|
||||||
|
}
|
||||||
|
return blocks.get(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class Rock extends Block {
|
|||||||
|
|
||||||
public Rock(String name) {
|
public Rock(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
shadow = name+"shadow";
|
varyShadow = true;
|
||||||
breakable = true;
|
breakable = true;
|
||||||
alwaysReplace = true;
|
alwaysReplace = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.Predict;
|
||||||
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
|
import io.anuke.mindustry.entities.Unit;
|
||||||
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
@@ -20,10 +23,7 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.function.BiConsumer;
|
import io.anuke.ucore.function.BiConsumer;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.*;
|
||||||
import io.anuke.ucore.util.Mathf;
|
|
||||||
import io.anuke.ucore.util.Strings;
|
|
||||||
import io.anuke.ucore.util.Translator;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -267,7 +267,7 @@ public abstract class Turret extends Block{
|
|||||||
|
|
||||||
public static class TurretEntity extends TileEntity{
|
public static class TurretEntity extends TileEntity{
|
||||||
public TileEntity blockTarget;
|
public TileEntity blockTarget;
|
||||||
public Array<AmmoEntry> ammo = new Array<>();
|
public Array<AmmoEntry> ammo = new ThreadArray<>();
|
||||||
public int totalAmmo;
|
public int totalAmmo;
|
||||||
public float reload;
|
public float reload;
|
||||||
public float rotation = 90;
|
public float rotation = 90;
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class FusionReactor extends PowerGenerator {
|
|||||||
protected Liquid inputLiquid = Liquids.water;
|
protected Liquid inputLiquid = Liquids.water;
|
||||||
protected float warmupSpeed = 0.001f;
|
protected float warmupSpeed = 0.001f;
|
||||||
|
|
||||||
|
protected Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b");
|
||||||
|
protected Color ind1 = Color.valueOf("858585"), ind2 = Color.valueOf("fea080");
|
||||||
|
|
||||||
public FusionReactor(String name) {
|
public FusionReactor(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
@@ -62,7 +65,7 @@ public class FusionReactor extends PowerGenerator {
|
|||||||
for(int i = 0; i < plasmas; i ++){
|
for(int i = 0; i < plasmas; i ++){
|
||||||
float r = 29f + Mathf.absin(Timers.time(), 2f + i*1f, 5f - i*0.5f);
|
float r = 29f + Mathf.absin(Timers.time(), 2f + i*1f, 5f - i*0.5f);
|
||||||
|
|
||||||
Draw.color(Color.valueOf("ffd06b"), Color.valueOf("ff361b"), (float)i/plasmas);
|
Draw.color(plasma1, plasma2, (float)i/plasmas);
|
||||||
Draw.alpha((0.3f + Mathf.absin(Timers.time(), 2f+i*2f, 0.3f+i*0.05f)) * entity.warmup);
|
Draw.alpha((0.3f + Mathf.absin(Timers.time(), 2f+i*2f, 0.3f+i*0.05f)) * entity.warmup);
|
||||||
Draw.rect(name + "-plasma-" + i, tile.drawx(), tile.drawy(), r, r, Timers.time()*(12+i*6f) * entity.warmup);
|
Draw.rect(name + "-plasma-" + i, tile.drawx(), tile.drawy(), r, r, Timers.time()*(12+i*6f) * entity.warmup);
|
||||||
}
|
}
|
||||||
@@ -75,7 +78,7 @@ public class FusionReactor extends PowerGenerator {
|
|||||||
|
|
||||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
Draw.color(Color.valueOf("858585"), Color.valueOf("fea080"), entity.warmup + Mathf.absin(entity.totalProgress, 3f, entity.warmup*0.5f));
|
Draw.color(ind1, ind2, entity.warmup + Mathf.absin(entity.totalProgress, 3f, entity.warmup*0.5f));
|
||||||
Draw.rect(name + "-light", tile.drawx(), tile.drawy());
|
Draw.rect(name + "-light", tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.server;
|
|||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.io.BundleLoader;
|
import io.anuke.mindustry.io.BundleLoader;
|
||||||
import io.anuke.ucore.modules.ModuleCore;
|
import io.anuke.ucore.modules.ModuleCore;
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ public class MindustryServer extends ModuleCore {
|
|||||||
|
|
||||||
BundleLoader.load();
|
BundleLoader.load();
|
||||||
ContentLoader.load();
|
ContentLoader.load();
|
||||||
|
ContentLoader.initialize(Content::init);
|
||||||
|
|
||||||
module(logic = new Logic());
|
module(logic = new Logic());
|
||||||
module(world = new World());
|
module(world = new World());
|
||||||
|
|||||||
Reference in New Issue
Block a user