mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-08-03 00:19:44 +07:00
Don't configure processor when no changes are made
This commit is contained in:
@ -45,6 +45,7 @@ public class AndroidLauncher extends AndroidApplication{
|
||||
handler.uncaughtException(thread, error);
|
||||
}else{
|
||||
error.printStackTrace();
|
||||
Log.err(error);
|
||||
System.exit(1);
|
||||
}
|
||||
});
|
||||
|
@ -136,7 +136,9 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
int rot = (int)((rotation + 45f) / 90f) % 4;
|
||||
payload.place(on, rot);
|
||||
|
||||
if(isPlayer()) payload.build.lastAccessed = getPlayer().name;
|
||||
if(getControllerName() != null){
|
||||
payload.build.lastAccessed = getControllerName();
|
||||
}
|
||||
|
||||
Fx.unitDrop.at(tile);
|
||||
Fx.placeBlock.at(on.drawx(), on.drawy(), on.block().size);
|
||||
|
@ -445,6 +445,15 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
remove();
|
||||
}
|
||||
|
||||
/** @return name of direct or indirect player controller. */
|
||||
@Override
|
||||
public @Nullable String getControllerName(){
|
||||
if(isPlayer()) return getPlayer().name;
|
||||
if(controller instanceof LogicAI ai && ai.controller != null) return ai.controller.lastAccessed;
|
||||
if(controller instanceof FormationAI ai && ai.leader != null && ai.leader.isPlayer()) return ai.leader.getPlayer().name;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
type.display(self(), table);
|
||||
|
@ -3,6 +3,7 @@ package mindustry.logic;
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.scene.ui.TextButton.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.LStatements.*;
|
||||
import mindustry.ui.*;
|
||||
@ -90,16 +91,20 @@ public class LogicDialog extends BaseDialog{
|
||||
onResize(() -> canvas.rebuild());
|
||||
}
|
||||
|
||||
public void show(String code, Cons<String> consumer){
|
||||
public void show(String code, Cons<String> modified){
|
||||
canvas.statements.clearChildren();
|
||||
canvas.rebuild();
|
||||
try{
|
||||
canvas.load(code);
|
||||
}catch(Throwable t){
|
||||
t.printStackTrace();
|
||||
Log.err(t);
|
||||
canvas.load("");
|
||||
}
|
||||
this.consumer = consumer;
|
||||
this.consumer = result -> {
|
||||
if(!result.equals(code)){
|
||||
modified.get(result);
|
||||
}
|
||||
};
|
||||
|
||||
show();
|
||||
}
|
||||
|
@ -47,7 +47,12 @@ public class CrashSender{
|
||||
|
||||
public static void send(Throwable exception, Cons<File> writeListener){
|
||||
try{
|
||||
exception.printStackTrace();
|
||||
try{
|
||||
//log to file
|
||||
Log.err(exception);
|
||||
}catch(Throwable no){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
//try saving game data
|
||||
try{
|
||||
|
@ -45,7 +45,10 @@ public class Build{
|
||||
build.setDeconstruct(previous);
|
||||
build.prevBuild = prevBuild;
|
||||
tile.build.health = tile.build.maxHealth * prevPercent;
|
||||
if(unit != null && unit.isPlayer()) tile.build.lastAccessed = unit.getPlayer().name;
|
||||
|
||||
if(unit != null && unit.getControllerName() != null){
|
||||
tile.build.lastAccessed = unit.getControllerName();
|
||||
}
|
||||
|
||||
Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, unit, true)));
|
||||
}
|
||||
@ -64,7 +67,7 @@ public class Build{
|
||||
|
||||
//auto-rotate the block to the correct orientation and bail out
|
||||
if(tile.team() == team && tile.block == result && tile.build != null && tile.block.quickRotate){
|
||||
if(unit != null && unit.isPlayer()) tile.build.lastAccessed = unit.getPlayer().name;
|
||||
if(unit != null && unit.getControllerName() != null) tile.build.lastAccessed = unit.getControllerName();
|
||||
tile.build.rotation = Mathf.mod(rotation, 4);
|
||||
tile.build.updateProximity();
|
||||
tile.build.noSleep();
|
||||
@ -90,7 +93,7 @@ public class Build{
|
||||
|
||||
build.setConstruct(previous.size == sub.size ? previous : Blocks.air, result);
|
||||
build.prevBuild = prevBuild;
|
||||
if(unit != null && unit.isPlayer()) build.lastAccessed = unit.getPlayer().name;
|
||||
if(unit != null && unit.getControllerName() != null) build.lastAccessed = unit.getControllerName();
|
||||
|
||||
result.placeBegan(tile, previous);
|
||||
|
||||
|
@ -78,8 +78,8 @@ public class ConstructBlock extends Block{
|
||||
tile.build.overwrote(prev);
|
||||
}
|
||||
|
||||
if(builder != null && builder.isPlayer()){
|
||||
tile.build.lastAccessed = builder.getPlayer().name;
|
||||
if(builder != null && builder.getControllerName() != null){
|
||||
tile.build.lastAccessed = builder.getControllerName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,9 +477,7 @@ public class LogicBlock extends Block{
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
table.button(Icon.pencil, Styles.clearTransi, () -> {
|
||||
Vars.ui.logic.show(code, code -> {
|
||||
configure(compress(code, relativeConnections()));
|
||||
});
|
||||
Vars.ui.logic.show(code, code -> configure(compress(code, relativeConnections())));
|
||||
}).size(40);
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=e77f5b14f5d621df62c7739854468ddae0c6c7ea
|
||||
archash=638a163631aa138e4fc4a90efe1bd8113e27a489
|
||||
|
@ -255,6 +255,7 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
||||
}catch(Throwable t){
|
||||
//attempt to log the exception
|
||||
CrashSender.log(t);
|
||||
Log.err(t);
|
||||
//rethrow the exception so it actually crashes
|
||||
throw t;
|
||||
}
|
||||
|
Reference in New Issue
Block a user