Set cleanup
This commit is contained in:
@@ -3,6 +3,7 @@ package mindustry.world;
|
||||
import arc.func.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.math.geom.QuadTree.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
@@ -15,7 +16,7 @@ import mindustry.world.modules.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Tile implements Position{
|
||||
public class Tile implements Position, QuadTreeObject{
|
||||
/** Tile traversal cost. */
|
||||
public byte cost = 1;
|
||||
/** Tile entity, usually null. */
|
||||
@@ -377,7 +378,12 @@ public class Tile implements Position{
|
||||
}
|
||||
|
||||
public Rect getHitbox(Rect rect){
|
||||
return rect.setSize(block().size * tilesize).setCenter(drawx(), drawy());
|
||||
return rect.setCentered(drawx(), drawy(), block.size * tilesize, block.size * tilesize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hitbox(Rect rect){
|
||||
getHitbox(rect);
|
||||
}
|
||||
|
||||
public Tile getNearby(Point2 relative){
|
||||
|
||||
@@ -9,6 +9,7 @@ import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.ai.BlockIndexer.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
@@ -94,9 +95,9 @@ public class CommandCenter extends Block{
|
||||
@Override
|
||||
public void placed(){
|
||||
super.placed();
|
||||
ObjectSet<Tile> set = indexer.getAllied(team, BlockFlag.comandCenter);
|
||||
TileArray set = indexer.getAllied(team, BlockFlag.comandCenter);
|
||||
|
||||
if(set.size > 0){
|
||||
if(set.size() > 0){
|
||||
CommandCenterEntity oe = set.first().ent();
|
||||
command = oe.command;
|
||||
}
|
||||
@@ -106,9 +107,9 @@ public class CommandCenter extends Block{
|
||||
public void onRemoved(){
|
||||
super.onRemoved();
|
||||
|
||||
ObjectSet<Tile> set = indexer.getAllied(team, BlockFlag.comandCenter);
|
||||
TileArray set = indexer.getAllied(team, BlockFlag.comandCenter);
|
||||
|
||||
if(set.size == 1){
|
||||
if(set.size() == 1){
|
||||
Groups.unit.each(t -> t.team() == team, u -> u.controller().command(UnitCommand.all[0]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user