More bugfixes

This commit is contained in:
Anuken 2018-02-27 19:13:08 -05:00
parent 828dd78611
commit f72fd01050
9 changed files with 26 additions and 18 deletions

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Mon Feb 26 23:26:06 EST 2018
#Tue Feb 27 19:00:42 EST 2018
version=release
androidBuildCode=308
androidBuildCode=311
name=Mindustry
code=3.4
build=29

View File

@ -169,8 +169,8 @@ public class Pathfind{
/**Reset and clear the paths.*/
public void resetPaths(){
for(SpawnPoint point : world.getSpawns()){
resetPathFor(point);
for(int i = 0; i < world.getSpawns().size; i ++){
resetPathFor(world.getSpawns().get(i));
}
}

View File

@ -156,6 +156,8 @@ public class Player extends SyncEntity{
return;
}
if(isDead()) return;
Tile tile = world.tileWorld(x, y);
//if player is in solid block

View File

@ -228,7 +228,8 @@ public class EnemyType {
//no tile found
if(enemy.target == null){
enemy.target = Entities.getClosest(playerGroup, enemy.x, enemy.y, range, e -> !((Player)e).isAndroid);
enemy.target = Entities.getClosest(playerGroup, enemy.x, enemy.y, range, e -> !((Player)e).isAndroid &&
!((Player)e).isDead());
}
}else if(nearCore){
enemy.target = world.getCore().entity;

View File

@ -177,7 +177,7 @@ public class BlockRenderer{
OrthographicCamera camera = Core.camera;
Graphics.end();
if(Graphics.drawing()) Graphics.end();
int crangex = (int)(camera.viewportWidth * camera.zoom / (chunksize * tilesize))+1;
int crangey = (int)(camera.viewportHeight * camera.zoom / (chunksize * tilesize))+1;

View File

@ -127,7 +127,7 @@ public abstract class InputHandler extends InputAdapter{
}
public void breakBlock(int x, int y, boolean sound){
if(!Net.client()) Placement.breakBlock(x, y, sound, sound);
if(!Net.client()) Placement.breakBlock(x, y, true, sound);
if(Net.active()){
NetEvents.handleBreak(x, y);

View File

@ -82,7 +82,7 @@ public class Maps implements Disposable{
if(!gwt) {
if (!loadMapFile(customMapDirectory.child("maps.json"), false)) {
try {
Log.info("Failed to find custom map directory. Creating one instead.");
Log.info("Failed to find custom map directory.");
customMapDirectory.child("maps.json").writeString("{}", false);
} catch (Exception e) {
throw new RuntimeException("Failed to create custom map directory!");
@ -161,21 +161,24 @@ public class Maps implements Disposable{
}
private boolean loadMapFile(FileHandle file, boolean logException){
try{
try {
Array<Map> arr = json.fromJson(ArrayContainer.class, file).maps;
if(arr != null){ //can be an empty map file
for(Map map : arr){
if (arr != null) { //can be an empty map file
for (Map map : arr) {
map.pixmap = new Pixmap(file.sibling(map.name + ".png"));
if(!headless) map.texture = new Texture(map.pixmap);
if (!headless) map.texture = new Texture(map.pixmap);
maps.put(map.id, map);
mapNames.put(map.name, map);
lastID = Math.max(lastID, map.id);
if(!map.custom){
if (!map.custom) {
defaultMaps.add(map);
}
}
}
return true;
}catch (GdxRuntimeException e){
Log.err(e);
return true;
}catch(Exception e){
if(logException) {
Log.err(e);

View File

@ -307,7 +307,7 @@ public class Save15 extends SaveFileVersion {
for(int y = 0; y < world.height(); y ++){
Tile tile = world.tile(x, y);
if(tile.breakable()){
if(tile != null && tile.breakable()){
if(tile.block() instanceof Rock){
totalrocks ++;
}else{
@ -325,7 +325,7 @@ public class Save15 extends SaveFileVersion {
for (int y = 0; y < world.height(); y++) {
Tile tile = world.tile(x, y);
if (tile.block() instanceof Rock) {
if (tile != null && tile.block() instanceof Rock) {
stream.writeInt(tile.packedPosition());
}
}
@ -338,7 +338,7 @@ public class Save15 extends SaveFileVersion {
for(int y = 0; y < world.height(); y ++){
Tile tile = world.tile(x, y);
if(tile.breakable() && !(tile.block() instanceof Rock)){
if(tile != null && tile.breakable() && !(tile.block() instanceof Rock)){
stream.writeInt(x + y*world.width()); //tile pos
stream.writeInt(tile.block().id); //block ID

View File

@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.defense;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.world.Layer;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Timers;
@ -80,9 +81,10 @@ public class RepairTurret extends PowerTurret{
@Override
public void drawLayer2(Tile tile){
PowerTurretEntity entity = tile.entity();
TileEntity target = entity.blockTarget;
if(entity.power >= powerUsed && entity.blockTarget != null && Angles.angleDist(entity.angleTo(entity.blockTarget), entity.rotation) < 10){
Tile targetTile = entity.blockTarget.tile;
if(entity.power >= powerUsed && target != null && Angles.angleDist(entity.angleTo(target), entity.rotation) < 10){
Tile targetTile = target.tile;
float len = 4f;
float x = tile.drawx() + Angles.trnsx(entity.rotation, len), y = tile.drawy() + Angles.trnsy(entity.rotation, len);