Added cliffs as separate block

This commit is contained in:
Anuken
2020-02-21 23:45:25 -05:00
parent 6871db7155
commit baa0eb1149
14 changed files with 1917 additions and 1800 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@@ -220,3 +220,4 @@
63524=underflow-gate|block-underflow-gate-medium 63524=underflow-gate|block-underflow-gate-medium
63523=dart-ship-pad|block-dart-ship-pad-medium 63523=dart-ship-pad|block-dart-ship-pad-medium
63522=alpha-mech-pad|block-alpha-mech-pad-medium 63522=alpha-mech-pad|block-alpha-mech-pad-medium
63521=cliff|block-cliff-medium

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 772 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 688 KiB

After

Width:  |  Height:  |  Size: 687 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 KiB

After

Width:  |  Height:  |  Size: 905 KiB

View File

@@ -33,7 +33,7 @@ public class Blocks implements ContentList{
public static Block public static Block
//environment //environment
air, spawn, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, ice, snow, darksandTaintedWater, air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, ice, snow, darksandTaintedWater,
holostone, rocks, sporerocks, icerocks, cliffs, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster, holostone, rocks, sporerocks, icerocks, cliffs, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, sandBoulder, grass, salt, iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, sandBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock, saltRocks, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock, saltRocks,
@@ -123,6 +123,8 @@ public class Blocks implements ContentList{
public void draw(Tile tile){} public void draw(Tile tile){}
}; };
cliff = new Cliff("cliff");
//Registers build blocks //Registers build blocks
//no reference is needed here since they can be looked up by name later //no reference is needed here since they can be looked up by name later
for(int i = 1; i <= BuildBlock.maxSize; i++){ for(int i = 1; i <= BuildBlock.maxSize; i++){

View File

@@ -45,6 +45,32 @@ public abstract class BasicGenerator implements WorldGenerator{
} }
public void cliffs(){
for(Tile tile : tiles){
if(!tile.block().isStatic()) continue;
int rotation = 0;
for(int i = 0; i < 4; i++){
Tile other = tiles.get(tile.x + Geometry.d4[i].x, tile.y + Geometry.d4[i].y);
if(other != null && !other.block().isStatic()){
rotation |= (1 << i);
}
}
if(rotation != 0){
tile.setBlock(Blocks.cliff);
}
tile.rotation(rotation);
}
for(Tile tile : tiles){
if(tile.block() != Blocks.cliff && tile.block().isStatic()){
tile.setBlock(Blocks.air);
}
}
}
public void median(int radius){ public void median(int radius){
median(radius, 0.5); median(radius, 0.5);
} }

View File

@@ -13,10 +13,11 @@ import mindustry.world.blocks.storage.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class FileMapGenerator implements WorldGenerator{ public class FileMapGenerator implements WorldGenerator{
public final Map map; public final Map map = null;
public FileMapGenerator(String mapName){ public FileMapGenerator(String mapName){
this.map = maps.loadInternalMap(mapName); //TODO doesn't work
//this.map = maps.loadInternalMap(mapName);
} }
@Override @Override

View File

@@ -123,7 +123,7 @@ public class Tile implements Position{
} }
public boolean isDarkened(){ public boolean isDarkened(){
return block().solid && !block().synthetic() && block().fillsTile; return block.solid && !block.synthetic() && block.fillsTile;
} }
public @NonNull Floor floor(){ public @NonNull Floor floor(){

View File

@@ -0,0 +1,31 @@
package mindustry.world.blocks;
import arc.graphics.g2d.*;
import arc.util.*;
import mindustry.graphics.*;
import mindustry.world.*;
public class Cliff extends Block{
public Cliff(String name){
super(name);
breakable = alwaysReplace = false;
solid = true;
cacheLayer = CacheLayer.walls;
fillsTile = false;
hasShadow = false;
}
@Override
public void draw(Tile tile){
int r = tile.rotation();
for(int i = 0; i < 4; i++){
if((r & (1 << i)) != 0){
Draw.color(Tmp.c1.set(tile.floor().color).mul(1.3f + (i >= 2 ? -0.4f : 0.3f)));
Draw.rect(region, tile.worldx(), tile.worldy(), i * 90f);
}
}
Draw.color();
}
}