Added cliffs as separate block
BIN
core/assets-raw/sprites/blocks/environment/cliff.png
Normal file
|
After Width: | Height: | Size: 255 B |
@@ -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
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 772 B |
|
Before Width: | Height: | Size: 688 KiB After Width: | Height: | Size: 687 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 284 KiB |
|
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 901 KiB After Width: | Height: | Size: 905 KiB |
@@ -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++){
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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(){
|
||||||
|
|||||||
31
core/src/mindustry/world/blocks/Cliff.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||