mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-21 05:17:50 +03:00
🗺 Locate existing mechpads (#915)
* Stash prototype * Only target mechpads of the same team * Switch from chessboard lookup to indexer * Point using cubes * Delegate * tilesize
This commit is contained in:
parent
485fc3ea2a
commit
f07239d8c2
@ -12,8 +12,11 @@ import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.input.*;
|
||||
import io.anuke.mindustry.type.Category;
|
||||
import io.anuke.mindustry.ui.Cicon;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.units.MechPad;
|
||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@ -57,6 +60,20 @@ public class OverlayRenderer{
|
||||
Draw.reset();
|
||||
}
|
||||
});
|
||||
|
||||
if(ui.hudfrag.blockfrag.currentCategory == Category.upgrade){
|
||||
for(Tile mechpad: indexer.getAllied(player.getTeam(), BlockFlag.mechPad)){
|
||||
if(!rect.setSize(Core.camera.width * 0.9f, Core.camera.height * 0.9f)
|
||||
.setCenter(Core.camera.position.x, Core.camera.position.y).contains(mechpad.x, mechpad.y)){
|
||||
|
||||
Tmp.v1.set(mechpad.worldx(), mechpad.worldy()).sub(Core.camera.position.x, Core.camera.position.y).setLength(indicatorLength);
|
||||
|
||||
Lines.stroke(2f, ((MechPad) mechpad.block()).mech.engineColor);
|
||||
Lines.lineAngle(Core.camera.position.x + Tmp.v1.x, Core.camera.position.y + Tmp.v1.y, Tmp.v1.angle(), 0.5f);
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(player.isDead()) return; //dead players don't draw
|
||||
|
@ -26,10 +26,10 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class PlacementFragment extends Fragment{
|
||||
final int rowWidth = 4;
|
||||
|
||||
public Category currentCategory = Category.distribution;
|
||||
Array<Block> returnArray = new Array<>();
|
||||
Array<Category> returnCatArray = new Array<>();
|
||||
boolean[] categoryEmpty = new boolean[Category.all.length];
|
||||
Category currentCategory = Category.distribution;
|
||||
ObjectMap<Category,Block> selectedBlocks = new ObjectMap<Category,Block>();
|
||||
Block hovered, lastDisplay;
|
||||
Tile lastHover;
|
||||
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.units;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.EnumSet;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
@ -24,7 +25,7 @@ import java.io.*;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class MechPad extends Block{
|
||||
protected @NonNull Mech mech;
|
||||
public @NonNull Mech mech;
|
||||
protected float buildTime = 60 * 5;
|
||||
|
||||
public MechPad(String name){
|
||||
@ -33,6 +34,7 @@ public class MechPad extends Block{
|
||||
solid = false;
|
||||
hasPower = true;
|
||||
layer = Layer.overlay;
|
||||
flags = EnumSet.of(BlockFlag.mechPad);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,9 @@ public enum BlockFlag{
|
||||
/** Only the command center block.*/
|
||||
comandCenter,
|
||||
/** Repair point. */
|
||||
repair;
|
||||
repair,
|
||||
/** Upgrade pad. */
|
||||
mechPad;
|
||||
|
||||
public final static BlockFlag[] all = values();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user