Bugfixes / Allow placing blocks in shallow liquids
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -88,6 +88,14 @@ public class EditorTile extends Tile{
|
|||||||
protected void changed(){
|
protected void changed(){
|
||||||
entity = null;
|
entity = null;
|
||||||
|
|
||||||
|
if(wall == null){
|
||||||
|
wall = Blocks.air;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(floor == null){
|
||||||
|
floor = (Floor)Blocks.air;
|
||||||
|
}
|
||||||
|
|
||||||
Block block = block();
|
Block block = block();
|
||||||
|
|
||||||
if(block.hasEntity()){
|
if(block.hasEntity()){
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
|||||||
t.table(p -> {
|
t.table(p -> {
|
||||||
p.add("$waves.every").padRight(4);
|
p.add("$waves.every").padRight(4);
|
||||||
p.addField(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
p.addField(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(Strings.canParsePostiveInt(text)){
|
if(Strings.canParsePostiveInt(text) && Strings.parseInt(text) > 0){
|
||||||
group.spacing = Strings.parseInt(text);
|
group.spacing = Strings.parseInt(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
|||||||
dialog.hide();
|
dialog.hide();
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}).pad(2).margin(12f).fillX();
|
}).pad(2).margin(12f).fillX();
|
||||||
if(++i % 2 == 0)dialog.cont.row();
|
if(++i % 3 == 0)dialog.cont.row();
|
||||||
}
|
}
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,25 +69,25 @@ public class MapIO{
|
|||||||
|
|
||||||
public static Pixmap generatePreview(Map map) throws IOException{
|
public static Pixmap generatePreview(Map map) throws IOException{
|
||||||
Time.mark();
|
Time.mark();
|
||||||
Pixmap floor = new Pixmap(map.width, map.height, Format.RGBA8888);
|
Pixmap floors = new Pixmap(map.width, map.height, Format.RGBA8888);
|
||||||
Pixmap wall = new Pixmap(map.width, map.height, Format.RGBA8888);
|
Pixmap walls = new Pixmap(map.width, map.height, Format.RGBA8888);
|
||||||
int black = Color.rgba8888(Color.BLACK);
|
int black = Color.rgba8888(Color.BLACK);
|
||||||
CachedTile tile = new CachedTile(){
|
CachedTile tile = new CachedTile(){
|
||||||
@Override
|
@Override
|
||||||
public void setFloor(Floor type){
|
public void setFloor(Floor type){
|
||||||
floor.drawPixel(x, floor.getHeight() - 1 - y, colorFor(type, Blocks.air, Blocks.air, getTeam()));
|
floors.drawPixel(x, floors.getHeight() - 1 - y, colorFor(type, Blocks.air, Blocks.air, getTeam()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOreByte(byte b){
|
public void setOreByte(byte b){
|
||||||
if(b != 0) floor.drawPixel(x, floor.getHeight() - 1 - y, colorFor(floor(), Blocks.air, content.block(b), getTeam()));
|
if(b != 0) floors.drawPixel(x, floors.getHeight() - 1 - y, colorFor(floor(), Blocks.air, content.block(b), getTeam()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void changed(){
|
protected void changed(){
|
||||||
super.changed();
|
super.changed();
|
||||||
int c = colorFor(Blocks.air, block(), Blocks.air, getTeam());
|
int c = colorFor(Blocks.air, block(), Blocks.air, getTeam());
|
||||||
if(c != black) wall.drawPixel(x, floor.getHeight() - 1 - y, c);
|
if(c != black) walls.drawPixel(x, floors.getHeight() - 1 - y, c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
readTiles(map, (x, y) -> {
|
readTiles(map, (x, y) -> {
|
||||||
@@ -95,9 +95,9 @@ public class MapIO{
|
|||||||
tile.y = (short)y;
|
tile.y = (short)y;
|
||||||
return tile;
|
return tile;
|
||||||
});
|
});
|
||||||
floor.drawPixmap(wall, 0, 0);
|
floors.drawPixmap(walls, 0, 0);
|
||||||
wall.dispose();
|
walls.dispose();
|
||||||
return floor;
|
return floors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pixmap generatePreview(Tile[][] tiles){
|
public static Pixmap generatePreview(Tile[][] tiles){
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ import io.anuke.arc.scene.ui.ImageButton;
|
|||||||
import io.anuke.arc.scene.ui.TextButton;
|
import io.anuke.arc.scene.ui.TextButton;
|
||||||
import io.anuke.arc.scene.ui.layout.Stack;
|
import io.anuke.arc.scene.ui.layout.Stack;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
|
import io.anuke.arc.scene.ui.layout.Unit;
|
||||||
import io.anuke.arc.scene.utils.Elements;
|
import io.anuke.arc.scene.utils.Elements;
|
||||||
import io.anuke.arc.util.Align;
|
import io.anuke.arc.util.Align;
|
||||||
import io.anuke.arc.util.Scaling;
|
import io.anuke.arc.util.Scaling;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.arc.util.Tmp;
|
import io.anuke.arc.util.Tmp;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.game.EventType.PlayEvent;
|
|
||||||
import io.anuke.mindustry.game.EventType.StateChangeEvent;
|
import io.anuke.mindustry.game.EventType.StateChangeEvent;
|
||||||
import io.anuke.mindustry.game.UnlockableContent;
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
@@ -49,16 +49,6 @@ public class HudFragment extends Fragment{
|
|||||||
private float coreAttackTime;
|
private float coreAttackTime;
|
||||||
private float lastCoreHP;
|
private float lastCoreHP;
|
||||||
private float coreAttackOpacity = 0f;
|
private float coreAttackOpacity = 0f;
|
||||||
private Table goshDarnHeckingFlippedTableWhyDoesThisHappen;
|
|
||||||
|
|
||||||
{
|
|
||||||
Events.on(PlayEvent.class, event -> {
|
|
||||||
if(goshDarnHeckingFlippedTableWhyDoesThisHappen != null){
|
|
||||||
goshDarnHeckingFlippedTableWhyDoesThisHappen.invalidateHierarchy();
|
|
||||||
goshDarnHeckingFlippedTableWhyDoesThisHappen.pack();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
|
|
||||||
@@ -67,8 +57,13 @@ public class HudFragment extends Fragment{
|
|||||||
cont.top().left().visible(() -> !state.is(State.menu));
|
cont.top().left().visible(() -> !state.is(State.menu));
|
||||||
|
|
||||||
if(mobile){
|
if(mobile){
|
||||||
cont.table(select -> {
|
|
||||||
goshDarnHeckingFlippedTableWhyDoesThisHappen = select;
|
{
|
||||||
|
Table select = new Table(){
|
||||||
|
public float getPrefWidth(){ return Unit.dp.scl(dsize*4 + 3); }
|
||||||
|
public float getPrefHeight(){ return Unit.dp.scl(dsize); }
|
||||||
|
};
|
||||||
|
|
||||||
select.left();
|
select.left();
|
||||||
select.defaults().size(dsize).left();
|
select.defaults().size(dsize).left();
|
||||||
|
|
||||||
@@ -111,7 +106,8 @@ public class HudFragment extends Fragment{
|
|||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
select.addImage("blank").color(Pal.accent).width(3f).fillY();
|
select.addImage("blank").color(Pal.accent).width(3f).fillY();
|
||||||
}).left();
|
cont.add(select).prefSize(dsize*4 + 3, dsize).left();
|
||||||
|
}
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.addImage("blank").height(3f).color(Pal.accent).fillX();
|
cont.addImage("blank").height(3f).color(Pal.accent).fillX();
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class Build{
|
|||||||
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||||
if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) ||
|
if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) ||
|
||||||
!other.floor().placeableOn ||
|
!other.floor().placeableOn ||
|
||||||
(other.floor().isLiquid && !type.floating)){
|
(other.floor().isDeep() && !type.floating)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ public class Build{
|
|||||||
}else{
|
}else{
|
||||||
return tile.interactable(team)
|
return tile.interactable(team)
|
||||||
&& contactsGround(tile.x, tile.y, type)
|
&& contactsGround(tile.x, tile.y, type)
|
||||||
&& (!tile.floor().isLiquid || type.floating)
|
&& (!tile.floor().isDeep() || type.floating)
|
||||||
&& tile.floor().placeableOn
|
&& tile.floor().placeableOn
|
||||||
&& ((type.canReplace(tile.block())
|
&& ((type.canReplace(tile.block())
|
||||||
&& !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
&& !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
||||||
@@ -174,19 +174,19 @@ public class Build{
|
|||||||
if(block.isMultiblock()){
|
if(block.isMultiblock()){
|
||||||
for(Point2 point : Edges.getInsideEdges(block.size)){
|
for(Point2 point : Edges.getInsideEdges(block.size)){
|
||||||
Tile tile = world.tile(x + point.x, y + point.y);
|
Tile tile = world.tile(x + point.x, y + point.y);
|
||||||
if(tile != null && !tile.floor().isLiquid) return true;
|
if(tile != null && !tile.floor().isDeep()) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Point2 point : Edges.getEdges(block.size)){
|
for(Point2 point : Edges.getEdges(block.size)){
|
||||||
Tile tile = world.tile(x + point.x, y + point.y);
|
Tile tile = world.tile(x + point.x, y + point.y);
|
||||||
if(tile != null && !tile.floor().isLiquid) return true;
|
if(tile != null && !tile.floor().isDeep()) return true;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for(Point2 point : Geometry.d4){
|
for(Point2 point : Geometry.d4){
|
||||||
Tile tile = world.tile(x + point.x, y + point.y);
|
Tile tile = world.tile(x + point.x, y + point.y);
|
||||||
if(tile != null && !tile.floor().isLiquid) return true;
|
if(tile != null && !tile.floor().isDeep()) return true;
|
||||||
}
|
}
|
||||||
return world.tile(x, y) != null && !world.tile(x, y).floor().isLiquid;
|
return world.tile(x, y) != null && !world.tile(x, y).floor().isDeep();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public class Tile implements Position, TargetTrait{
|
|||||||
/** Tile entity, usually null. */
|
/** Tile entity, usually null. */
|
||||||
public TileEntity entity;
|
public TileEntity entity;
|
||||||
public short x, y;
|
public short x, y;
|
||||||
private Block wall;
|
protected Block wall;
|
||||||
private Floor floor;
|
protected Floor floor;
|
||||||
/** Rotation, 0-3. Also used to store offload location, in which case it can be any number. */
|
/** Rotation, 0-3. Also used to store offload location, in which case it can be any number. */
|
||||||
private byte rotation;
|
private byte rotation;
|
||||||
/** Team ordinal. */
|
/** Team ordinal. */
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ public class Floor extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDeep(){
|
||||||
|
return drownTime > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void drawNonLayer(Tile tile){
|
public void drawNonLayer(Tile tile){
|
||||||
Mathf.random.setSeed(tile.pos());
|
Mathf.random.setSeed(tile.pos());
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
if(lastTask != null) lastTask.cancel();
|
if(lastTask != null) lastTask.cancel();
|
||||||
|
|
||||||
Map result = world.maps.all().find(map -> map.name().equalsIgnoreCase(arg[0]));
|
Map result = world.maps.all().find(map -> map.name().equalsIgnoreCase(arg[0].replace('_', ' ')));
|
||||||
|
|
||||||
if(result == null){
|
if(result == null){
|
||||||
err("No map with name &y'{0}'&lr found.", arg[0]);
|
err("No map with name &y'{0}'&lr found.", arg[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user