Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/content/Blocks.java
This commit is contained in:
Anuken
2021-06-09 17:10:49 -04:00
93 changed files with 1617 additions and 574 deletions

View File

@@ -13,7 +13,6 @@ import mindustry.content.*;
import mindustry.game.EventType.*;
import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.power.*;
@@ -142,11 +141,21 @@ public class BlockRenderer{
Tile other = world.tile(cx, cy);
if(other != null){
darkEvents.add(other.pos());
floor.recacheTile(other);
}
}
}
}
public void checkChanges(){
darkEvents.each(pos -> {
var tile = world.tile(pos);
if(tile != null){
tile.data = world.getWallDarkness(tile);
}
});
}
public void drawDarkness(){
if(!darkEvents.isEmpty()){
Draw.flush();
@@ -156,10 +165,9 @@ public class BlockRenderer{
darkEvents.each(pos -> {
var tile = world.tile(pos);
tile.data = world.getWallDarkness(tile);
float darkness = world.getDarkness(tile.x, tile.y);
//then draw the shadow
Draw.colorl(!tile.isDarkened() || darkness <= 0f ? 1f : 1f - Math.min((darkness + 0.5f) / 4f, 1f));
Draw.colorl(darkness <= 0f ? 1f : 1f - Math.min((darkness + 0.5f) / 4f, 1f));
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
});
@@ -186,7 +194,7 @@ public class BlockRenderer{
}
if(brokenFade > 0.001f){
for(BlockPlan block : state.teams.get(player.team()).blocks){
for(BlockPlan block : player.team().data().blocks){
Block b = content.block(block.block);
if(!camera.bounds(Tmp.r1).grow(tilesize * 2f).overlaps(Tmp.r2.setSize(b.size * tilesize).setCenter(block.x * tilesize + b.offset, block.y * tilesize + b.offset))) continue;

View File

@@ -97,7 +97,6 @@ public class FloorRenderer{
/** Queues up a cache change for a tile. Only runs in render loop. */
public void recacheTile(Tile tile){
//TODO will be faster it the position also specified the layer to be recached
//recaching all layers may not be necessary
recacheSet.add(Point2.pack(tile.x / chunksize, tile.y / chunksize));
}
@@ -168,7 +167,6 @@ public class FloorRenderer{
shader.setUniformi("u_texture", 0);
//only ever use the base environment texture
//TODO show error texture for anything else
texture.bind(0);
//enable all mesh attributes

View File

@@ -47,7 +47,6 @@ public class MenuRenderer implements Disposable{
Simplex s1 = new Simplex(offset);
Simplex s2 = new Simplex(offset + 1);
Simplex s3 = new Simplex(offset + 2);
RidgedPerlin rid = new RidgedPerlin(1 + offset, 1);
Block[] selected = Structs.select(
new Block[]{Blocks.sand, Blocks.sandWall},
new Block[]{Blocks.shale, Blocks.shaleWall},
@@ -141,7 +140,7 @@ public class MenuRenderer implements Disposable{
}
if(tendrils){
if(rid.getValue(x, y, 1f / 17f) > 0f){
if(RidgedPerlin.noise2d(1 + offset, x, y, 1f / 17f) > 0f){
floor = Mathf.chance(0.2) ? Blocks.sporeMoss : Blocks.moss;
if(wall != Blocks.air){