Fixed #2591 / Fixed #2591 / Fixed #2589 / Fixed #2587

This commit is contained in:
Anuken
2020-09-18 11:21:50 -04:00
parent c71be9ae32
commit 6b6783f201
21 changed files with 4512 additions and 4335 deletions

View File

@@ -312,3 +312,4 @@
63432=dacite-boulder|block-dacite-boulder-medium 63432=dacite-boulder|block-dacite-boulder-medium
63431=large-logic-display|block-large-logic-display-medium 63431=large-logic-display|block-large-logic-display-medium
63430=omura|unit-omura-medium 63430=omura|unit-omura-medium
63429=mud|block-mud-medium

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

After

Width:  |  Height:  |  Size: 811 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 657 KiB

After

Width:  |  Height:  |  Size: 656 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 KiB

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 KiB

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 KiB

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 KiB

After

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -58,6 +58,7 @@ public class FormationAI extends AIController implements FormationMember{
public void removed(Unit unit){ public void removed(Unit unit){
if(formation != null){ if(formation != null){
formation.removeMember(this); formation.removeMember(this);
unit.resetController();
} }
} }

View File

@@ -35,6 +35,7 @@ public class PhysicsProcess implements AsyncProcess{
refs.removeAll(ref -> { refs.removeAll(ref -> {
if(!ref.entity.isAdded()){ if(!ref.entity.isAdded()){
physics.destroyBody(ref.body); physics.destroyBody(ref.body);
ref.entity.physref(null);
return true; return true;
} }
return false; return false;

View File

@@ -231,8 +231,14 @@ public class MapEditor{
int px = offsetX + x, py = offsetY + y; int px = offsetX + x, py = offsetY + y;
if(previous.in(px, py)){ if(previous.in(px, py)){
tiles.set(x, y, previous.getn(px, py)); tiles.set(x, y, previous.getn(px, py));
tiles.getn(x, y).x = (short)x; Tile tile = tiles.getn(x, y);
tiles.getn(x, y).y = (short)y; tile.x = (short)x;
tile.y = (short)y;
if(tile.build != null && tile.isCenter()){
tile.build.x = x * tilesize + tile.block().offset;
tile.build.y = y * tilesize + tile.block().offset;
}
}else{ }else{
tiles.set(x, y, new EditorTile(x, y, Blocks.stone.id, (short)0, (short)0)); tiles.set(x, y, new EditorTile(x, y, Blocks.stone.id, (short)0, (short)0));
} }

View File

@@ -48,6 +48,9 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
unit.remove(); unit.remove();
payloads.add(new UnitPayload(unit)); payloads.add(new UnitPayload(unit));
Fx.unitPickup.at(unit); Fx.unitPickup.at(unit);
if(Vars.net.client()){
Vars.netClient.clearRemovedEntity(unit.id);
}
} }
void pickup(Building tile){ void pickup(Building tile){

View File

@@ -225,7 +225,7 @@ public class DesktopInput extends InputHandler{
if(!player.dead() && !state.isPaused() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ if(!player.dead() && !state.isPaused() && !(Core.scene.getKeyboardFocus() instanceof TextField)){
updateMovement(player.unit()); updateMovement(player.unit());
if(Core.input.keyDown(Binding.respawn) && !player.unit().spawnedByCore()){ if(Core.input.keyDown(Binding.respawn) && !player.unit().spawnedByCore() && !scene.hasField()){
Call.unitClear(player); Call.unitClear(player);
controlledType = null; controlledType = null;
} }

View File

@@ -3,6 +3,7 @@ package mindustry.io;
import arc.*; import arc.*;
import arc.files.*; import arc.files.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*;
import arc.util.io.*; import arc.util.io.*;
import mindustry.*; import mindustry.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
@@ -41,7 +42,7 @@ public class SaveIO{
if(exists) file.moveTo(backupFileFor(file)); if(exists) file.moveTo(backupFileFor(file));
try{ try{
write(file); write(file);
}catch(Exception e){ }catch(Throwable e){
if(exists) backupFileFor(file).moveTo(file); if(exists) backupFileFor(file).moveTo(file);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -56,9 +57,9 @@ public class SaveIO{
} }
public static boolean isSaveValid(Fi file){ public static boolean isSaveValid(Fi file){
try{ try(DataInputStream stream = new DataInputStream(new InflaterInputStream(file.read(bufferSize)))){
return isSaveValid(new DataInputStream(new InflaterInputStream(file.read(bufferSize)))); return isSaveValid(stream);
}catch(Exception e){ }catch(Throwable e){
return false; return false;
} }
} }
@@ -67,8 +68,8 @@ public class SaveIO{
try{ try{
getMeta(stream); getMeta(stream);
return true; return true;
}catch(Exception e){ }catch(Throwable e){
e.printStackTrace(); Log.err(e);
return false; return false;
} }
} }
@@ -76,8 +77,8 @@ public class SaveIO{
public static SaveMeta getMeta(Fi file){ public static SaveMeta getMeta(Fi file){
try{ try{
return getMeta(getStream(file)); return getMeta(getStream(file));
}catch(Exception e){ }catch(Throwable e){
e.printStackTrace(); Log.err(e);
return getMeta(getBackupStream(file)); return getMeta(getBackupStream(file));
} }
} }
@@ -120,7 +121,7 @@ public class SaveIO{
}else{ }else{
getVersion().write(stream, tags); getVersion().write(stream, tags);
} }
}catch(Exception e){ }catch(Throwable e){
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@@ -134,7 +135,7 @@ public class SaveIO{
//try and load; if any exception at all occurs //try and load; if any exception at all occurs
load(new InflaterInputStream(file.read(bufferSize)), context); load(new InflaterInputStream(file.read(bufferSize)), context);
}catch(SaveException e){ }catch(SaveException e){
e.printStackTrace(); Log.err(e);
Fi backup = file.sibling(file.name() + "-backup." + file.extension()); Fi backup = file.sibling(file.name() + "-backup." + file.extension());
if(backup.exists()){ if(backup.exists()){
load(new InflaterInputStream(backup.read(bufferSize)), context); load(new InflaterInputStream(backup.read(bufferSize)), context);
@@ -154,7 +155,7 @@ public class SaveIO{
ver.read(stream, counter, context); ver.read(stream, counter, context);
Events.fire(new SaveLoadEvent()); Events.fire(new SaveLoadEvent());
}catch(Exception e){ }catch(Throwable e){
throw new SaveException(e); throw new SaveException(e);
}finally{ }finally{
world.setGenerating(false); world.setGenerating(false);

View File

@@ -377,8 +377,18 @@ public class ResearchDialog extends BaseDialog{
} }
boolean canSpend(TechNode node){ boolean canSpend(TechNode node){
//can spend when there's at least 1 item that can be spent if(!selectable(node)) return false;
return selectable(node) && (node.requirements.length == 0 || Structs.contains(node.requirements, i -> items.has(i.item)));
if(node.requirements.length == 0) return true;
//can spend when there's at least 1 item that can be spent (non complete)
for(int i = 0; i < node.requirements.length; i++){
if(node.finishedRequirements[i].amount < node.requirements[i].amount && items.has(node.requirements[i].item)){
return true;
}
}
return false;
} }
void spend(TechNode node){ void spend(TechNode node){