diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 247d617982..d8c0afdca0 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -41,8 +41,8 @@ public class Vars{ public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases"; public static final int maxTextLength = 150; public static final int maxNameLength = 40; - public static final int maxCharNameLength = 20; - public static final int saveSlots = 64; + //public static final int maxCharNameLength = 20; + // public static final int saveSlots = 64; public static final float itemSize = 5f; public static final int tilesize = 8; public static final int sectorSize = 256; diff --git a/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java b/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java index f75d363d81..325090dedb 100644 --- a/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/CraftingBlocks.java @@ -21,7 +21,7 @@ public class CraftingBlocks extends BlockList implements ContentList{ health = 70; result = Items.carbide; craftTime = 45f; - burnDuration = 35f; + burnDuration = 46f; useFlux = true; consumes.items(new ItemStack[]{new ItemStack(Items.tungsten, 3)}); diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index c5896f38f3..d9ba73b386 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -276,7 +276,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra @Override public void drawShadow(){ - Draw.rect(mech.iconRegion, x - elevation * elevationScale, y - elevation * elevationScale, rotation - 90); + Draw.rect(mech.iconRegion, x , y, rotation - 90); } @Override diff --git a/core/src/io/anuke/mindustry/entities/Unit.java b/core/src/io/anuke/mindustry/entities/Unit.java index 8ad6360042..0053b63bfa 100644 --- a/core/src/io/anuke/mindustry/entities/Unit.java +++ b/core/src/io/anuke/mindustry/entities/Unit.java @@ -19,6 +19,7 @@ import io.anuke.ucore.entities.impl.DestructibleEntity; import io.anuke.ucore.entities.trait.DamageTrait; import io.anuke.ucore.entities.trait.DrawTrait; import io.anuke.ucore.entities.trait.SolidTrait; +import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Fill; import io.anuke.ucore.util.Geometry; import io.anuke.ucore.util.Mathf; @@ -44,7 +45,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ * Maximum absolute value of a velocity vector component. */ public static final float maxAbsVelocity = 127f / velocityPercision; - public static final float elevationScale = 4f; private static final Vector2 moveVector = new Vector2(); @@ -59,7 +59,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ protected Vector2 velocity = new Translator(0f, 0.0001f); protected float hitTime; protected float drownTime; - protected float elevation; @Override public UnitInventory getInventory(){ @@ -235,10 +234,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ if(isFlying()){ x += velocity.x / getMass() * Timers.delta(); y += velocity.y / getMass() * Timers.delta(); - - if(tile != null){ - elevation = Mathf.lerpDelta(elevation, tile.elevation, 0.04f); - } }else{ boolean onLiquid = floor.isLiquid; @@ -318,6 +313,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ } public void drawShadow(){ + Draw.rect(getIconRegion(), x , y, rotation - 90); } public void drawView(){ diff --git a/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java b/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java index 60c7c8ff0a..02fae5f6fc 100644 --- a/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java @@ -123,11 +123,6 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ } - @Override - public void drawShadow(){ - Draw.rect(type.region, x - elevation * elevationScale, y - elevation * elevationScale, rotation - 90); - } - @Override public CarriableTrait getCarry(){ return carrying; diff --git a/core/src/io/anuke/mindustry/game/Saves.java b/core/src/io/anuke/mindustry/game/Saves.java index 11701cf1d3..c4e3477b28 100644 --- a/core/src/io/anuke/mindustry/game/Saves.java +++ b/core/src/io/anuke/mindustry/game/Saves.java @@ -4,9 +4,9 @@ import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.game.EventType.StateChangeEvent; -import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.io.SaveMeta; +import io.anuke.mindustry.maps.Map; import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Timers; @@ -33,12 +33,15 @@ public class Saves{ public void load(){ saves.clear(); - for(int i = 0; i < saveSlots; i++){ - if(SaveIO.isSaveValid(i)){ - SaveSlot slot = new SaveSlot(i); + int[] slots = Settings.getJson("save-slots", int[].class); + + for(int i = 0; i < slots.length; i++){ + int index = slots[i]; + if(SaveIO.isSaveValid(index)){ + SaveSlot slot = new SaveSlot(index); saves.add(slot); - slot.meta = SaveIO.getData(i); - nextSlot = i + 1; + slot.meta = SaveIO.getData(index); + nextSlot = Math.max(index + 1, nextSlot); } } } @@ -80,10 +83,6 @@ public class Saves{ return saving; } - public boolean canAddSave(){ - return nextSlot < saveSlots; - } - public void addSave(String name){ SaveSlot slot = new SaveSlot(nextSlot); nextSlot++; @@ -92,6 +91,8 @@ public class Saves{ SaveIO.saveToSlot(slot.index); slot.meta = SaveIO.getData(slot.index); current = slot; + + saveSlots(); } public SaveSlot importSave(FileHandle file) throws IOException{ @@ -102,6 +103,7 @@ public class Saves{ saves.add(slot); slot.meta = SaveIO.getData(slot.index); current = slot; + saveSlots(); return slot; } @@ -109,6 +111,15 @@ public class Saves{ return saves; } + private void saveSlots(){ + int[] result = new int[saves.size]; + for(int i = 0; i < result.length; i++){ + result[i] = saves.get(i).index; + } + Settings.putJson("save-slots", result); + Settings.save(); + } + public class SaveSlot{ public final int index; SaveMeta meta; diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SaveDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SaveDialog.java index 381d519a64..338eb5dc3a 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SaveDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SaveDialog.java @@ -22,10 +22,6 @@ public class SaveDialog extends LoadDialog{ } public void addSetup(){ - if(!control.getSaves().canAddSave()){ - return; - } - slots.row(); slots.addImageTextButton("$text.save.new", "icon-add", "clear", 14 * 3, () -> ui.showTextInput("$text.save", "$text.save.newslot", "", text -> { diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index f7083374cb..85b3c3d25b 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -123,7 +123,7 @@ public class HudFragment extends Fragment{ //paused table parent.fill(t -> { t.top().visible(() -> state.is(State.paused) && !Net.active()); - t.table(top -> top.add("[orange]< " + Bundles.get("text.paused") + " >").pad(6).get().setFontScale(fontScale * 0.75f)); + t.table("pane", top -> top.add("[orange]< " + Bundles.get("text.paused") + " >").pad(6).get().setFontScale(fontScale * 1.5f)); }); //'saving' indicator