Balancing / Bugfixes / Badly antialiased turret outlines
@@ -27,6 +27,10 @@ allprojects{
|
|||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
arcHash = null
|
arcHash = null
|
||||||
|
|
||||||
|
debugged = {
|
||||||
|
return new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null
|
||||||
|
}
|
||||||
|
|
||||||
localArc = {
|
localArc = {
|
||||||
return (System.properties["release"] == null || System.properties["release"] == "false") && new File(projectDir.parent, '../Arc').exists()
|
return (System.properties["release"] == null || System.properties["release"] == "false") && new File(projectDir.parent, '../Arc').exists()
|
||||||
}
|
}
|
||||||
@@ -117,7 +121,7 @@ project(":desktop"){
|
|||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile project(":net")
|
compile project(":net")
|
||||||
|
|
||||||
if(new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null) compile project(":debug")
|
if(debugged()) compile project(":debug")
|
||||||
|
|
||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
@@ -194,7 +198,7 @@ project(":core"){
|
|||||||
|
|
||||||
compile arcModule("arc-core")
|
compile arcModule("arc-core")
|
||||||
compile arcModule("extensions:freetype")
|
compile arcModule("extensions:freetype")
|
||||||
if(localArc()) compile arcModule("extensions:recorder")
|
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
||||||
|
|
||||||
compileOnly project(":annotations")
|
compileOnly project(":annotations")
|
||||||
annotationProcessor project(":annotations")
|
annotationProcessor project(":annotations")
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
@@ -469,7 +469,7 @@ item.metaglass.description = A super-tough glass compound. Extensively used for
|
|||||||
item.scrap.name = Scrap
|
item.scrap.name = Scrap
|
||||||
item.scrap.description = Leftover remnants of old structures and units. Contains trace amounts of many different metals.
|
item.scrap.description = Leftover remnants of old structures and units. Contains trace amounts of many different metals.
|
||||||
liquid.water.name = Water
|
liquid.water.name = Water
|
||||||
liquid.lava.name = Lava
|
liquid.slag.name = Slag
|
||||||
liquid.oil.name = Oil
|
liquid.oil.name = Oil
|
||||||
liquid.cryofluid.name = Cryofluid
|
liquid.cryofluid.name = Cryofluid
|
||||||
mech.alpha-mech.name = Alpha
|
mech.alpha-mech.name = Alpha
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@@ -457,7 +457,7 @@ public class Blocks implements ContentList{
|
|||||||
spinnerSpeed = 3f;
|
spinnerSpeed = 3f;
|
||||||
size = 2;
|
size = 2;
|
||||||
|
|
||||||
consumes.liquid(Liquids.slag, 0.3f);
|
consumes.liquid(Liquids.slag, 0.1f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cultivator = new Cultivator("cultivator"){{
|
cultivator = new Cultivator("cultivator"){{
|
||||||
@@ -467,6 +467,7 @@ public class Blocks implements ContentList{
|
|||||||
size = 2;
|
size = 2;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
|
hasItems = true;
|
||||||
|
|
||||||
consumes.power(0.80f);
|
consumes.power(0.80f);
|
||||||
consumes.liquid(Liquids.water, 0.15f);
|
consumes.liquid(Liquids.water, 0.15f);
|
||||||
@@ -848,12 +849,12 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
differentialGenerator = new DifferentialGenerator("differential-generator"){{
|
differentialGenerator = new DifferentialGenerator("differential-generator"){{
|
||||||
requirements(Category.power, ItemStack.with(Items.copper, 140, Items.titanium, 100, Items.lead, 200, Items.silicon, 130, Items.metaglass, 100));
|
requirements(Category.power, ItemStack.with(Items.copper, 140, Items.titanium, 100, Items.lead, 200, Items.silicon, 130, Items.metaglass, 100));
|
||||||
powerProduction = 24f;
|
powerProduction = 16f;
|
||||||
itemDuration = 60f;
|
itemDuration = 50f;
|
||||||
consumes.remove(ConsumeItemFilter.class);
|
consumes.remove(ConsumeItemFilter.class);
|
||||||
consumes.remove(ConsumeLiquidFilter.class);
|
consumes.remove(ConsumeLiquidFilter.class);
|
||||||
consumes.item(Items.pyratite);
|
consumes.item(Items.pyratite);
|
||||||
consumes.liquid(Liquids.cryofluid, 0.06f);
|
consumes.liquid(Liquids.cryofluid, 0.12f);
|
||||||
size = 3;
|
size = 3;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -991,7 +992,7 @@ public class Blocks implements ContentList{
|
|||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
|
|
||||||
health = 1100;
|
health = 1100;
|
||||||
itemCapacity = 4000;
|
itemCapacity = 5000;
|
||||||
size = 3;
|
size = 3;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -999,15 +1000,15 @@ public class Blocks implements ContentList{
|
|||||||
requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 4000, Items.silicon, 2000));
|
requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 4000, Items.silicon, 2000));
|
||||||
|
|
||||||
health = 2000;
|
health = 2000;
|
||||||
itemCapacity = 7000;
|
itemCapacity = 8000;
|
||||||
size = 4;
|
size = 4;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
coreNucleus = new CoreBlock("core-nucleus"){{
|
coreNucleus = new CoreBlock("core-nucleus"){{
|
||||||
requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 8000, Items.silicon, 4000, Items.surgealloy, 2000));
|
requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 8000, Items.silicon, 4000, Items.surgealloy, 2000));
|
||||||
|
|
||||||
health = 3000;
|
health = 4000;
|
||||||
itemCapacity = 10000;
|
itemCapacity = 12000;
|
||||||
size = 5;
|
size = 5;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -1102,7 +1103,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
lancer = new ChargeTurret("lancer"){{
|
lancer = new ChargeTurret("lancer"){{
|
||||||
requirements(Category.turret, ItemStack.with(Items.copper, 50, Items.lead, 100, Items.silicon, 90));
|
requirements(Category.turret, ItemStack.with(Items.copper, 50, Items.lead, 100, Items.silicon, 90));
|
||||||
range = 135f;
|
range = 155f;
|
||||||
chargeTime = 50f;
|
chargeTime = 50f;
|
||||||
chargeMaxDelay = 30f;
|
chargeMaxDelay = 30f;
|
||||||
chargeEffects = 7;
|
chargeEffects = 7;
|
||||||
@@ -1130,7 +1131,7 @@ public class Blocks implements ContentList{
|
|||||||
shootCone = 40f;
|
shootCone = 40f;
|
||||||
rotatespeed = 8f;
|
rotatespeed = 8f;
|
||||||
powerUsed = 1f / 2f;
|
powerUsed = 1f / 2f;
|
||||||
consumes.powerBuffered(50f);
|
consumes.powerBuffered(80f);
|
||||||
range = 80f;
|
range = 80f;
|
||||||
shootEffect = Fx.lightningShoot;
|
shootEffect = Fx.lightningShoot;
|
||||||
heatColor = Color.RED;
|
heatColor = Color.RED;
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ public class Bullets implements ContentList{
|
|||||||
Color[] colors = {Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.WHITE};
|
Color[] colors = {Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.WHITE};
|
||||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||||
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
|
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
|
||||||
float length = 140f;
|
float length = 160f;
|
||||||
|
|
||||||
{
|
{
|
||||||
hitEffect = Fx.hitLancer;
|
hitEffect = Fx.hitLancer;
|
||||||
|
|||||||
@@ -185,7 +185,9 @@ public class World implements ApplicationListener{
|
|||||||
|
|
||||||
addDarkness(tiles);
|
addDarkness(tiles);
|
||||||
|
|
||||||
EntityQuery.resizeTree(0, 0, tiles.length * tilesize, tiles[0].length * tilesize);
|
int padding = 50;
|
||||||
|
|
||||||
|
EntityQuery.resizeTree(-padding * tilesize, -padding * tilesize, (tiles.length + padding) * tilesize, (tiles[0].length + padding) * tilesize);
|
||||||
|
|
||||||
generating = false;
|
generating = false;
|
||||||
Events.fire(new WorldLoadEvent());
|
Events.fire(new WorldLoadEvent());
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.arc.math.Angles;
|
|||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.headless;
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class ScorchDecal extends Decal{
|
public class ScorchDecal extends Decal{
|
||||||
@@ -14,6 +15,7 @@ public class ScorchDecal extends Decal{
|
|||||||
private static final TextureRegion[] regions = new TextureRegion[scorches];
|
private static final TextureRegion[] regions = new TextureRegion[scorches];
|
||||||
|
|
||||||
public static void create(float x, float y){
|
public static void create(float x, float y){
|
||||||
|
if(headless) return;
|
||||||
if(regions[0] == null){
|
if(regions[0] == null){
|
||||||
for(int i = 0; i < regions.length; i++){
|
for(int i = 0; i < regions.length; i++){
|
||||||
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import static io.anuke.mindustry.Vars.unitGroups;
|
|||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class Drone extends FlyingUnit implements BuilderTrait{
|
public class Drone extends FlyingUnit implements BuilderTrait{
|
||||||
protected static int timerRepairEffect = timerIndex++;
|
|
||||||
|
|
||||||
protected Item targetItem;
|
protected Item targetItem;
|
||||||
protected Tile mineTile;
|
protected Tile mineTile;
|
||||||
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
||||||
|
|||||||
@@ -96,12 +96,14 @@ public class Block extends BlockStorage{
|
|||||||
/** Whether this block consumes touchDown events when tapped. */
|
/** Whether this block consumes touchDown events when tapped. */
|
||||||
public boolean consumesTap;
|
public boolean consumesTap;
|
||||||
/** The color of this block when displayed on the minimap or map preview.
|
/** The color of this block when displayed on the minimap or map preview.
|
||||||
* Do not set manually! This is overriden when loading.*/
|
* Do not set manually! This is overriden when loading for most blocks.*/
|
||||||
public Color color = new Color(0, 0, 0, 1);
|
public Color color = new Color(0, 0, 0, 1);
|
||||||
/**Whether units target this block.*/
|
/**Whether units target this block.*/
|
||||||
public boolean targetable = true;
|
public boolean targetable = true;
|
||||||
/**Whether the overdrive core has any effect on this block.*/
|
/**Whether the overdrive core has any effect on this block.*/
|
||||||
public boolean canOverdrive = true;
|
public boolean canOverdrive = true;
|
||||||
|
/**Whether the icon region has an outline added.*/
|
||||||
|
public boolean outlineIcon = false;
|
||||||
|
|
||||||
/**Cost of constructing this block.*/
|
/**Cost of constructing this block.*/
|
||||||
public ItemStack[] buildRequirements = new ItemStack[]{};
|
public ItemStack[] buildRequirements = new ItemStack[]{};
|
||||||
@@ -380,11 +382,6 @@ public class Block extends BlockStorage{
|
|||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Called when this tile is randomly updated. This only happens on a client, and should be used for effects only.
|
|
||||||
* TODO currently unimplemented*/
|
|
||||||
public void randomUpdate(Tile tile){
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAccessible(){
|
public boolean isAccessible(){
|
||||||
return (hasItems && itemCapacity > 0);
|
return (hasItems && itemCapacity > 0);
|
||||||
}
|
}
|
||||||
@@ -402,11 +399,10 @@ public class Block extends BlockStorage{
|
|||||||
float power = 0f;
|
float power = 0f;
|
||||||
|
|
||||||
if(hasItems){
|
if(hasItems){
|
||||||
float scaling = inventoryScaling(tile);
|
|
||||||
for(Item item : content.items()){
|
for(Item item : content.items()){
|
||||||
int amount = tile.entity.items.get(item);
|
int amount = tile.entity.items.get(item);
|
||||||
explosiveness += item.explosiveness * amount * scaling;
|
explosiveness += item.explosiveness * amount;
|
||||||
flammability += item.flammability * amount * scaling;
|
flammability += item.flammability * amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,11 +437,6 @@ public class Block extends BlockStorage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Returns scaled # of inventories in this block.*/
|
|
||||||
public float inventoryScaling(Tile tile){
|
|
||||||
return 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the flammability of the tile. Used for fire calculations.
|
* Returns the flammability of the tile. Used for fire calculations.
|
||||||
* Takes flammability of floor liquid into account.
|
* Takes flammability of floor liquid into account.
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
package io.anuke.mindustry.world.blocks;
|
package io.anuke.mindustry.world.blocks;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.mindustry.entities.Effects;
|
|
||||||
import io.anuke.mindustry.entities.Effects.Effect;
|
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.Geometry;
|
import io.anuke.arc.math.geom.Geometry;
|
||||||
import io.anuke.arc.math.geom.Point2;
|
import io.anuke.arc.math.geom.Point2;
|
||||||
import io.anuke.mindustry.content.Blocks;
|
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
import io.anuke.mindustry.content.StatusEffects;
|
import io.anuke.mindustry.content.StatusEffects;
|
||||||
|
import io.anuke.mindustry.entities.Effects.Effect;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.type.StatusEffect;
|
import io.anuke.mindustry.type.StatusEffect;
|
||||||
@@ -98,13 +96,6 @@ public class Floor extends Block{
|
|||||||
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
|
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void randomUpdate(Tile tile){
|
|
||||||
if(tile.block() == Blocks.air){
|
|
||||||
Effects.effect(updateEffect, tile.worldx() + Mathf.range(tilesize/2f), tile.worldy() + Mathf.range(tilesize/2f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
super.init();
|
super.init();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public interface SelectionTrait{
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for(Item item : items){
|
for(Item item : items){
|
||||||
if(!data.isUnlocked(item)) continue;
|
if(!data.isUnlocked(item) && world.isZone()) continue;
|
||||||
|
|
||||||
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> {}).group(group).get();
|
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> {}).group(group).get();
|
||||||
button.changed(() -> consumer.accept(button.isChecked() ? item : null));
|
button.changed(() -> consumer.accept(button.isChecked() ? item : null));
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ public abstract class Turret extends Block{
|
|||||||
protected Vector2 tr = new Vector2();
|
protected Vector2 tr = new Vector2();
|
||||||
protected Vector2 tr2 = new Vector2();
|
protected Vector2 tr2 = new Vector2();
|
||||||
|
|
||||||
protected TextureRegion baseRegion;
|
protected TextureRegion baseRegion, heatRegion;
|
||||||
protected TextureRegion heatRegion;
|
|
||||||
|
|
||||||
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) ->
|
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) ->
|
||||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||||
@@ -83,6 +82,7 @@ public abstract class Turret extends Block{
|
|||||||
layer = Layer.turret;
|
layer = Layer.turret;
|
||||||
group = BlockGroup.turrets;
|
group = BlockGroup.turrets;
|
||||||
flags = EnumSet.of(BlockFlag.turret);
|
flags = EnumSet.of(BlockFlag.turret);
|
||||||
|
outlineIcon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -94,6 +94,7 @@ public abstract class Turret extends Block{
|
|||||||
public void load(){
|
public void load(){
|
||||||
super.load();
|
super.load();
|
||||||
|
|
||||||
|
region = Core.atlas.find(name);
|
||||||
baseRegion = Core.atlas.find("block-" + size);
|
baseRegion = Core.atlas.find("block-" + size);
|
||||||
heatRegion = Core.atlas.find(name + "-heat");
|
heatRegion = Core.atlas.find(name + "-heat");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class MassDriver extends Block{
|
|||||||
protected Effect smokeEffect = Fx.shootBigSmoke2;
|
protected Effect smokeEffect = Fx.shootBigSmoke2;
|
||||||
protected Effect recieveEffect = Fx.mineBig;
|
protected Effect recieveEffect = Fx.mineBig;
|
||||||
protected float shake = 3f;
|
protected float shake = 3f;
|
||||||
protected final static float powerPercentageUsed = 1.0f;
|
protected float powerPercentageUsed = 0.95f;
|
||||||
protected TextureRegion turretRegion;
|
protected TextureRegion turretRegion;
|
||||||
|
|
||||||
public MassDriver(String name){
|
public MassDriver(String name){
|
||||||
@@ -59,6 +59,7 @@ public class MassDriver extends Block{
|
|||||||
layer = Layer.turret;
|
layer = Layer.turret;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumes.powerBuffered(30f);
|
consumes.powerBuffered(30f);
|
||||||
|
outlineIcon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||||
@@ -79,7 +80,7 @@ public class MassDriver extends Block{
|
|||||||
|
|
||||||
entity.reload = 1f;
|
entity.reload = 1f;
|
||||||
|
|
||||||
entity.power.satisfaction -= Math.min(entity.power.satisfaction, powerPercentageUsed);
|
entity.power.satisfaction -= Math.min(entity.power.satisfaction, driver.powerPercentageUsed);
|
||||||
|
|
||||||
DriverBulletData data = Pools.obtain(DriverBulletData.class, DriverBulletData::new);
|
DriverBulletData data = Pools.obtain(DriverBulletData.class, DriverBulletData::new);
|
||||||
data.from = entity;
|
data.from = entity;
|
||||||
@@ -117,7 +118,7 @@ public class MassDriver extends Block{
|
|||||||
public void load(){
|
public void load(){
|
||||||
super.load();
|
super.load();
|
||||||
|
|
||||||
turretRegion = Core.atlas.find(name + "-turret");
|
turretRegion = Core.atlas.find(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,13 +44,14 @@ public class RepairPoint extends Block{
|
|||||||
layer2 = Layer.laser;
|
layer2 = Layer.laser;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumePower = consumes.powerBuffered(20f);
|
consumePower = consumes.powerBuffered(20f);
|
||||||
|
outlineIcon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
super.load();
|
super.load();
|
||||||
|
|
||||||
topRegion = Core.atlas.find(name + "-turret");
|
topRegion = Core.atlas.find(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,6 +91,11 @@ public class RepairPoint extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion[] generateIcons(){
|
||||||
|
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-turret")};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
RepairPointEntity entity = tile.entity();
|
RepairPointEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class UnitFactory extends Block{
|
|||||||
protected float produceTime = 1000f;
|
protected float produceTime = 1000f;
|
||||||
protected float launchVelocity = 0f;
|
protected float launchVelocity = 0f;
|
||||||
protected TextureRegion topRegion;
|
protected TextureRegion topRegion;
|
||||||
protected int maxSpawn = 4;
|
protected int maxSpawn = 2;
|
||||||
|
|
||||||
public UnitFactory(String name){
|
public UnitFactory(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
info("Status: &rserver closed");
|
info("Status: &rserver closed");
|
||||||
}else{
|
}else{
|
||||||
info("Status:");
|
info("Status:");
|
||||||
info(" &lyPlaying on map &fi{0}&fb &lb/&ly Wave {1} &lb/&ly {2} &lb/&ly {3}", Strings.capitalize(world.getMap().name), state.wave);
|
info(" &lyPlaying on map &fi{0}&fb &lb/&ly Wave {1}", Strings.capitalize(world.getMap().name), state.wave);
|
||||||
|
|
||||||
if(!state.rules.waves){
|
if(!state.rules.waves){
|
||||||
info("&ly {0} enemies.", unitGroups[Team.red.ordinal()].size());
|
info("&ly {0} enemies.", unitGroups[Team.red.ordinal()].size());
|
||||||
|
|||||||
@@ -114,6 +114,11 @@ public class ApplicationTests{
|
|||||||
void spawnWaves(){
|
void spawnWaves(){
|
||||||
world.loadMap(testMap);
|
world.loadMap(testMap);
|
||||||
logic.runWave();
|
logic.runWave();
|
||||||
|
//force trigger delayed spawns
|
||||||
|
Time.setDeltaProvider(() -> 1000f);
|
||||||
|
Time.update();
|
||||||
|
Time.update();
|
||||||
|
Time.setDeltaProvider(() -> 1f);
|
||||||
unitGroups[waveTeam.ordinal()].updateEvents();
|
unitGroups[waveTeam.ordinal()].updateEvents();
|
||||||
assertFalse(unitGroups[waveTeam.ordinal()].isEmpty());
|
assertFalse(unitGroups[waveTeam.ordinal()].isEmpty());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,21 @@ package io.anuke.mindustry;
|
|||||||
|
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.util.Log;
|
import io.anuke.arc.util.Log;
|
||||||
import io.anuke.mindustry.type.UnitType;
|
import io.anuke.mindustry.ImagePacker.GenRegion;
|
||||||
import io.anuke.mindustry.type.ContentType;
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Mech;
|
import io.anuke.mindustry.type.Mech;
|
||||||
|
import io.anuke.mindustry.type.UnitType;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Block.Icon;
|
import io.anuke.mindustry.world.Block.Icon;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
import io.anuke.mindustry.world.blocks.Floor;
|
||||||
import io.anuke.mindustry.world.blocks.OreBlock;
|
import io.anuke.mindustry.world.blocks.OreBlock;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.content;
|
import static io.anuke.mindustry.Vars.content;
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
@@ -21,6 +26,7 @@ public class Generators {
|
|||||||
|
|
||||||
ImagePacker.generate("block-icons", () -> {
|
ImagePacker.generate("block-icons", () -> {
|
||||||
Image colors = new Image(256, 1);
|
Image colors = new Image(256, 1);
|
||||||
|
Color outlineColor = new Color(0, 0, 0, 0.3f);
|
||||||
|
|
||||||
for(Block block : content.blocks()){
|
for(Block block : content.blocks()){
|
||||||
TextureRegion[] regions = block.getGeneratedIcons();
|
TextureRegion[] regions = block.getGeneratedIcons();
|
||||||
@@ -47,6 +53,45 @@ public class Generators {
|
|||||||
scaled.save(block.name + "-icon-" + icon.name());
|
scaled.save(block.name + "-icon-" + icon.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(block.outlineIcon){
|
||||||
|
int radius = 3;
|
||||||
|
GenRegion region = (GenRegion)regions[regions.length-1];
|
||||||
|
Image base = ImagePacker.get(region);
|
||||||
|
Image out = new Image(region.getWidth(), region.getHeight());
|
||||||
|
for(int x = 0; x < out.width(); x++){
|
||||||
|
for(int y = 0; y < out.height(); y++){
|
||||||
|
|
||||||
|
Color color = base.getColor(x, y);
|
||||||
|
if(color.a >= 0.01f){
|
||||||
|
out.draw(x, y, color);
|
||||||
|
}else{
|
||||||
|
boolean found = false;
|
||||||
|
outer:
|
||||||
|
for(int rx = -radius; rx <= radius; rx++){
|
||||||
|
for(int ry = -radius; ry <= radius; ry++){
|
||||||
|
if(Mathf.dst(rx, ry) <= radius && base.getColor(rx + x, ry + y).a > 0.01f){
|
||||||
|
found = true;
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(found){
|
||||||
|
out.draw(x, y, outlineColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
Files.delete(region.path);
|
||||||
|
}catch(IOException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
out.save(block.name);
|
||||||
|
}
|
||||||
|
|
||||||
Color average = new Color();
|
Color average = new Color();
|
||||||
for(int x = 0; x < image.width(); x++){
|
for(int x = 0; x < image.width(); x++){
|
||||||
for(int y = 0; y < image.height(); y++){
|
for(int y = 0; y < image.height(); y++){
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Color getColor(int x, int y){
|
Color getColor(int x, int y){
|
||||||
|
if(!Structs.inBounds(x, y, width(), height())) return color.set(0, 0, 0, 0);
|
||||||
int i = image.getRGB(x, y);
|
int i = image.getRGB(x, y);
|
||||||
Color.argb8888ToColor(color, i);
|
Color.argb8888ToColor(color, i);
|
||||||
return color;
|
return color;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import javax.imageio.ImageIO;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public class ImagePacker{
|
public class ImagePacker{
|
||||||
@@ -38,7 +39,7 @@ public class ImagePacker{
|
|||||||
fname = fname.substring(0, fname.length() - 4);
|
fname = fname.substring(0, fname.length() - 4);
|
||||||
|
|
||||||
BufferedImage image = ImageIO.read(path.toFile());
|
BufferedImage image = ImageIO.read(path.toFile());
|
||||||
GenRegion region = new GenRegion(fname){
|
GenRegion region = new GenRegion(fname, path){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getX(){
|
public int getX(){
|
||||||
@@ -73,7 +74,7 @@ public class ImagePacker{
|
|||||||
@Override
|
@Override
|
||||||
public AtlasRegion find(String name){
|
public AtlasRegion find(String name){
|
||||||
if(!regionCache.containsKey(name)){
|
if(!regionCache.containsKey(name)){
|
||||||
GenRegion region = new GenRegion(name);
|
GenRegion region = new GenRegion(name, null);
|
||||||
region.invalid = true;
|
region.invalid = true;
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
@@ -136,9 +137,11 @@ public class ImagePacker{
|
|||||||
static class GenRegion extends AtlasRegion{
|
static class GenRegion extends AtlasRegion{
|
||||||
String name;
|
String name;
|
||||||
boolean invalid;
|
boolean invalid;
|
||||||
|
Path path;
|
||||||
|
|
||||||
GenRegion(String name){
|
GenRegion(String name, Path path){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void validate(TextureRegion region){
|
static void validate(TextureRegion region){
|
||||||
|
|||||||