Fixed #4474 / Fixed #4475 / Fixed #4476 / Fixed #4483

This commit is contained in:
Anuken
2021-01-31 15:51:42 -05:00
parent f1a5aae30a
commit 3d201f7042
5 changed files with 31 additions and 20 deletions

View File

@@ -263,7 +263,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(player.team().core() == null){ if(player.team().core() == null){
player.set(world.width() * tilesize/2f, world.height() * tilesize/2f); player.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
player.unit(UnitTypes.alpha.spawn(player.team(), player.x, player.y)); var unit = UnitTypes.alpha.spawn(player.team(), player.x, player.y);
unit.spawnedByCore = true;
player.unit(unit);
} }
}); });
} }

View File

@@ -285,30 +285,32 @@ public class MapGenerateDialog extends BaseDialog{
void showAdd(){ void showAdd(){
BaseDialog selection = new BaseDialog("@add"); BaseDialog selection = new BaseDialog("@add");
selection.setFillParent(false); selection.cont.pane(p -> {
selection.cont.defaults().size(210f, 60f); p.marginRight(14);
int i = 0; p.defaults().size(210f, 60f);
for(Prov<GenerateFilter> gen : filterTypes){ int i = 0;
GenerateFilter filter = gen.get(); for(Prov<GenerateFilter> gen : filterTypes){
GenerateFilter filter = gen.get();
if((filter.isPost() && applied)) continue; if((filter.isPost() && applied)) continue;
selection.cont.button(filter.name(), () -> { p.button(filter.name(), () -> {
filters.add(filter); filters.add(filter);
rebuildFilters();
update();
selection.hide();
});
if(++i % 2 == 0) p.row();
}
p.button("@filter.defaultores", () -> {
maps.addDefaultOres(filters);
rebuildFilters(); rebuildFilters();
update(); update();
selection.hide(); selection.hide();
}); });
if(++i % 2 == 0) selection.cont.row(); }).get().setScrollingDisabled(true, false);
} F
selection.cont.button("@filter.defaultores", () -> {
maps.addDefaultOres(filters);
rebuildFilters();
update();
selection.hide();
});
selection.addCloseButton(); selection.addCloseButton();
selection.show(); selection.show();
} }

View File

@@ -123,6 +123,7 @@ public class Universe{
} }
/** @return the last selected loadout for this specific core type. */ /** @return the last selected loadout for this specific core type. */
@Nullable
public Schematic getLoadout(CoreBlock core){ public Schematic getLoadout(CoreBlock core){
//for tools - schem //for tools - schem
if(schematics == null) return Loadouts.basicShard; if(schematics == null) return Loadouts.basicShard;
@@ -134,7 +135,7 @@ public class Universe{
Seq<Schematic> all = schematics.getLoadouts(core); Seq<Schematic> all = schematics.getLoadouts(core);
Schematic schem = all.find(s -> s.file != null && s.file.nameWithoutExtension().equals(file)); Schematic schem = all.find(s -> s.file != null && s.file.nameWithoutExtension().equals(file));
return schem == null ? all.first() : schem; return schem == null ? all.any() ? all.first() : null : schem;
} }
/** Runs possible events. Resets event counter. */ /** Runs possible events. Resets event counter. */

View File

@@ -299,6 +299,10 @@ public class UnitType extends UnlockableContent{
} }
} }
if(weapons.isEmpty()){
range = maxRange = 0f;
}
if(mechStride < 0){ if(mechStride < 0){
mechStride = 4f + (hitSize -8f)/2.1f; mechStride = 4f + (hitSize -8f)/2.1f;
} }

View File

@@ -5,6 +5,7 @@ import arc.func.*;
import arc.scene.ui.*; import arc.scene.ui.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.struct.*; import arc.struct.*;
import mindustry.content.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -105,6 +106,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(230)), 1); int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(230)), 1);
ButtonGroup<Button> group = new ButtonGroup<>(); ButtonGroup<Button> group = new ButtonGroup<>();
selected = universe.getLoadout(core); selected = universe.getLoadout(core);
if(selected == null) selected = schematics.getLoadouts().get((CoreBlock)Blocks.coreShard).first();
cont.add(Core.bundle.format("launch.from", sector.name())).row(); cont.add(Core.bundle.format("launch.from", sector.name())).row();