This commit is contained in:
Anuken
2021-09-11 08:45:17 -04:00
parent cccce6badd
commit c5a90759e5
3 changed files with 13 additions and 4 deletions

View File

@@ -114,7 +114,7 @@ public class Renderer implements ApplicationListener{
public void update(){ public void update(){
Color.white.set(1f, 1f, 1f, 1f); Color.white.set(1f, 1f, 1f, 1f);
float dest = Mathf.round(targetscale, 0.5f); float dest = Mathf.clamp(Mathf.round(targetscale, 0.5f), minScale(), maxScale());
camerascale = Mathf.lerpDelta(camerascale, dest, 0.1f); camerascale = Mathf.lerpDelta(camerascale, dest, 0.1f);
if(Mathf.equal(camerascale, dest, 0.001f)) camerascale = dest; if(Mathf.equal(camerascale, dest, 0.001f)) camerascale = dest;
laserOpacity = settings.getInt("lasersopacity") / 100f; laserOpacity = settings.getInt("lasersopacity") / 100f;

View File

@@ -292,15 +292,20 @@ public class Schematics implements Loadable{
private void checkLoadout(Schematic s, boolean validate){ private void checkLoadout(Schematic s, boolean validate){
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock); Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);
int cores = s.tiles.count(t -> t.block instanceof CoreBlock); int cores = s.tiles.count(t -> t.block instanceof CoreBlock);
int maxSize = getMaxLaunchSize(core.block);
//make sure a core exists, and that the schematic is small enough. //make sure a core exists, and that the schematic is small enough.
if(core == null || (validate && (s.width > core.block.size + maxLoadoutSchematicPad *2 || s.height > core.block.size + maxLoadoutSchematicPad *2 if(core == null || (validate && (s.width > maxSize || s.height > maxSize
|| s.tiles.contains(t -> t.block.buildVisibility == BuildVisibility.sandboxOnly || !t.block.unlocked()) || cores > 1))) return; || s.tiles.contains(t -> t.block.buildVisibility == BuildVisibility.sandboxOnly || !t.block.unlocked()) || cores > 1))) return;
//place in the cache //place in the cache
loadouts.get((CoreBlock)core.block, Seq::new).add(s); loadouts.get((CoreBlock)core.block, Seq::new).add(s);
} }
public int getMaxLaunchSize(Block block){
return block.size + maxLoadoutSchematicPad*2;
}
/** Adds a schematic to the list, also copying it into the files.*/ /** Adds a schematic to the list, also copying it into the files.*/
public void add(Schematic schematic){ public void add(Schematic schematic){
all.add(schematic); all.add(schematic);

View File

@@ -230,8 +230,12 @@ public class SettingsMenuDialog extends Dialog{
platform.shareFile(logs); platform.shareFile(logs);
}else{ }else{
platform.showFileChooser(false, "txt", file -> { platform.showFileChooser(false, "txt", file -> {
file.writeString(getLogs()); try{
app.post(() -> ui.showInfo("@crash.exported")); file.writeBytes(getLogs().getBytes(Strings.utf8));
app.post(() -> ui.showInfo("@crash.exported"));
}catch(Throwable e){
ui.showException(e);
}
}); });
} }
} }