Nerfed drone mined speed, new ore sprite packing

This commit is contained in:
Anuken
2018-06-25 15:05:42 -04:00
parent f4c9645d73
commit 92a748a762
18 changed files with 808 additions and 451 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 241 B

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 122 KiB

@@ -90,6 +90,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
//region unit and event overrides, utility methods //region unit and event overrides, utility methods
@Override
public float getMinePower() {
return mech.mineSpeed;
}
@Override @Override
public TextureRegion getIconRegion() { public TextureRegion getIconRegion() {
return mech.iconRegion; return mech.iconRegion;
@@ -52,6 +52,9 @@ public interface BuilderTrait {
/**Sets the tile this builder is currently mining.*/ /**Sets the tile this builder is currently mining.*/
void setMineTile(Tile tile); void setMineTile(Tile tile);
/**Returns the minining speed of this miner. 1 = standard, 0.5 = half speed, 2 = double speed, etc.*/
float getMinePower();
/**Build power, can be any float. 1 = builds recipes in normal time, 0 = doesn't build at all.*/ /**Build power, can be any float. 1 = builds recipes in normal time, 0 = doesn't build at all.*/
float getBuildPower(Tile tile); float getBuildPower(Tile tile);
@@ -115,38 +118,6 @@ public interface BuilderTrait {
if(unit.distanceTo(tile) > placeDistance) { //out of range, skip it. if(unit.distanceTo(tile) > placeDistance) { //out of range, skip it.
getPlaceQueue().removeFirst(); getPlaceQueue().removeFirst();
}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
float progress = 1f / tile.getBreakTime() * Timers.delta() * getBuildPower(tile);
TileEntity core = unit.getClosestCore();
//update accumulation of resources to add
if(current.recipe != null && core != null){
for(int i = 0; i < current.recipe.requirements.length; i ++){
current.removeAccumulator[i] += current.recipe.requirements[i].amount*progress / 2f; //add scaled amount progressed to the accumulator
int amount = (int)(current.removeAccumulator[i]); //get amount
if(amount > 0){ //if it's positive, add it to the core
int accepting = core.tile.block().acceptStack(getCurrentRequest().recipe.requirements[i].item, amount, core.tile, unit);
core.tile.block().handleStack(getCurrentRequest().recipe.requirements[i].item, amount, core.tile, unit);
current.removeAccumulator[i] -= accepting;
}
}
}
current.progress += progress;
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.drawx(), tile.drawy()), 0.4f);
if(current.progress >= 1f){
//FIXME a player instace is required here, but the the builder may not be a player
CallBlocks.breakBlock((Player)unit, unit.getTeam(), current.x, current.y, true, true);
}
}else{
//otherwise, skip it
getPlaceQueue().removeFirst();
}*/
if (!(tile.block() instanceof BreakBlock)) { //check if haven't started placing if (!(tile.block() instanceof BreakBlock)) { //check if haven't started placing
if(Build.validBreak(unit.getTeam(), current.x, current.y)){ if(Build.validBreak(unit.getTeam(), current.x, current.y)){
@@ -217,7 +188,7 @@ public interface BuilderTrait {
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.worldx(), tile.worldy()), 0.4f); unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.worldx(), tile.worldy()), 0.4f);
if(unit.inventory.canAcceptItem(item) && if(unit.inventory.canAcceptItem(item) &&
Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01))){ Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
ItemTransfer.create(item, ItemTransfer.create(item,
tile.worldx() + Mathf.range(tilesize/2f), tile.worldx() + Mathf.range(tilesize/2f),
tile.worldy() + Mathf.range(tilesize/2f), tile.worldy() + Mathf.range(tilesize/2f),
@@ -100,6 +100,11 @@ public class Drone extends FlyingUnit implements BuilderTrait {
return 0.3f; return 0.3f;
} }
@Override
public float getMinePower() {
return 0.7f;
}
@Override @Override
public Queue<BuildRequest> getPlaceQueue() { public Queue<BuildRequest> getPlaceQueue() {
return placeQueue; return placeQueue;
@@ -14,6 +14,7 @@ public class Mech extends Upgrade {
public float mass = 1f; public float mass = 1f;
public float armor = 1f; public float armor = 1f;
public float mineSpeed = 1f;
public int drillPower = -1; public int drillPower = -1;
public float carryWeight = 10f; public float carryWeight = 10f;
public float buildPower = 1f; public float buildPower = 1f;
@@ -1,6 +1,5 @@
package io.anuke.mindustry.world.blocks; package io.anuke.mindustry.world.blocks;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.MathUtils;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
@@ -24,26 +23,18 @@ public class OreBlock extends Floor {
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
Draw.rect(base.variants > 0 ? (base.name + MathUtils.random(1, base.variants)) : base.name, tile.worldx(), tile.worldy()); //Draw.rect(base.variants > 0 ? (base.name + MathUtils.random(1, base.variants)) : base.name, tile.worldx(), tile.worldy());
int rand = variants > 0 ? MathUtils.random(1, variants) : 0; int rand = variants > 0 ? MathUtils.random(1, variants) : 0;
Draw.color(0f, 0f, 0f, 0.2f); // Draw.color(0f, 0f, 0f, 0.2f);
Draw.rect(variants > 0 ? (drops.item.name + rand) : name, tile.worldx(), tile.worldy() - 1); //Draw.rect(variants > 0 ? (drops.item.name + rand) : name, tile.worldx(), tile.worldy() - 1);
Draw.color(); //Draw.color();
Draw.rect(variants > 0 ? (drops.item.name + rand) : name, tile.worldx(), tile.worldy()); Draw.rect(name + rand, tile.worldx(), tile.worldy());
drawEdges(tile, false); drawEdges(tile, false);
} }
@Override
public TextureRegion[] getIcon() {
if(icon == null){
icon = new TextureRegion[]{Draw.region(drops.item.name + "1")};
}
return icon;
}
@Override @Override
public void drawNonLayer(Tile tile){ public void drawNonLayer(Tile tile){
MathUtils.random.setSeed(tile.id()); MathUtils.random.setSeed(tile.id());
+22 -2
View File
@@ -1,5 +1,6 @@
package io.anuke.mindustry; package io.anuke.mindustry;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Mech; import io.anuke.mindustry.type.Mech;
@@ -67,8 +68,27 @@ public class Generators {
Item item = ore.drops.item; Item item = ore.drops.item;
Block base = ore.base; Block base = ore.base;
//get base image to draw on for (int i = 0; i < 3; i++) {
Image image = context.get(base.name); //get base image to draw on
Image image = context.get(base.name + (i+1));
Image shadow = context.get(item.name + (i+1));
for (int x = 0; x < image.width(); x++) {
for (int y = 1; y < image.height(); y++) {
Color color = shadow.getColor(x, y - 1);
//draw semi transparent background
if(color.a > 0.001f){
color.set(0, 0, 0, 0.3f);
image.draw(x, y, color);
}
}
}
image.draw(context.get(item.name + (i+1)));
image.save("ore-" + item.name + "-" + base.name + (i+1));
}
} }
}); });
} }
+21
View File
@@ -1,5 +1,6 @@
package io.anuke.mindustry; package io.anuke.mindustry;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -16,6 +17,7 @@ public class Image {
private BufferedImage image; private BufferedImage image;
private Graphics2D graphics; private Graphics2D graphics;
private Color color = new Color();
public Image(BufferedImage atlas, TextureRegion region){ public Image(BufferedImage atlas, TextureRegion region){
this.atlas = atlas; this.atlas = atlas;
@@ -28,6 +30,25 @@ public class Image {
toDispose.add(this); toDispose.add(this);
} }
public int width(){
return image.getWidth();
}
public int height(){
return image.getHeight();
}
public Color getColor(int x, int y){
int i = image.getRGB(x, y);
Color.argb8888ToColor(color, i);
return color;
}
public void draw(int x, int y, Color color){
graphics.setColor(new java.awt.Color(color.r, color.g, color.b, color.a));
graphics.fillRect(x, y, 1, 1);
}
/**Draws a region at the top left corner.*/ /**Draws a region at the top left corner.*/
public void draw(TextureRegion region){ public void draw(TextureRegion region){
draw(region, 0, 0, false, false); draw(region, 0, 0, false, false);