Better cliff sprites

This commit is contained in:
Anuken
2020-10-10 11:37:58 -04:00
parent 5a31d419fc
commit fb831e8fef
29 changed files with 4225 additions and 429 deletions

View File

@@ -65,6 +65,11 @@ public class World{
return tile == null || tile.block().solid;
}
public boolean wallSolidFull(int x, int y){
Tile tile = tile(x, y);
return tile == null || (tile.block().solid && tile.block().fillsTile);
}
public boolean isAccessible(int x, int y){
return !wallSolid(x, y - 1) || !wallSolid(x, y + 1) || !wallSolid(x - 1, y) || !wallSolid(x + 1, y);
}

View File

@@ -557,6 +557,12 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.add(slider).width(size * 3f - 20).padTop(4f);
}).padTop(5).growX().top();
mid.row();
mid.table(t -> {
t.button("@editor.center", () -> view.center()).growX();
}).pad(-5).style(Styles.squaret).growX().top();
}).margin(0).left().growY();

View File

@@ -171,6 +171,10 @@ public class MapView extends Element implements GestureListener{
this.grid = grid;
}
public void center(){
offsetx = offsety = 0;
}
@Override
public void act(float delta){
super.act(delta);

View File

@@ -22,6 +22,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
float scl = 5f;
float waterOffset = 0.07f;
//TODO fix sand near snow (sector 173)
Block[][] arr =
{
{Blocks.water, Blocks.darksandWater, Blocks.darksand, Blocks.darksand, Blocks.darksand, Blocks.darksand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.darksandTaintedWater, Blocks.stone, Blocks.stone},

View File

@@ -496,8 +496,24 @@ public class Tile implements Position, QuadTreeObject, Displayable{
protected void changeEntity(Team team, Prov<Building> entityprov, int rotation){
if(build != null){
int size = build.block.size;
build.remove();
build = null;
//update edge entities
tileSet.clear();
for(Point2 edge : Edges.getEdges(size)){
Building other = world.build(x + edge.x, y + edge.y);
if(other != null){
tileSet.add(other);
}
}
//update proximity, since multiblock was just removed
for(Building t : tileSet){
t.updateProximity();
}
}
if(block.hasBuilding()){

View File

@@ -2,11 +2,13 @@ package mindustry.world.blocks.environment;
import arc.graphics.g2d.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.graphics.*;
import mindustry.world.*;
public class Cliff extends Block{
public float size = 11f;
public @Load(value = "cliffmask#", length = 256) TextureRegion[] cliffs;
public Cliff(String name){
super(name);
@@ -19,15 +21,8 @@ public class Cliff extends Block{
@Override
public void drawBase(Tile tile){
int r = tile.data;
for(int i = 0; i < 8; i++){
if((r & (1 << i)) != 0){
Draw.color(Tmp.c1.set(tile.floor().mapColor).mul(1.3f + (i >= 4 ? -0.4f : 0.3f)));
Draw.rect(region, tile.worldx(), tile.worldy(), size, size, i * 45f);
}
}
Draw.color(Tmp.c1.set(tile.floor().mapColor).mul(1.6f));
Draw.rect(cliffs[tile.data & 0xff], tile.worldx(), tile.worldy());
Draw.color();
}