New save slot system / Buffed smelter / Fixed flying shadow glitches

This commit is contained in:
Anuken
2018-07-17 09:18:19 -04:00
parent f184b0700f
commit d7812ec030
8 changed files with 28 additions and 30 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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