Bugfixes
This commit is contained in:
@@ -41,7 +41,7 @@ public class Vars implements Loadable{
|
||||
/** Maximum schematic size.*/
|
||||
public static final int maxSchematicSize = 32;
|
||||
/** All schematic base64 starts with this string.*/
|
||||
public static final String schematicBaseStart ="bXNjaAB";
|
||||
public static final String schematicBaseStart ="bXNjaA";
|
||||
/** IO buffer size. */
|
||||
public static final int bufferSize = 8192;
|
||||
/** global charset, since Android doesn't support the Charsets class */
|
||||
|
||||
@@ -2,8 +2,9 @@ package mindustry.entities.comp;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.collisions;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class ElevationMoveComp implements Velc, Posc, Flyingc, Hitboxc{
|
||||
@@ -20,4 +21,13 @@ abstract class ElevationMoveComp implements Velc, Posc, Flyingc, Hitboxc{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
Tile tile = tileOn();
|
||||
|
||||
if(!net.client() && tile != null && tile.solid() && !isFlying()){
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import static mindustry.Vars.*;
|
||||
public class Schematics implements Loadable{
|
||||
private static final Schematic tmpSchem = new Schematic(new Seq<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem2 = new Schematic(new Seq<>(), new StringMap(), 0, 0);
|
||||
public static final String base64Header = "bXNjaAB";
|
||||
|
||||
private static final byte[] header = {'m', 's', 'c', 'h'};
|
||||
private static final byte version = 1;
|
||||
|
||||
@@ -16,6 +16,7 @@ import mindustry.ui.*;
|
||||
|
||||
public class LogicCanvas extends WidgetGroup{
|
||||
private static final Color backgroundCol = Color.black, gridCol = Pal.accent.cpy().mul(0.2f);
|
||||
private static final Color outCol = Pal.place, inCol = Pal.remove;
|
||||
|
||||
private Seq<LogicNode> nodes = new Seq<>();
|
||||
|
||||
@@ -75,20 +76,21 @@ public class LogicCanvas extends WidgetGroup{
|
||||
t.add("Node").style(Styles.outlineLabel).color(color);
|
||||
t.add().growX();
|
||||
t.button(Icon.cancel, Styles.onlyi, () -> {
|
||||
|
||||
//TODO disconnect things
|
||||
remove();
|
||||
});
|
||||
}).growX().padBottom(5);
|
||||
}).growX().padBottom(6);
|
||||
|
||||
row();
|
||||
|
||||
defaults().size(190, 36);
|
||||
defaults().height(30);
|
||||
|
||||
for(NodeField field : fields){
|
||||
add(field).color(color);
|
||||
add(field).align(field.input ? Align.left : Align.right);
|
||||
row();
|
||||
}
|
||||
|
||||
marginBottom(5);
|
||||
marginBottom(7);
|
||||
|
||||
addListener(new InputListener(){
|
||||
float lastx, lasty;
|
||||
@@ -132,14 +134,20 @@ public class LogicCanvas extends WidgetGroup{
|
||||
|
||||
NodeField(boolean input, String name){
|
||||
this.input = input;
|
||||
setColor(input ? inCol : outCol);
|
||||
|
||||
float marg = 24f;
|
||||
|
||||
if(input){
|
||||
addIcon();
|
||||
left();
|
||||
marginRight(marg);
|
||||
}else{
|
||||
right();
|
||||
marginLeft(marg);
|
||||
}
|
||||
|
||||
add(name).padLeft(5).padRight(5).style(Styles.outlineLabel);
|
||||
add(name).padLeft(5).padRight(5).style(Styles.outlineLabel).color(color);
|
||||
|
||||
if(!input){
|
||||
addIcon();
|
||||
@@ -153,7 +161,8 @@ public class LogicCanvas extends WidgetGroup{
|
||||
}).size(s);
|
||||
|
||||
button = c.get();
|
||||
c.update(i -> i.getStyle().imageUpColor = color);
|
||||
button.userObject = this;
|
||||
button.getStyle().imageUpColor = color;
|
||||
|
||||
float pad = s/2f - 3f;
|
||||
|
||||
@@ -163,12 +172,5 @@ public class LogicCanvas extends WidgetGroup{
|
||||
c.padRight(-pad);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Color color){
|
||||
super.setColor(color);
|
||||
|
||||
button.getStyle().imageUpColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ContentParser{
|
||||
return result;
|
||||
}else{
|
||||
String str = data.asString();
|
||||
if(str.startsWith(Schematics.base64Header)){
|
||||
if(str.startsWith(Vars.schematicBaseStart)){
|
||||
return Schematics.readBase64(str);
|
||||
}else{
|
||||
return Schematics.read(Vars.tree.get("schematics/" + str + "." + Vars.schematicExtension));
|
||||
|
||||
@@ -40,6 +40,7 @@ public class PowerNode extends PowerBlock{
|
||||
configurable = true;
|
||||
consumesPower = false;
|
||||
outputsPower = false;
|
||||
|
||||
config(Integer.class, (entity, value) -> {
|
||||
PowerModule power = entity.power;
|
||||
Building other = world.build(value);
|
||||
@@ -80,12 +81,20 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
config(Point2[].class, (tile, value) -> {
|
||||
tile.power.links.clear();
|
||||
|
||||
IntSeq old = new IntSeq(tile.power.links);
|
||||
|
||||
//clear old
|
||||
for(int i = 0; i < old.size; i++){
|
||||
int cur = old.get(i);
|
||||
configurations.get(Integer.class).get(tile, cur);
|
||||
}
|
||||
|
||||
//set new
|
||||
for(Point2 p : value){
|
||||
if(tile.power.links.size < maxNodes){
|
||||
tile.power.links.add(Point2.pack(p.x + tile.tileX(), p.y + tile.tileY()));
|
||||
}
|
||||
int newPos = Point2.pack(p.x + tile.tileX(), p.y + tile.tileY());
|
||||
configurations.get(Integer.class).get(tile, newPos);
|
||||
}
|
||||
tile.updatePowerGraph();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user