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

View File

@@ -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;

View File

@@ -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),

View File

@@ -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;

View File

@@ -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;

View File

@@ -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());