Many misc bugfixes

This commit is contained in:
Anuken
2022-04-28 19:46:52 -04:00
parent 60c74ee65d
commit 9f501a33a3
8 changed files with 44 additions and 9 deletions

View File

@@ -586,6 +586,7 @@ objective.enemiesapproaching = [accent]Enemies approaching in [lightgray]{0}[]
objective.destroycore = [accent]Destroy Enemy Core objective.destroycore = [accent]Destroy Enemy Core
objective.command = [accent]Command Units objective.command = [accent]Command Units
objective.nuclearlaunch = [accent]\u26a0 Nuclear launch detected: [lightgray]{0} objective.nuclearlaunch = [accent]\u26a0 Nuclear launch detected: [lightgray]{0}
announce.nuclearstrike = [scarlet]\u26a0 NUCLEAR STRIKE INBOUND \u26a0
loadout = Loadout loadout = Loadout
resources = Resources resources = Resources

Binary file not shown.

View File

@@ -187,7 +187,7 @@ public class Fx{
color(Pal.command); color(Pal.command);
stroke(e.fout(Interp.pow5Out) * 4f); 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 -> { coreBuildBlock = new Effect(80f, e -> {

View File

@@ -53,6 +53,7 @@ public class Control implements ApplicationListener, Loadable{
private Interval timer = new Interval(2); private Interval timer = new Interval(2);
private boolean hiscore = false; private boolean hiscore = false;
private boolean wasPaused = false; private boolean wasPaused = false;
private Seq<Building> toBePlaced = new Seq<>(false);
public Control(){ public Control(){
saves = new Saves(); saves = new Saves();
@@ -98,6 +99,7 @@ public class Control implements ApplicationListener, Loadable{
Events.on(ResetEvent.class, event -> { Events.on(ResetEvent.class, event -> {
player.reset(); player.reset();
toBePlaced.clear();
hiscore = false; hiscore = false;
saves.resetSave(); saves.resetSave();
@@ -212,6 +214,7 @@ public class Control implements ApplicationListener, Loadable{
if(state.isCampaign()){ if(state.isCampaign()){
if(state.rules.sector.planet.prebuildBase){ if(state.rules.sector.planet.prebuildBase){
toBePlaced.clear();
float unitsPerTick = 2f; float unitsPerTick = 2f;
float buildRadius = state.rules.enemyCoreBuildRadius * 1.5f; float buildRadius = state.rules.enemyCoreBuildRadius * 1.5f;
@@ -226,15 +229,14 @@ public class Control implements ApplicationListener, Loadable{
build.tile.remove(); build.tile.remove();
anyBuilds = true; anyBuilds = true;
Time.run(build.dst(ccore) * unitsPerTick + coreDelay, () -> { toBePlaced.add(build);
//TODO instance reuse bad?
build.tile.setBlock(build.block, build.team, build.rotation, () -> build);
//TODO dropped bad? Time.run(build.dst(ccore) / unitsPerTick + coreDelay, () -> {
build.dropped(); if(build.tile.build != build){
placeLandBuild(build);
Fx.coreBuildBlock.at(build.x, build.y, 0f, build.block); toBePlaced.remove(build);
Fx.placeBlock.at(build.x, build.y, build.block.size); }
}); });
} }
} }
@@ -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 @Override

View File

@@ -56,6 +56,7 @@ public class EventType{
public static class DisposeEvent{} public static class DisposeEvent{}
public static class PlayEvent{} public static class PlayEvent{}
public static class ResetEvent{} public static class ResetEvent{}
public static class HostEvent{}
public static class WaveEvent{} public static class WaveEvent{}
public static class TurnEvent{} public static class TurnEvent{}
/** Called when the player places a line, mobile or desktop.*/ /** Called when the player places a line, mobile or desktop.*/

View File

@@ -1,5 +1,6 @@
package mindustry.logic; package mindustry.logic;
import arc.*;
import arc.graphics.*; import arc.graphics.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
@@ -1449,6 +1450,13 @@ public class LExecutor{
} }
String text = exec.textBuffer.toString(); 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){ switch(type){
case notify -> ui.hudfrag.showToast(Icon.info, text); case notify -> ui.hudfrag.showToast(Icon.info, text);
case announce -> ui.announce(text, exec.numf(duration)); case announce -> ui.announce(text, exec.numf(duration));

View File

@@ -5,6 +5,7 @@ import arc.scene.ui.*;
import arc.util.*; import arc.util.*;
import mindustry.*; import mindustry.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.game.EventType.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.ui.*; import mindustry.ui.*;
@@ -65,6 +66,7 @@ public class HostDialog extends BaseDialog{
try{ try{
net.host(Vars.port); net.host(Vars.port);
player.admin = true; player.admin = true;
Events.fire(new HostEvent());
if(steam){ if(steam){
Core.app.post(() -> Core.settings.getBoolOnce("steampublic3", () -> { Core.app.post(() -> Core.settings.getBoolOnce("steampublic3", () -> {

View File

@@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
archash=646d76bb50 archash=7f36a32bec