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.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

Binary file not shown.

View File

@ -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 -> {

View File

@ -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

View File

@ -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.*/

View File

@ -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));

View File

@ -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", () -> {

View File

@ -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