Added unit type unlocking / Fixed viewing of enemy block stats
This commit is contained in:
@@ -65,7 +65,7 @@ public class OverlayRenderer{
|
|||||||
Vector2 vec = Graphics.world(input.getMouseX(), input.getMouseY());
|
Vector2 vec = Graphics.world(input.getMouseX(), input.getMouseY());
|
||||||
Tile tile = world.tileWorld(vec.x, vec.y);
|
Tile tile = world.tileWorld(vec.x, vec.y);
|
||||||
|
|
||||||
if(tile != null && tile.block() != Blocks.air){
|
if(tile != null && tile.block() != Blocks.air && tile.getTeam() == players[0].getTeam()){
|
||||||
Tile target = tile.target();
|
Tile target = tile.target();
|
||||||
|
|
||||||
if(showBlockDebug && target.entity != null){
|
if(showBlockDebug && target.entity != null){
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import io.anuke.mindustry.entities.bullet.Bullet;
|
|||||||
import io.anuke.mindustry.entities.effect.Puddle;
|
import io.anuke.mindustry.entities.effect.Puddle;
|
||||||
import io.anuke.mindustry.entities.effect.RubbleDecal;
|
import io.anuke.mindustry.entities.effect.RubbleDecal;
|
||||||
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;
|
||||||
@@ -29,8 +30,7 @@ import io.anuke.ucore.util.Bundles;
|
|||||||
import io.anuke.ucore.util.EnumSet;
|
import io.anuke.ucore.util.EnumSet;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
import static io.anuke.mindustry.Vars.world;
|
|
||||||
|
|
||||||
public class Block extends BaseBlock implements Content{
|
public class Block extends BaseBlock implements Content{
|
||||||
private static int lastid;
|
private static int lastid;
|
||||||
@@ -181,6 +181,13 @@ public class Block extends BaseBlock implements Content{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Call when some content is produced. This unlocks the content if it is applicable.*/
|
||||||
|
public void useContent(UnlockableContent content){
|
||||||
|
if(!headless){
|
||||||
|
control.database().unlockContent(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Called after all blocks are created. */
|
/** Called after all blocks are created. */
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.control;
|
|
||||||
import static io.anuke.mindustry.Vars.headless;
|
|
||||||
|
|
||||||
public class Drill extends Block{
|
public class Drill extends Block{
|
||||||
protected final static float hardnessDrillMultiplier = 50f;
|
protected final static float hardnessDrillMultiplier = 50f;
|
||||||
protected final int timerDump = timers++;
|
protected final int timerDump = timers++;
|
||||||
@@ -187,10 +184,7 @@ public class Drill extends Block{
|
|||||||
int index = entity.index % toAdd.size;
|
int index = entity.index % toAdd.size;
|
||||||
offloadNear(tile, toAdd.get(index));
|
offloadNear(tile, toAdd.get(index));
|
||||||
|
|
||||||
//unlock item content
|
useContent(toAdd.get(index));
|
||||||
if(!headless){
|
|
||||||
control.database().unlockContent(toAdd.get(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.index++;
|
entity.index++;
|
||||||
entity.progress = 0f;
|
entity.progress = 0f;
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.control;
|
|
||||||
import static io.anuke.mindustry.Vars.headless;
|
|
||||||
|
|
||||||
public class GenericCrafter extends Block{
|
public class GenericCrafter extends Block{
|
||||||
protected final int timerDump = timers++;
|
protected final int timerDump = timers++;
|
||||||
|
|
||||||
@@ -93,10 +90,7 @@ public class GenericCrafter extends Block{
|
|||||||
|
|
||||||
if(consumes.has(ConsumeItem.class)) tile.entity.items.remove(consumes.item(), consumes.itemAmount());
|
if(consumes.has(ConsumeItem.class)) tile.entity.items.remove(consumes.item(), consumes.itemAmount());
|
||||||
|
|
||||||
//unlock output item
|
useContent(output);
|
||||||
if(!headless){
|
|
||||||
control.database().unlockContent(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
offloadNear(tile, output);
|
offloadNear(tile, output);
|
||||||
Effects.effect(craftEffect, tile.drawx(), tile.drawy());
|
Effects.effect(craftEffect, tile.drawx(), tile.drawy());
|
||||||
|
|||||||
@@ -229,6 +229,8 @@ public class CoreBlock extends StorageBlock{
|
|||||||
unit.setDead(true);
|
unit.setDead(true);
|
||||||
unit.add();
|
unit.add();
|
||||||
|
|
||||||
|
useContent(droneType);
|
||||||
|
|
||||||
entity.droneID = unit.id;
|
entity.droneID = unit.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ public class UnitFactory extends Block{
|
|||||||
entity.open = true;
|
entity.open = true;
|
||||||
|
|
||||||
Timers.run(openDuration / 1.5f, () -> CallBlocks.onUnitFactorySpawn(tile));
|
Timers.run(openDuration / 1.5f, () -> CallBlocks.onUnitFactorySpawn(tile));
|
||||||
|
useContent(type);
|
||||||
|
|
||||||
entity.openCountdown = openDuration;
|
entity.openCountdown = openDuration;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user