diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 213a9ce6e4..2cb62f7456 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -586,6 +586,7 @@ objective.enemiesapproaching = [accent]Enemies approaching in [lightgray]{0}[] objective.destroycore = [accent]Destroy Enemy Core objective.command = [accent]Command Units objective.nuclearlaunch = [accent]\u26a0 Nuclear launch detected: [lightgray]{0} +announce.nuclearstrike = [scarlet]\u26a0 NUCLEAR STRIKE INBOUND \u26a0 loadout = Loadout resources = Resources diff --git a/core/assets/maps/three.msav b/core/assets/maps/three.msav index ba57f72906..88ec17deda 100644 Binary files a/core/assets/maps/three.msav and b/core/assets/maps/three.msav differ diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 85b8b37045..86199b5f81 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -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 -> { diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 972255e19a..05d16ac26c 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -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 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 diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index d213c5d1f9..790cd1d07e 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -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.*/ diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 79894f5372..da0a743a62 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -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)); diff --git a/core/src/mindustry/ui/dialogs/HostDialog.java b/core/src/mindustry/ui/dialogs/HostDialog.java index 05cd5375ce..8432977984 100644 --- a/core/src/mindustry/ui/dialogs/HostDialog.java +++ b/core/src/mindustry/ui/dialogs/HostDialog.java @@ -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", () -> { diff --git a/gradle.properties b/gradle.properties index 9a212a5c1a..675f91763b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=646d76bb50 +archash=7f36a32bec