Item sprite cleanup
This commit is contained in:
@@ -342,7 +342,7 @@ public class PlacementFragment extends Fragment{
|
||||
topTable.row();
|
||||
topTable.table(b -> {
|
||||
b.image(Icon.cancel).padRight(2).color(Color.scarlet);
|
||||
b.add(!player.isBuilder() ? "@unit.nobuild" : displayBlock.unplaceableMessage()).width(190f).wrap();
|
||||
b.add(!player.isBuilder() ? "@unit.nobuild" : "@banned").width(190f).wrap();
|
||||
b.left();
|
||||
}).padTop(2).left();
|
||||
}
|
||||
|
||||
@@ -191,8 +191,6 @@ public class Block extends UnlockableContent{
|
||||
public float buildCost;
|
||||
/** Whether this block is visible and can currently be built. */
|
||||
public BuildVisibility buildVisibility = BuildVisibility.hidden;
|
||||
/** Defines when this block can be placed. */
|
||||
public BuildPlaceability buildPlaceability = BuildPlaceability.always;
|
||||
/** Multiplier for speed of building this block. */
|
||||
public float buildCostMultiplier = 1f;
|
||||
/** Multiplier for cost of research in tech tree. */
|
||||
@@ -521,7 +519,7 @@ public class Block extends UnlockableContent{
|
||||
}
|
||||
|
||||
public boolean isPlaceable(){
|
||||
return isVisible() && buildPlaceability.placeable() && !state.rules.bannedBlocks.contains(this);
|
||||
return isVisible() && !state.rules.bannedBlocks.contains(this);
|
||||
}
|
||||
|
||||
/** Called when building of this block begins. */
|
||||
@@ -534,11 +532,6 @@ public class Block extends UnlockableContent{
|
||||
|
||||
}
|
||||
|
||||
/** @return a message detailing why this block can't be placed. */
|
||||
public String unplaceableMessage(){
|
||||
return state.rules.bannedBlocks.contains(this) ? Core.bundle.get("banned") : buildPlaceability.message();
|
||||
}
|
||||
|
||||
public boolean isFloor(){
|
||||
return this instanceof Floor;
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package mindustry.world.meta;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import mindustry.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Like BuildVisiblity, but defines whether a block can be *placed*, with an extra message.
|
||||
* This is like defining a conditionally banned block.
|
||||
* */
|
||||
public enum BuildPlaceability{
|
||||
always(() -> true),
|
||||
sectorCaptured(() -> Vars.state.rules.sector != null && Vars.state.rules.sector.isCaptured());
|
||||
|
||||
private final Boolp placeability;
|
||||
|
||||
BuildPlaceability(Boolp placeability){
|
||||
this.placeability = placeability;
|
||||
}
|
||||
|
||||
public boolean placeable(){
|
||||
return placeability.get();
|
||||
}
|
||||
|
||||
/** @return why this block is banned. */
|
||||
public String message(){
|
||||
return Core.bundle.get("unplaceable." + name().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ public enum BuildVisibility{
|
||||
debugOnly(() -> false),
|
||||
sandboxOnly(() -> Vars.state.rules.infiniteResources),
|
||||
campaignOnly(() -> Vars.state.isCampaign()),
|
||||
lightingOnly(() -> Vars.state.rules.lighting),
|
||||
lightingOnly(() -> Vars.state.rules.lighting || Vars.state.isCampaign()),
|
||||
ammoOnly(() -> Vars.state.rules.unitAmmo);
|
||||
|
||||
private final Boolp visible;
|
||||
|
||||
Reference in New Issue
Block a user