Many misc bugfixes
This commit is contained in:
@@ -187,7 +187,7 @@ public class Fx{
|
||||
|
||||
color(Pal.command);
|
||||
stroke(e.fout(Interp.pow5Out) * 4f);
|
||||
Lines.circle(e.x, e.y, e.fin() * e.rotation);
|
||||
Lines.circle(e.x, e.y, e.fin() * e.rotation * 2f);
|
||||
}),
|
||||
|
||||
coreBuildBlock = new Effect(80f, e -> {
|
||||
|
||||
@@ -53,6 +53,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
private Interval timer = new Interval(2);
|
||||
private boolean hiscore = false;
|
||||
private boolean wasPaused = false;
|
||||
private Seq<Building> toBePlaced = new Seq<>(false);
|
||||
|
||||
public Control(){
|
||||
saves = new Saves();
|
||||
@@ -98,6 +99,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
|
||||
Events.on(ResetEvent.class, event -> {
|
||||
player.reset();
|
||||
toBePlaced.clear();
|
||||
|
||||
hiscore = false;
|
||||
saves.resetSave();
|
||||
@@ -212,6 +214,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
if(state.isCampaign()){
|
||||
|
||||
if(state.rules.sector.planet.prebuildBase){
|
||||
toBePlaced.clear();
|
||||
float unitsPerTick = 2f;
|
||||
float buildRadius = state.rules.enemyCoreBuildRadius * 1.5f;
|
||||
|
||||
@@ -226,15 +229,14 @@ public class Control implements ApplicationListener, Loadable{
|
||||
build.tile.remove();
|
||||
anyBuilds = true;
|
||||
|
||||
Time.run(build.dst(ccore) * unitsPerTick + coreDelay, () -> {
|
||||
//TODO instance reuse bad?
|
||||
build.tile.setBlock(build.block, build.team, build.rotation, () -> build);
|
||||
toBePlaced.add(build);
|
||||
|
||||
//TODO dropped bad?
|
||||
build.dropped();
|
||||
Time.run(build.dst(ccore) / unitsPerTick + coreDelay, () -> {
|
||||
if(build.tile.build != build){
|
||||
placeLandBuild(build);
|
||||
|
||||
Fx.coreBuildBlock.at(build.x, build.y, 0f, build.block);
|
||||
Fx.placeBlock.at(build.x, build.y, build.block.size);
|
||||
toBePlaced.remove(build);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -251,6 +253,27 @@ public class Control implements ApplicationListener, Loadable{
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(SaveWriteEvent.class, e -> forcePlaceAll());
|
||||
Events.on(HostEvent.class, e -> forcePlaceAll());
|
||||
}
|
||||
|
||||
private void forcePlaceAll(){
|
||||
//force set buildings when a save is done or map is hosted, to prevent desyncs
|
||||
for(var build : toBePlaced){
|
||||
placeLandBuild(build);
|
||||
}
|
||||
|
||||
toBePlaced.clear();
|
||||
}
|
||||
|
||||
private void placeLandBuild(Building build){
|
||||
//TODO instance reuse bad?
|
||||
build.tile.setBlock(build.block, build.team, build.rotation, () -> build);
|
||||
//TODO dropped bad?
|
||||
build.dropped();
|
||||
|
||||
Fx.coreBuildBlock.at(build.x, build.y, 0f, build.block);
|
||||
Fx.placeBlock.at(build.x, build.y, build.block.size);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,6 +56,7 @@ public class EventType{
|
||||
public static class DisposeEvent{}
|
||||
public static class PlayEvent{}
|
||||
public static class ResetEvent{}
|
||||
public static class HostEvent{}
|
||||
public static class WaveEvent{}
|
||||
public static class TurnEvent{}
|
||||
/** Called when the player places a line, mobile or desktop.*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.logic;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
@@ -1449,6 +1450,13 @@ public class LExecutor{
|
||||
}
|
||||
|
||||
String text = exec.textBuffer.toString();
|
||||
if(text.startsWith("@")){
|
||||
String substr = text.substring(1);
|
||||
if(Core.bundle.has(substr)){
|
||||
text = Core.bundle.get(substr);
|
||||
}
|
||||
}
|
||||
|
||||
switch(type){
|
||||
case notify -> ui.hudfrag.showToast(Icon.info, text);
|
||||
case announce -> ui.announce(text, exec.numf(duration));
|
||||
|
||||
@@ -5,6 +5,7 @@ import arc.scene.ui.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
@@ -65,6 +66,7 @@ public class HostDialog extends BaseDialog{
|
||||
try{
|
||||
net.host(Vars.port);
|
||||
player.admin = true;
|
||||
Events.fire(new HostEvent());
|
||||
|
||||
if(steam){
|
||||
Core.app.post(() -> Core.settings.getBoolOnce("steampublic3", () -> {
|
||||
|
||||
Reference in New Issue
Block a user