Added unit type unlocking / Fixed viewing of enemy block stats

This commit is contained in:
Anuken 2018-07-24 09:08:35 -04:00
parent 7e187a57d8
commit 9bc1ff8fa2
6 changed files with 15 additions and 17 deletions

View File

@ -65,7 +65,7 @@ public class OverlayRenderer{
Vector2 vec = Graphics.world(input.getMouseX(), input.getMouseY());
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();
if(showBlockDebug && target.entity != null){

View File

@ -13,6 +13,7 @@ import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.Puddle;
import io.anuke.mindustry.entities.effect.RubbleDecal;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.graphics.CacheLayer;
import io.anuke.mindustry.graphics.Layer;
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.Mathf;
import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world;
import static io.anuke.mindustry.Vars.*;
public class Block extends BaseBlock implements Content{
private static int lastid;
@ -181,6 +181,13 @@ public class Block extends BaseBlock implements Content{
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. */
@Override
public void init(){

View File

@ -21,9 +21,6 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
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{
protected final static float hardnessDrillMultiplier = 50f;
protected final int timerDump = timers++;
@ -187,10 +184,7 @@ public class Drill extends Block{
int index = entity.index % toAdd.size;
offloadNear(tile, toAdd.get(index));
//unlock item content
if(!headless){
control.database().unlockContent(toAdd.get(index));
}
useContent(toAdd.get(index));
entity.index++;
entity.progress = 0f;

View File

@ -22,9 +22,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.control;
import static io.anuke.mindustry.Vars.headless;
public class GenericCrafter extends Block{
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());
//unlock output item
if(!headless){
control.database().unlockContent(output);
}
useContent(output);
offloadNear(tile, output);
Effects.effect(craftEffect, tile.drawx(), tile.drawy());

View File

@ -229,6 +229,8 @@ public class CoreBlock extends StorageBlock{
unit.setDead(true);
unit.add();
useContent(droneType);
entity.droneID = unit.id;
}
}

View File

@ -176,6 +176,7 @@ public class UnitFactory extends Block{
entity.open = true;
Timers.run(openDuration / 1.5f, () -> CallBlocks.onUnitFactorySpawn(tile));
useContent(type);
entity.openCountdown = openDuration;