Nerfed drone mined speed, new ore sprite packing
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 241 B |
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
|
||||
|
||||
|
||||
@Override
|
||||
public float getMinePower() {
|
||||
return mech.mineSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion getIconRegion() {
|
||||
return mech.iconRegion;
|
||||
|
@ -52,6 +52,9 @@ public interface BuilderTrait {
|
||||
/**Sets the tile this builder is currently mining.*/
|
||||
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.*/
|
||||
float getBuildPower(Tile tile);
|
||||
|
||||
@ -115,38 +118,6 @@ public interface BuilderTrait {
|
||||
if(unit.distanceTo(tile) > placeDistance) { //out of range, skip it.
|
||||
getPlaceQueue().removeFirst();
|
||||
}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(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);
|
||||
|
||||
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,
|
||||
tile.worldx() + Mathf.range(tilesize/2f),
|
||||
tile.worldy() + Mathf.range(tilesize/2f),
|
||||
|
@ -100,6 +100,11 @@ public class Drone extends FlyingUnit implements BuilderTrait {
|
||||
return 0.3f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinePower() {
|
||||
return 0.7f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue<BuildRequest> getPlaceQueue() {
|
||||
return placeQueue;
|
||||
|
@ -14,6 +14,7 @@ public class Mech extends Upgrade {
|
||||
public float mass = 1f;
|
||||
public float armor = 1f;
|
||||
|
||||
public float mineSpeed = 1f;
|
||||
public int drillPower = -1;
|
||||
public float carryWeight = 10f;
|
||||
public float buildPower = 1f;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
@ -24,26 +23,18 @@ public class OreBlock extends Floor {
|
||||
@Override
|
||||
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;
|
||||
|
||||
Draw.color(0f, 0f, 0f, 0.2f);
|
||||
Draw.rect(variants > 0 ? (drops.item.name + rand) : name, tile.worldx(), tile.worldy() - 1);
|
||||
Draw.color();
|
||||
Draw.rect(variants > 0 ? (drops.item.name + rand) : name, tile.worldx(), tile.worldy());
|
||||
// Draw.color(0f, 0f, 0f, 0.2f);
|
||||
//Draw.rect(variants > 0 ? (drops.item.name + rand) : name, tile.worldx(), tile.worldy() - 1);
|
||||
//Draw.color();
|
||||
Draw.rect(name + rand, tile.worldx(), tile.worldy());
|
||||
|
||||
drawEdges(tile, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] getIcon() {
|
||||
if(icon == null){
|
||||
icon = new TextureRegion[]{Draw.region(drops.item.name + "1")};
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawNonLayer(Tile tile){
|
||||
MathUtils.random.setSeed(tile.id());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Mech;
|
||||
@ -67,8 +68,27 @@ public class Generators {
|
||||
Item item = ore.drops.item;
|
||||
Block base = ore.base;
|
||||
|
||||
//get base image to draw on
|
||||
Image image = context.get(base.name);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
//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));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@ -16,6 +17,7 @@ public class Image {
|
||||
|
||||
private BufferedImage image;
|
||||
private Graphics2D graphics;
|
||||
private Color color = new Color();
|
||||
|
||||
public Image(BufferedImage atlas, TextureRegion region){
|
||||
this.atlas = atlas;
|
||||
@ -28,6 +30,25 @@ public class Image {
|
||||
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.*/
|
||||
public void draw(TextureRegion region){
|
||||
draw(region, 0, 0, false, false);
|
||||
|