Bugfixes
This commit is contained in:
@@ -5,11 +5,11 @@ import arc.func.*;
|
|||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.type.*;
|
import mindustry.entities.type.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.game.Teams.*;
|
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
@@ -34,6 +34,8 @@ public class BlockIndexer{
|
|||||||
private ObjectSet<Tile>[] damagedTiles = new ObjectSet[Team.all().length];
|
private ObjectSet<Tile>[] damagedTiles = new ObjectSet[Team.all().length];
|
||||||
/**All ores available on this map.*/
|
/**All ores available on this map.*/
|
||||||
private ObjectSet<Item> allOres = new ObjectSet<>();
|
private ObjectSet<Item> allOres = new ObjectSet<>();
|
||||||
|
/**Stores teams that are present here as tiles.*/
|
||||||
|
private ObjectSet<Team> activeTeams = new ObjectSet<>();
|
||||||
|
|
||||||
/** Maps teams to a map of flagged tiles by type. */
|
/** Maps teams to a map of flagged tiles by type. */
|
||||||
private ObjectSet<Tile>[][] flagMap = new ObjectSet[Team.all().length][BlockFlag.all.length];
|
private ObjectSet<Tile>[][] flagMap = new ObjectSet[Team.all().length][BlockFlag.all.length];
|
||||||
@@ -104,10 +106,11 @@ public class BlockIndexer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GridBits structQuadrant(Team t){
|
private GridBits structQuadrant(Team t){
|
||||||
if(structQuadrants[t.id] == null){
|
int id = Pack.u(t.id);
|
||||||
structQuadrants[t.id] = new GridBits(Mathf.ceil(world.width() / (float)quadrantSize), Mathf.ceil(world.height() / (float)quadrantSize));
|
if(structQuadrants[id] == null){
|
||||||
|
structQuadrants[id] = new GridBits(Mathf.ceil(world.width() / (float)quadrantSize), Mathf.ceil(world.height() / (float)quadrantSize));
|
||||||
}
|
}
|
||||||
return structQuadrants[t.id];
|
return structQuadrants[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates all the structure quadrants for a newly activated team. */
|
/** Updates all the structure quadrants for a newly activated team. */
|
||||||
@@ -184,6 +187,19 @@ public class BlockIndexer{
|
|||||||
set.add(entity.tile);
|
set.add(entity.tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TileEntity findEnemyTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
||||||
|
for(Team enemy : activeTeams){
|
||||||
|
if(!team.isEnemy(enemy)) continue;
|
||||||
|
|
||||||
|
TileEntity entity = indexer.findTile(enemy, x, y, range, pred, true);
|
||||||
|
if(entity != null){
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public TileEntity findTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
public TileEntity findTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
||||||
return findTile(team, x, y, range, pred, false);
|
return findTile(team, x, y, range, pred, false);
|
||||||
}
|
}
|
||||||
@@ -263,6 +279,7 @@ public class BlockIndexer{
|
|||||||
}
|
}
|
||||||
typeMap.put(tile.pos(), new TileIndex(tile.block().flags, tile.getTeam()));
|
typeMap.put(tile.pos(), new TileIndex(tile.block().flags, tile.getTeam()));
|
||||||
}
|
}
|
||||||
|
activeTeams.add(tile.getTeam());
|
||||||
|
|
||||||
if(ores == null) return;
|
if(ores == null) return;
|
||||||
|
|
||||||
@@ -301,13 +318,12 @@ public class BlockIndexer{
|
|||||||
//this quadrant is now 'dirty', re-scan the whole thing
|
//this quadrant is now 'dirty', re-scan the whole thing
|
||||||
int quadrantX = tile.x / quadrantSize;
|
int quadrantX = tile.x / quadrantSize;
|
||||||
int quadrantY = tile.y / quadrantSize;
|
int quadrantY = tile.y / quadrantSize;
|
||||||
int index = quadrantX + quadrantY * quadWidth();
|
|
||||||
|
|
||||||
for(TeamData data : state.teams.getActive()){
|
for(Team team : activeTeams){
|
||||||
GridBits bits = structQuadrant(data.team);
|
GridBits bits = structQuadrant(team);
|
||||||
|
|
||||||
//fast-set this quadrant to 'occupied' if the tile just placed is already of this team
|
//fast-set this quadrant to 'occupied' if the tile just placed is already of this team
|
||||||
if(tile.getTeam() == data.team && tile.entity != null && tile.block().targetable){
|
if(tile.getTeam() == team && tile.entity != null && tile.block().targetable){
|
||||||
bits.set(quadrantX, quadrantY);
|
bits.set(quadrantX, quadrantY);
|
||||||
continue; //no need to process futher
|
continue; //no need to process futher
|
||||||
}
|
}
|
||||||
@@ -319,7 +335,7 @@ public class BlockIndexer{
|
|||||||
for(int y = quadrantY * quadrantSize; y < world.height() && y < (quadrantY + 1) * quadrantSize; y++){
|
for(int y = quadrantY * quadrantSize; y < world.height() && y < (quadrantY + 1) * quadrantSize; y++){
|
||||||
Tile result = world.ltile(x, y);
|
Tile result = world.ltile(x, y);
|
||||||
//when a targetable block is found, mark this quadrant as occupied and stop searching
|
//when a targetable block is found, mark this quadrant as occupied and stop searching
|
||||||
if(result.entity != null && result.getTeam() == data.team){
|
if(result.entity != null && result.getTeam() == team){
|
||||||
bits.set(quadrantX, quadrantY);
|
bits.set(quadrantX, quadrantY);
|
||||||
break outer;
|
break outer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,13 +83,7 @@ public class Units{
|
|||||||
public static TileEntity findEnemyTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
public static TileEntity findEnemyTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
||||||
if(team == Team.derelict) return null;
|
if(team == Team.derelict) return null;
|
||||||
|
|
||||||
for(Team enemy : team.enemies()){
|
return indexer.findEnemyTile(team, x, y, range, pred);
|
||||||
TileEntity entity = indexer.findTile(enemy, x, y, range, pred, true);
|
|
||||||
if(entity != null){
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ public class MinimapRenderer implements Disposable{
|
|||||||
float ry = !withLabels ? (unit.y - rect.y) / rect.width * h : unit.y / (world.height() * tilesize) * h;
|
float ry = !withLabels ? (unit.y - rect.y) / rect.width * h : unit.y / (world.height() * tilesize) * h;
|
||||||
|
|
||||||
Draw.mixcol(unit.getTeam().color, 1f);
|
Draw.mixcol(unit.getTeam().color, 1f);
|
||||||
float scale = Scl.scl(1f) / 2f * scaling;
|
float scale = Scl.scl(1f) / 2f * scaling * 32f;
|
||||||
Draw.rect(unit.getIconRegion(), x + rx, y + ry, unit.getIconRegion().getWidth() * scale, unit.getIconRegion().getHeight() * scale, unit.rotation - 90);
|
Draw.rect(unit.getIconRegion(), x + rx, y + ry, scale, scale, unit.rotation - 90);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
if(withLabels && unit instanceof Player){
|
if(withLabels && unit instanceof Player){
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
ui.listfrag.toggle();
|
ui.listfrag.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if((player.getClosestCore() == null || state.isPaused()) && !ui.chatfrag.shown()){
|
if(((player.getClosestCore() == null && player.isDead()) || state.isPaused()) && !ui.chatfrag.shown()){
|
||||||
//move camera around
|
//move camera around
|
||||||
float camSpeed = !Core.input.keyDown(Binding.dash) ? 3f : 8f;
|
float camSpeed = !Core.input.keyDown(Binding.dash) ? 3f : 8f;
|
||||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import static mindustry.Vars.*;
|
|||||||
public class MinimapFragment extends Fragment{
|
public class MinimapFragment extends Fragment{
|
||||||
private boolean shown;
|
private boolean shown;
|
||||||
private float panx, pany, zoom = 1f, lastZoom = -1;
|
private float panx, pany, zoom = 1f, lastZoom = -1;
|
||||||
private float baseSize = Scl.scl(1000f);
|
private float baseSize = Scl.scl(5f);
|
||||||
private Element elem;
|
private Element elem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -25,16 +25,17 @@ public class MinimapFragment extends Fragment{
|
|||||||
elem = parent.fill((x, y, w, h) -> {
|
elem = parent.fill((x, y, w, h) -> {
|
||||||
w = Core.graphics.getWidth();
|
w = Core.graphics.getWidth();
|
||||||
h = Core.graphics.getHeight();
|
h = Core.graphics.getHeight();
|
||||||
float size = baseSize * zoom;
|
float size = baseSize * zoom * world.width();
|
||||||
|
|
||||||
Draw.color(Color.black);
|
Draw.color(Color.black);
|
||||||
Fill.crect(x, y, w, h);
|
Fill.crect(x, y, w, h);
|
||||||
|
|
||||||
if(renderer.minimap.getTexture() != null){
|
if(renderer.minimap.getTexture() != null){
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
float ratio = (float)renderer.minimap.getTexture().getHeight() / renderer.minimap.getTexture().getWidth();
|
||||||
TextureRegion reg = Draw.wrap(renderer.minimap.getTexture());
|
TextureRegion reg = Draw.wrap(renderer.minimap.getTexture());
|
||||||
Draw.rect(reg, w/2f + panx*zoom, h/2f + pany*zoom, size, size);
|
Draw.rect(reg, w/2f + panx*zoom, h/2f + pany*zoom, size, size * ratio);
|
||||||
renderer.minimap.drawEntities(w/2f + panx*zoom - size/2f, h/2f + pany*zoom - size/2f, size, size, zoom, true);
|
renderer.minimap.drawEntities(w/2f + panx*zoom - size/2f, h/2f + pany*zoom - size/2f * ratio, size, size * ratio, zoom, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
5
fastlane/metadata/android/en-US/changelogs/29570.txt
Normal file
5
fastlane/metadata/android/en-US/changelogs/29570.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
- Added new map view w/ panning and scrolling
|
||||||
|
- Added block health rule
|
||||||
|
- Added more internal teams for alternative gamemodes
|
||||||
|
- Added features for improved server modding
|
||||||
|
- Major internal change: package is now "mindustry" instead of "io.anuke.mindustry" (will break plugins)
|
||||||
Reference in New Issue
Block a user