mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 23:11:12 -08:00
Add things
This commit is contained in:
parent
5a0140a2e2
commit
f418d52160
6 changed files with 46 additions and 9 deletions
|
|
@ -40,7 +40,7 @@ public class Vars{
|
|||
//how much the zoom changes every zoom button press
|
||||
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
||||
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
||||
public static boolean debug = true;
|
||||
public static boolean debug = false;
|
||||
//whether the player can clip through walls
|
||||
public static boolean noclip = false;
|
||||
//whether to draw chunk borders
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class Enemy extends DestructibleEntity{
|
|||
|
||||
float minv = 0.07f;
|
||||
|
||||
if(Math.abs(xvelocity) < minv && Math.abs(yvelocity) < minv && node > 0 && target == null){
|
||||
if(Vector2.dst(xvelocity, yvelocity, 0, 0) < minv && node > 0 && target == null){
|
||||
idletime += Timers.delta();
|
||||
}else{
|
||||
idletime = 0;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public class MapEditorDialog extends Dialog{
|
|||
Pixmap pixmap = new Pixmap(file);
|
||||
if(verifySize(pixmap)){
|
||||
editor.setPixmap(pixmap);
|
||||
view.clearStack();
|
||||
}else{
|
||||
Vars.ui.showError("[orange]Invalid image dimensions![]\nValid map dimensions: " + Arrays.toString(MapEditor.validMapSizes));
|
||||
}
|
||||
|
|
@ -89,6 +90,7 @@ public class MapEditorDialog extends Dialog{
|
|||
copy.texture = new Texture(copy.pixmap);
|
||||
editor.beginEdit(copy);
|
||||
Vars.ui.hideLoading();
|
||||
view.clearStack();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -98,6 +100,7 @@ public class MapEditorDialog extends Dialog{
|
|||
Vars.ui.showLoading();
|
||||
Timers.run(10f, ()->{
|
||||
editor.resize(x, y);
|
||||
view.clearStack();
|
||||
Vars.ui.hideLoading();
|
||||
});
|
||||
}
|
||||
|
|
@ -112,6 +115,7 @@ public class MapEditorDialog extends Dialog{
|
|||
Vars.world.maps().saveAndReload(editor.getMap(), editor.pixmap());
|
||||
loadDialog.rebuild();
|
||||
Vars.ui.hideLoading();
|
||||
view.clearStack();
|
||||
});
|
||||
}else{
|
||||
Vars.ui.hideLoading();
|
||||
|
|
@ -131,9 +135,14 @@ public class MapEditorDialog extends Dialog{
|
|||
editor.beginEdit(new Map());
|
||||
blockgroup.getButtons().get(2).setChecked(true);
|
||||
Core.scene.setScrollFocus(view);
|
||||
view.clearStack();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public MapView getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void resetSaved(){
|
||||
saved = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,14 +62,12 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||
content().add(pane).fillY();
|
||||
|
||||
buttons().defaults().size(170f, 50f).pad(4f);
|
||||
buttons().addButton("Back", () -> hide());
|
||||
buttons().addButton("Back", this::hide);
|
||||
buttons().addButton("Randomize", () ->{
|
||||
editor.getFilter().randomize();
|
||||
apply();
|
||||
});
|
||||
buttons().addButton("Update", () ->{
|
||||
apply();
|
||||
});
|
||||
buttons().addButton("Update", this::apply);
|
||||
buttons().addButton("Apply", () ->{
|
||||
Vars.ui.showLoading();
|
||||
|
||||
|
|
@ -77,6 +75,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||
editor.applyFilter();
|
||||
Vars.ui.hideLoading();
|
||||
Vars.ui.getEditorDialog().resetSaved();
|
||||
Vars.ui.getEditorDialog().getView().clearStack();
|
||||
hide();
|
||||
});
|
||||
});
|
||||
|
|
@ -93,7 +92,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||
|
||||
private void apply(){
|
||||
loading = true;
|
||||
Timers.run(3f, ()->{
|
||||
Timers.run(3f, () -> {
|
||||
editor.applyFilterPreview();
|
||||
loading = false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class MapView extends Element implements GestureListener{
|
|||
private MapEditor editor;
|
||||
private EditorTool tool = EditorTool.pencil;
|
||||
private OperationStack stack = new OperationStack();
|
||||
private PixelOperation op;
|
||||
private Bresenham2 br = new Bresenham2();
|
||||
private float offsetx, offsety;
|
||||
private float zoom = 1f;
|
||||
|
|
@ -59,7 +60,9 @@ public class MapView extends Element implements GestureListener{
|
|||
if(tool.edit){
|
||||
Vars.ui.getEditorDialog().resetSaved();
|
||||
}
|
||||
|
||||
|
||||
op = new PixelOperation(editor.pixmap());
|
||||
|
||||
drawing = true;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -67,6 +70,8 @@ public class MapView extends Element implements GestureListener{
|
|||
@Override
|
||||
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
|
||||
drawing = false;
|
||||
stack.add(op);
|
||||
op = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
24
core/src/io/anuke/mindustry/mapeditor/PixelOperation.java
Normal file
24
core/src/io/anuke/mindustry/mapeditor/PixelOperation.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package io.anuke.mindustry.mapeditor;
|
||||
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
|
||||
public class PixelOperation extends DrawOperation {
|
||||
|
||||
public PixelOperation(Pixmap pixmap){
|
||||
super(pixmap);
|
||||
}
|
||||
|
||||
public void add() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void redo() {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue