Merge branch 'master' into do-you-hear-the-voices-too
This commit is contained in:
@@ -4152,6 +4152,7 @@ public class Blocks{
|
||||
|
||||
liquidConsumed = 10f / 60f;
|
||||
targetInterval = 5f;
|
||||
newTargetInterval = 30f;
|
||||
targetUnderBlocks = false;
|
||||
|
||||
float r = range = 130f;
|
||||
@@ -4242,6 +4243,8 @@ public class Blocks{
|
||||
shootY = 7f;
|
||||
rotateSpeed = 1.4f;
|
||||
minWarmup = 0.85f;
|
||||
|
||||
newTargetInterval = 40f;
|
||||
shootWarmupSpeed = 0.07f;
|
||||
|
||||
coolant = consume(new ConsumeLiquid(Liquids.water, 30f / 60f));
|
||||
@@ -4462,6 +4465,8 @@ public class Blocks{
|
||||
heatRequirement = 10f;
|
||||
maxHeatEfficiency = 2f;
|
||||
|
||||
newTargetInterval = 40f;
|
||||
|
||||
inaccuracy = 1f;
|
||||
shake = 2f;
|
||||
shootY = 4;
|
||||
@@ -4684,6 +4689,8 @@ public class Blocks{
|
||||
shootSound = Sounds.missileLaunch;
|
||||
|
||||
minWarmup = 0.94f;
|
||||
newTargetInterval = 40f;
|
||||
unitSort = UnitSorts.strongest;
|
||||
shootWarmupSpeed = 0.03f;
|
||||
targetAir = false;
|
||||
targetUnderBlocks = false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.core;
|
||||
|
||||
import arc.*;
|
||||
import arc.filedialogs.*;
|
||||
import arc.files.*;
|
||||
import arc.func.*;
|
||||
import arc.math.*;
|
||||
@@ -141,7 +142,51 @@ public interface Platform{
|
||||
* @param title The title of the native dialog
|
||||
*/
|
||||
default void showFileChooser(boolean open, String title, String extension, Cons<Fi> cons){
|
||||
if(OS.isLinux && !OS.isAndroid){
|
||||
if(OS.isWindows || OS.isMac){
|
||||
String formatted = (title.startsWith("@") ? Core.bundle.get(title.substring(1)) : title).replaceAll("\"", "'");
|
||||
|
||||
//native file dialog
|
||||
Threads.daemon(() -> {
|
||||
try{
|
||||
FileDialogs.loadNatives();
|
||||
|
||||
String result;
|
||||
//on MacOS, .msav is not properly recognized until I put garbage into the array?
|
||||
String[] extensions = OS.isMac && open ? new String[]{"", "*." + extension} : new String[]{"*." + extension};
|
||||
|
||||
if(open){
|
||||
result = FileDialogs.openFileDialog(formatted, FileChooser.getLastDirectory().absolutePath(), extensions, "." + extension + " files", false);
|
||||
}else{
|
||||
result = FileDialogs.saveFileDialog(formatted, FileChooser.getLastDirectory().child("file." + extension).absolutePath(), extensions, "." + extension + " files");
|
||||
}
|
||||
|
||||
if(result == null) return;
|
||||
|
||||
if(result.length() > 1 && result.contains("\n")){
|
||||
result = result.split("\n")[0];
|
||||
}
|
||||
|
||||
//cancelled selection, ignore result
|
||||
if(result.isEmpty() || result.equals("\n")) return;
|
||||
if(result.endsWith("\n")) result = result.substring(0, result.length() - 1);
|
||||
if(result.contains("\n")) throw new IOException("invalid input: \"" + result + "\"");
|
||||
|
||||
Fi file = Core.files.absolute(result);
|
||||
Core.app.post(() -> {
|
||||
FileChooser.setLastDirectory(file.isDirectory() ? file : file.parent());
|
||||
|
||||
if(!open){
|
||||
cons.get(file.parent().child(file.nameWithoutExtension() + "." + extension));
|
||||
}else{
|
||||
cons.get(file);
|
||||
}
|
||||
});
|
||||
}catch(Throwable error){
|
||||
Log.err("Failure to execute native file chooser", error);
|
||||
Core.app.post(() -> defaultFileDialog(open, title, extension, cons));
|
||||
}
|
||||
});
|
||||
}else if(OS.isLinux && !OS.isAndroid){
|
||||
showZenity(open, title, new String[]{extension}, cons, () -> defaultFileDialog(open, title, extension, cons));
|
||||
}else{
|
||||
defaultFileDialog(open, title, extension, cons);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MapLoadDialog extends BaseDialog{
|
||||
ButtonGroup<Button> group = new ButtonGroup<>();
|
||||
|
||||
int i = 0;
|
||||
int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(250f)), 1);
|
||||
int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(300f)), 1);
|
||||
|
||||
Table table = new Table();
|
||||
table.defaults().size(250f, 90f).pad(4f);
|
||||
@@ -53,7 +53,7 @@ public class MapLoadDialog extends BaseDialog{
|
||||
table.button(b -> {
|
||||
b.add(new BorderImage(map.safeTexture(), 2f).setScaling(Scaling.fit)).padLeft(5f).size(16 * 4f);
|
||||
b.add(map.name()).wrap().grow().labelAlign(Align.center).padLeft(5f);
|
||||
}, Styles.squareTogglet, () -> selected = map).group(group).checked(b -> selected == map);
|
||||
}, Styles.squareTogglet, () -> selected = map).group(group).margin(8f).checked(b -> selected == map);
|
||||
|
||||
if(++i % cols == 0) table.row();
|
||||
}
|
||||
|
||||
@@ -146,6 +146,11 @@ public class ContentParser{
|
||||
readFields(result, data);
|
||||
return result;
|
||||
});
|
||||
put(MassDriverBolt.class, (type, data) -> {
|
||||
MassDriverBolt result = (MassDriverBolt)make(MassDriverBolt.class);
|
||||
readFields(result, data);
|
||||
return result;
|
||||
});
|
||||
put(AmmoType.class, (type, data) -> {
|
||||
//string -> item
|
||||
//if liquid ammo support is added, this should scan for liquids as well
|
||||
|
||||
@@ -36,6 +36,8 @@ public class Turret extends ReloadTurret{
|
||||
public final int timerTarget = timers++;
|
||||
/** Ticks between attempt at finding a target. */
|
||||
public float targetInterval = 20;
|
||||
/** Target interval for when this turret already has a valid target. -1 = targetInterval */
|
||||
public float newTargetInterval = -1f;
|
||||
|
||||
/** Maximum ammo units stored. */
|
||||
public int maxAmmo = 30;
|
||||
@@ -176,6 +178,7 @@ public class Turret extends ReloadTurret{
|
||||
if(elevation < 0) elevation = size / 2f;
|
||||
if(recoilTime < 0f) recoilTime = reload;
|
||||
if(cooldownTime < 0f) cooldownTime = reload;
|
||||
if(newTargetInterval <= 0f) newTargetInterval = targetInterval;
|
||||
|
||||
super.init();
|
||||
}
|
||||
@@ -405,7 +408,7 @@ public class Turret extends ReloadTurret{
|
||||
if(hasAmmo()){
|
||||
if(Float.isNaN(reloadCounter)) reloadCounter = 0;
|
||||
|
||||
if(timer(timerTarget, targetInterval)){
|
||||
if(timer(timerTarget, target != null ? newTargetInterval : targetInterval)){
|
||||
findTarget();
|
||||
}
|
||||
|
||||
@@ -438,6 +441,8 @@ public class Turret extends ReloadTurret{
|
||||
wasShooting = true;
|
||||
updateShooting();
|
||||
}
|
||||
}else{
|
||||
target = null;
|
||||
}
|
||||
|
||||
if(alwaysShooting){
|
||||
|
||||
Reference in New Issue
Block a user