More branch merging
This commit is contained in:
@@ -25,6 +25,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.graphics.MultiPacker.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.consumers.*;
|
||||
@@ -122,6 +123,8 @@ public class Block extends UnlockableContent{
|
||||
public boolean useColor = true;
|
||||
/** item that drops from this block, used for drills */
|
||||
public @Nullable Item itemDrop = null;
|
||||
/** Array of affinities to certain things. */
|
||||
public Attributes attributes = new Attributes();
|
||||
/** tile entity health */
|
||||
public int health = -1;
|
||||
/** base block explosiveness */
|
||||
@@ -384,10 +387,16 @@ public class Block extends UnlockableContent{
|
||||
}
|
||||
|
||||
/** Returns whether or not this block can be place on the specified */
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
return canPlaceOn(tile, team);
|
||||
}
|
||||
|
||||
/** Legacy canPlaceOn implementation, override {@link #canPlaceOn(Tile, Team, int)} instead.*/
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean canBreak(Tile tile){
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class Build{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!type.canPlaceOn(tile, team)){
|
||||
if(!type.canPlaceOn(tile, team, rotation)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,6 +227,7 @@ public class ConstructBlock extends Block{
|
||||
|
||||
for(TextureRegion region : current.getGeneratedIcons()){
|
||||
Shaders.blockbuild.region = region;
|
||||
Shaders.blockbuild.time = Time.time;
|
||||
Shaders.blockbuild.progress = progress;
|
||||
|
||||
Draw.rect(region, x, y, current.rotate ? rotdeg() : 0);
|
||||
|
||||
@@ -58,6 +58,7 @@ public class ForceProjector extends Block{
|
||||
ambientSound = Sounds.shield;
|
||||
ambientSoundVolume = 0.08f;
|
||||
consumes.add(new ConsumeCoolant(0.1f)).boost().update(false);
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MendProjector extends Block{
|
||||
hasItems = true;
|
||||
emitLight = true;
|
||||
lightRadius = 50f;
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,6 +41,7 @@ public class OverdriveProjector extends Block{
|
||||
canOverdrive = false;
|
||||
emitLight = true;
|
||||
lightRadius = 50f;
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,9 @@ public class Wall extends Block{
|
||||
buildCostMultiplier = 6f;
|
||||
canOverdrive = false;
|
||||
drawDisabled = false;
|
||||
|
||||
//it's a wall of course it's supported everywhere
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ public class PowerTurret extends Turret{
|
||||
public PowerTurret(String name){
|
||||
super(name);
|
||||
hasPower = true;
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -410,7 +410,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
protected boolean checkAccept(Building source, Tile other){
|
||||
if(linked(source)) return true;
|
||||
if(tile == null || linked(source)) return true;
|
||||
|
||||
if(linkValid(tile, other)){
|
||||
int rel = relativeTo(other);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class MassDriver extends Block{
|
||||
hasPower = true;
|
||||
outlineIcon = true;
|
||||
sync = true;
|
||||
envEnabled |= Env.space;
|
||||
|
||||
//point2 is relative
|
||||
config(Point2.class, (MassDriverBuild tile, Point2 point) -> tile.link = Point2.pack(point.x + tile.tileX(), point.y + tile.tileY()));
|
||||
|
||||
@@ -30,6 +30,7 @@ public class PayloadConveyor extends Block{
|
||||
update = true;
|
||||
outputsPayload = true;
|
||||
noUpdateDisabled = true;
|
||||
envEnabled |= Env.space;
|
||||
sync = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ public class AirBlock extends Floor{
|
||||
useColor = false;
|
||||
wall = this;
|
||||
needsSurface = false;
|
||||
canShadow = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
24
core/src/mindustry/world/blocks/environment/EmptyFloor.java
Normal file
24
core/src/mindustry/world/blocks/environment/EmptyFloor.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package mindustry.world.blocks.environment;
|
||||
|
||||
import mindustry.content.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class EmptyFloor extends Floor{
|
||||
|
||||
public EmptyFloor(String name){
|
||||
super(name);
|
||||
variants = 0;
|
||||
canShadow = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Tile tile){
|
||||
//draws only edges, never itself
|
||||
drawEdges(tile);
|
||||
|
||||
Floor floor = tile.overlay();
|
||||
if(floor != Blocks.air && floor != this){
|
||||
floor.drawBase(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import mindustry.graphics.*;
|
||||
import mindustry.graphics.MultiPacker.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -54,8 +53,6 @@ public class Floor extends Block{
|
||||
public boolean playerUnmineable = false;
|
||||
/** Group of blocks that this block does not draw edges on. */
|
||||
public Block blendGroup = this;
|
||||
/** Array of affinities to certain things. */
|
||||
public Attributes attributes = new Attributes();
|
||||
/** Whether this ore generates in maps by default. */
|
||||
public boolean oreDefault = false;
|
||||
/** Ore generation params. */
|
||||
@@ -64,6 +61,8 @@ public class Floor extends Block{
|
||||
public Block wall = Blocks.air;
|
||||
/** Decoration block. Usually a rock. May be air. */
|
||||
public Block decoration = Blocks.air;
|
||||
/** Whether units can draw shadows over this. */
|
||||
public boolean canShadow = true;
|
||||
/** Whether this overlay needs a surface to be on. False for floating blocks, like spawns. */
|
||||
public boolean needsSurface = true;
|
||||
|
||||
@@ -116,10 +115,6 @@ public class Floor extends Block{
|
||||
//keep default value if not found...
|
||||
if(wall == null) wall = Blocks.air;
|
||||
|
||||
if(decoration == Blocks.air){
|
||||
decoration = content.blocks().min(b -> b instanceof Prop && b.minfo.mod == null && b.breakable ? mapColor.diff(b.mapColor) : Float.POSITIVE_INFINITY);
|
||||
}
|
||||
|
||||
if(isLiquid && walkEffect == Fx.none){
|
||||
walkEffect = Fx.ripple;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package mindustry.world.blocks.experimental;
|
||||
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
|
||||
/** @deprecated use Constructor instead. */
|
||||
@Deprecated
|
||||
public class BlockForge extends mindustry.world.blocks.payloads.BlockForge{
|
||||
public class BlockForge extends Constructor{
|
||||
|
||||
public BlockForge(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public class BlockForgeBuild extends mindustry.world.blocks.payloads.BlockForge.BlockForgeBuild{
|
||||
public class BlockForgeBuild extends Constructor.ConstructorBuild{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package mindustry.world.blocks.experimental;
|
||||
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
|
||||
@Deprecated
|
||||
public class BlockLoader extends mindustry.world.blocks.payloads.BlockLoader{
|
||||
public class BlockLoader extends PayloadLoader{
|
||||
|
||||
public BlockLoader(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public class BlockLoaderBuild extends mindustry.world.blocks.payloads.BlockLoader.BlockLoaderBuild{
|
||||
public class BlockLoaderBuild extends PayloadLoaderBuild{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package mindustry.world.blocks.experimental;
|
||||
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
|
||||
@Deprecated
|
||||
public class BlockUnloader extends mindustry.world.blocks.payloads.BlockUnloader{
|
||||
public class BlockUnloader extends PayloadUnloader{
|
||||
|
||||
public BlockUnloader(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public class BlockUnloaderBuild extends mindustry.world.blocks.payloads.BlockUnloader.BlockUnloaderBuild{
|
||||
public class BlockUnloaderBuild extends PayloadUnloaderBuild{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ArmoredConduit extends Conduit{
|
||||
public class ArmoredConduitBuild extends ConduitBuild{
|
||||
@Override
|
||||
public boolean acceptLiquid(Building source, Liquid liquid){
|
||||
return super.acceptLiquid(source, liquid) && (source.block instanceof Conduit ||
|
||||
return super.acceptLiquid(source, liquid) && (tile == null || source.block instanceof Conduit ||
|
||||
source.tile.absoluteRelativeTo(tile.x, tile.y) == rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
public boolean acceptLiquid(Building source, Liquid liquid){
|
||||
noSleep();
|
||||
return (liquids.current() == liquid || liquids.currentAmount() < 0.2f)
|
||||
&& ((source.relativeTo(tile.x, tile.y) + 2) % 4 != rotation);
|
||||
&& (tile == null || (source.relativeTo(tile.x, tile.y) + 2) % 4 != rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ public class LiquidBlock extends Block{
|
||||
hasLiquids = true;
|
||||
group = BlockGroup.liquids;
|
||||
outputsLiquid = true;
|
||||
envEnabled |= Env.space | Env.underwater;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ public class LiquidBridge extends ItemBridge{
|
||||
outputsLiquid = true;
|
||||
canOverdrive = false;
|
||||
group = BlockGroup.liquids;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
public class LiquidBridgeBuild extends ItemBridgeBuild{
|
||||
|
||||
@@ -42,6 +42,9 @@ public class LogicBlock extends Block{
|
||||
group = BlockGroup.logic;
|
||||
schematicPriority = 5;
|
||||
|
||||
//universal, no real requirements
|
||||
envEnabled = Env.any;
|
||||
|
||||
config(byte[].class, (LogicBuild build, byte[] data) -> build.readCompressed(data, true));
|
||||
|
||||
config(Integer.class, (LogicBuild entity, Integer pos) -> {
|
||||
|
||||
@@ -36,6 +36,7 @@ public class LogicDisplay extends Block{
|
||||
solid = true;
|
||||
group = BlockGroup.logic;
|
||||
drawDisabled = false;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ public class MemoryBlock extends Block{
|
||||
solid = true;
|
||||
group = BlockGroup.logic;
|
||||
drawDisabled = false;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,7 @@ public class MessageBlock extends Block{
|
||||
destructible = true;
|
||||
group = BlockGroup.logic;
|
||||
drawDisabled = false;
|
||||
envEnabled = Env.any;
|
||||
|
||||
config(String.class, (MessageBuild tile, String text) -> {
|
||||
if(text.length() > maxTextLength){
|
||||
|
||||
@@ -17,6 +17,7 @@ public class SwitchBlock extends Block{
|
||||
drawDisabled = false;
|
||||
autoResetEnabled = false;
|
||||
group = BlockGroup.logic;
|
||||
envEnabled = Env.any;
|
||||
|
||||
config(Boolean.class, (SwitchBuild entity, Boolean b) -> entity.enabled = b);
|
||||
}
|
||||
|
||||
@@ -80,16 +80,16 @@ public class PayloadBlock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canControlSelect(Player player){
|
||||
return !player.unit().spawnedByCore && this.payload == null && acceptUnitPayload(player.unit()) && player.tileOn() != null && player.tileOn().build == this;
|
||||
public boolean canControlSelect(Unit player){
|
||||
return !player.spawnedByCore && this.payload == null && acceptUnitPayload(player) && player.tileOn() != null && player.tileOn().build == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onControlSelect(Player player){
|
||||
public void onControlSelect(Unit player){
|
||||
float x = player.x, y = player.y;
|
||||
acceptPlayerPayload(player, p -> payload = (T)p);
|
||||
handleUnitPayload(player, p -> payload = (T)p);
|
||||
this.payVector.set(x, y).sub(this).clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f);
|
||||
this.payRotation = player.unit().rotation;
|
||||
this.payRotation = player.rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,8 @@ public class Battery extends PowerDistributor{
|
||||
outputsPower = true;
|
||||
consumesPower = true;
|
||||
flags = EnumSet.of(BlockFlag.battery);
|
||||
//TODO could be supported everywhere...
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
public class BatteryBuild extends Building{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.world.blocks.power;
|
||||
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class DecayGenerator extends ItemLiquidGenerator{
|
||||
|
||||
@@ -8,6 +9,7 @@ public class DecayGenerator extends ItemLiquidGenerator{
|
||||
super(true, false, name);
|
||||
hasItems = true;
|
||||
hasLiquids = false;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
||||
lightRadius = 115f;
|
||||
emitLight = true;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.input.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -28,6 +29,7 @@ public class LightBlock extends Block{
|
||||
update = true;
|
||||
configurable = true;
|
||||
saveConfig = true;
|
||||
envEnabled |= Env.space;
|
||||
swapDiagonalPlacement = true;
|
||||
|
||||
config(Integer.class, (LightBuild tile, Integer value) -> tile.color = value);
|
||||
|
||||
@@ -56,6 +56,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
rebuildable = false;
|
||||
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
||||
schematicPriority = -5;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,7 @@ public class PowerDiode extends Block{
|
||||
group = BlockGroup.power;
|
||||
noUpdateDisabled = true;
|
||||
schematicPriority = 10;
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,7 @@ public class PowerNode extends PowerBlock{
|
||||
swapDiagonalPlacement = true;
|
||||
schematicPriority = -10;
|
||||
drawDisabled = false;
|
||||
envEnabled |= Env.space;
|
||||
|
||||
config(Integer.class, (entity, value) -> {
|
||||
PowerModule power = entity.power;
|
||||
|
||||
@@ -12,6 +12,7 @@ public class SolarGenerator extends PowerGenerator{
|
||||
super(name);
|
||||
//remove the BlockFlag.generator flag to make this a lower priority target than other generators.
|
||||
flags = EnumSet.of();
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
//make sure there's heat at this location
|
||||
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > 0.01f;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Drill extends Block{
|
||||
/** How many times faster the drill will progress when boosted by liquid. */
|
||||
public float liquidBoostIntensity = 1.6f;
|
||||
/** Speed at which the drill speeds up. */
|
||||
public float warmupSpeed = 0.02f;
|
||||
public float warmupSpeed = 0.015f;
|
||||
|
||||
//return variables for countOre
|
||||
protected @Nullable Item returnItem;
|
||||
@@ -108,7 +108,7 @@ public class Drill extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
if(isMultiblock()){
|
||||
for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){
|
||||
if(canMine(other)){
|
||||
@@ -275,14 +275,14 @@ public class Drill extends Block{
|
||||
speed *= efficiency(); // Drill slower when not at full power
|
||||
|
||||
lastDrillSpeed = (speed * dominantItems * warmup) / (drillTime + hardnessDrillMultiplier * dominantItem.hardness);
|
||||
warmup = Mathf.lerpDelta(warmup, speed, warmupSpeed);
|
||||
warmup = Mathf.approachDelta(warmup, speed, warmupSpeed);
|
||||
progress += delta() * dominantItems * speed * warmup;
|
||||
|
||||
if(Mathf.chanceDelta(updateEffectChance * warmup))
|
||||
updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f));
|
||||
}else{
|
||||
lastDrillSpeed = 0f;
|
||||
warmup = Mathf.lerpDelta(warmup, 0f, warmupSpeed);
|
||||
warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,7 @@ public class Incinerator extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(consValid() && efficiency() > 0.9f){
|
||||
heat = Mathf.lerpDelta(heat, 1f, 0.04f);
|
||||
}else{
|
||||
heat = Mathf.lerpDelta(heat, 0f, 0.02f);
|
||||
}
|
||||
heat = Mathf.approachDelta(heat, consValid() && efficiency() > 0.9f ? 1f : 0f, 0.04f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ public class Pump extends LiquidBlock{
|
||||
super(name);
|
||||
group = BlockGroup.liquids;
|
||||
floating = true;
|
||||
envEnabled = Env.terrestrial;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +62,7 @@ public class Pump extends LiquidBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
if(isMultiblock()){
|
||||
Liquid last = null;
|
||||
for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){
|
||||
|
||||
@@ -31,6 +31,8 @@ public class SolidPump extends Pump{
|
||||
public SolidPump(String name){
|
||||
super(name);
|
||||
hasPower = true;
|
||||
//only supports ground by default
|
||||
envEnabled = Env.terrestrial;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +65,7 @@ public class SolidPump extends Pump{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
float sum = tile.getLinkedTilesAs(this, tempTiles).sumf(t -> canPump(t) ? baseEfficiency + (attribute != null ? t.floor().attributes.get(attribute) : 0f) : 0f);
|
||||
return sum > 0.00001f;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public class LiquidSource extends Block{
|
||||
noUpdateDisabled = true;
|
||||
displayFlow = false;
|
||||
group = BlockGroup.liquids;
|
||||
envEnabled = Env.any;
|
||||
|
||||
config(Liquid.class, (LiquidSourceBuild tile, Liquid l) -> tile.source = l);
|
||||
configClear((LiquidSourceBuild tile) -> tile.source = null);
|
||||
|
||||
@@ -13,6 +13,7 @@ public class LiquidVoid extends Block{
|
||||
solid = true;
|
||||
update = true;
|
||||
group = BlockGroup.liquids;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -121,7 +121,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||
if(tile == null) return false;
|
||||
CoreBuild core = team.core();
|
||||
//must have all requirements
|
||||
@@ -166,7 +166,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||
if(world.tile(x, y) == null) return;
|
||||
|
||||
if(!canPlaceOn(world.tile(x, y), player.team())){
|
||||
if(!canPlaceOn(world.tile(x, y), player.team(), rotation)){
|
||||
|
||||
drawPlaceText(Core.bundle.get(
|
||||
(player.team().core() != null && player.team().core().items.has(requirements, state.rules.buildCostMultiplier)) || state.rules.infiniteResources ?
|
||||
|
||||
@@ -23,6 +23,7 @@ public class StorageBlock extends Block{
|
||||
group = BlockGroup.transportation;
|
||||
flags = EnumSet.of(BlockFlag.storage);
|
||||
allowResupply = true;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,6 +28,7 @@ public class Unloader extends Block{
|
||||
itemCapacity = 0;
|
||||
noUpdateDisabled = true;
|
||||
unloadable = false;
|
||||
envEnabled = Env.any;
|
||||
|
||||
config(Item.class, (UnloaderBuild tile, Item item) -> tile.sortItem = item);
|
||||
configClear((UnloaderBuild tile) -> tile.sortItem = null);
|
||||
|
||||
@@ -37,6 +37,7 @@ public class CommandCenter extends Block{
|
||||
configurable = true;
|
||||
drawDisabled = false;
|
||||
logicConfigurable = true;
|
||||
envEnabled = Env.any;
|
||||
|
||||
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
|
||||
if(build.team.data().command != command){
|
||||
|
||||
@@ -59,6 +59,8 @@ public class RepairPoint extends Block{
|
||||
outlineIcon = true;
|
||||
//yeah, this isn't the same thing, but it's close enough
|
||||
group = BlockGroup.projectors;
|
||||
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,14 +108,18 @@ public class StatValues{
|
||||
};
|
||||
}
|
||||
|
||||
public static StatValue floorEfficiency(Floor floor, float multiplier, boolean startZero){
|
||||
public static StatValue blockEfficiency(Block floor, float multiplier, boolean startZero){
|
||||
return table -> table.stack(
|
||||
new Image(floor.uiIcon).setScaling(Scaling.fit),
|
||||
new Table(t -> t.top().right().add((multiplier < 0 ? "[scarlet]" : startZero ? "[accent]" : "[accent]+") + (int)((multiplier) * 100) + "%").style(Styles.outlineLabel))
|
||||
);
|
||||
}
|
||||
|
||||
public static StatValue floors(Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
return blocks(attr, floating, scale, startZero, true);
|
||||
}
|
||||
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scale, boolean startZero, boolean checkFloors){
|
||||
return table -> table.table(c -> {
|
||||
Runnable[] rebuild = {null};
|
||||
Map[] lastMap = {null};
|
||||
@@ -126,14 +130,14 @@ public class StatValues{
|
||||
|
||||
if(state.isGame()){
|
||||
var blocks = Vars.content.blocks()
|
||||
.select(block -> block instanceof Floor f && indexer.isBlockPresent(block) && f.attributes.get(attr) != 0 && !(f.isDeep() && !floating))
|
||||
.select(block -> (!checkFloors || block instanceof Floor) && indexer.isBlockPresent(block) && block.attributes.get(attr) != 0 && !((block instanceof Floor f && f.isDeep()) && !floating))
|
||||
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(attr)));
|
||||
|
||||
if(blocks.any()){
|
||||
int i = 0;
|
||||
for(var block : blocks){
|
||||
|
||||
floorEfficiency(block, block.attributes.get(attr) * scale, startZero).display(c);
|
||||
blockEfficiency(block, block.attributes.get(attr) * scale, startZero).display(c);
|
||||
if(++i % 5 == 0){
|
||||
c.row();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Stats{
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
add(stat, StatValues.floors(attr, floating, scale, startZero));
|
||||
add(stat, StatValues.blocks(attr, floating, scale, startZero));
|
||||
}
|
||||
|
||||
/** Adds a single string value with this stat. */
|
||||
|
||||
Reference in New Issue
Block a user