More map submission testing / Desktop editor pick tile support

This commit is contained in:
Anuken
2024-10-02 12:29:26 -04:00
parent aaa27a0b69
commit 939b8a9ed8
10 changed files with 63 additions and 5 deletions

View File

@@ -328,6 +328,8 @@ public class Block extends UnlockableContent implements Senseable{
public boolean instantDeconstruct = false;
/** If true, this block constructs immediately. This implies no resource requirement, and ignores configs - do not use, this is for performance only! */
public boolean instantBuild = false;
/** If true, this block can be placed even in "dark" areas. Only used for editor static walls. */
public boolean ignoreBuildDarkness = false;
/** Effect for placing the block. Passes size as rotation. */
public Effect placeEffect = Fx.placeBlock;
/** Effect for breaking the block. Passes size as rotation. */

View File

@@ -165,7 +165,7 @@ public class Build{
/** Returns whether a tile can be placed at this location by this team. */
public static boolean validPlace(Block type, Team team, int x, int y, int rotation, boolean checkVisible){
//the wave team can build whatever they want as long as it's visible - banned blocks are not applicable
if(type == null || (checkVisible && (!type.environmentBuildable() || (!type.isPlaceable() && !(state.rules.waves && team == state.rules.waveTeam && type.isVisible()))))){
if(type == null || (!state.rules.editor && (checkVisible && (!type.environmentBuildable() || (!type.isPlaceable() && !(state.rules.waves && team == state.rules.waveTeam && type.isVisible())))))){
return false;
}
@@ -205,7 +205,7 @@ public class Build{
}
//campaign darkness check
if(world.getDarkness(x, y) >= 3){
if(!type.ignoreBuildDarkness && world.getDarkness(x, y) >= 3){
return false;
}

View File

@@ -92,6 +92,7 @@ public class Floor extends Block{
placeableLiquid = true;
allowRectanglePlacement = true;
instantBuild = true;
ignoreBuildDarkness = true;
placeEffect = Fx.rotateBlock;
}

View File

@@ -5,6 +5,7 @@ import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.graphics.*;
import mindustry.world.*;
@@ -21,7 +22,10 @@ public class StaticWall extends Prop{
variants = 2;
cacheLayer = CacheLayer.walls;
allowRectanglePlacement = true;
placeEffect = Fx.rotateBlock;
instantBuild = true;
ignoreBuildDarkness = true;
placeableLiquid = true;
}
@Override
@@ -49,6 +53,11 @@ public class StaticWall extends Prop{
split = large.split(32, 32);
}
@Override
public boolean canReplace(Block other){
return other instanceof StaticWall || super.canReplace(other);
}
boolean eq(int rx, int ry){
return rx < world.width() - 1 && ry < world.height() - 1
&& world.tile(rx + 1, ry).block() == this