Env rules for many various blocks
This commit is contained in:
@@ -730,6 +730,7 @@ public class Blocks implements ContentList{
|
||||
solid = true;
|
||||
outputsLiquid = true;
|
||||
drawer = new DrawMixer();
|
||||
envEnabled = Env.any;
|
||||
|
||||
consumes.power(1f);
|
||||
consumes.item(Items.titanium);
|
||||
|
||||
@@ -6,15 +6,10 @@ import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.graphics.g3d.*;
|
||||
import mindustry.graphics.g3d.PlanetGrid.*;
|
||||
import mindustry.maps.generators.*;
|
||||
import mindustry.maps.planet.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Planets implements ContentList{
|
||||
public static Planet
|
||||
@@ -70,23 +65,7 @@ public class Planets implements ContentList{
|
||||
drawOrbit = false;
|
||||
orbitOffset = offsets[fi];
|
||||
|
||||
generator = new BlankPlanetGenerator(){
|
||||
@Override
|
||||
public void generate(){
|
||||
pass((x, y) -> {
|
||||
floor = Blocks.space;
|
||||
});
|
||||
|
||||
Schematics.placeLaunchLoadout(width/2, height/2);
|
||||
|
||||
state.rules.environment = Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSectorSize(Sector sector){
|
||||
return 300;
|
||||
}
|
||||
};
|
||||
generator = new AsteroidGenerator();
|
||||
|
||||
meshLoader = () -> {
|
||||
Seq<GenericMesh> meshes = new Seq<>();
|
||||
|
||||
37
core/src/mindustry/maps/planet/AsteroidGenerator.java
Normal file
37
core/src/mindustry/maps/planet/AsteroidGenerator.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package mindustry.maps.planet;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.noise.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class AsteroidGenerator extends BlankPlanetGenerator{
|
||||
|
||||
@Override
|
||||
public void generate(){
|
||||
int seed = state.rules.sector.planet.id;
|
||||
int sx = width/2, sy = height/2;
|
||||
|
||||
pass((x, y) -> {
|
||||
floor = Blocks.space;
|
||||
|
||||
if(Simplex.noise2d(seed, 5, 0.6f, 1f/ 100f, x, y) + Mathf.dst(x, y, sx, sy) / (float)width / 2f > 0.7f){
|
||||
floor = Blocks.stone;
|
||||
}
|
||||
});
|
||||
|
||||
Schematics.placeLaunchLoadout(sx, sy);
|
||||
|
||||
state.rules.environment = Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSectorSize(Sector sector){
|
||||
return 450;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -18,6 +18,7 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ public class LiquidBlock extends Block{
|
||||
hasLiquids = true;
|
||||
group = BlockGroup.liquids;
|
||||
outputsLiquid = true;
|
||||
envEnabled |= Env.space | Env.underwater;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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) -> {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -56,6 +56,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
rebuildable = false;
|
||||
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
||||
schematicPriority = -5;
|
||||
envEnabled = Env.any;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,6 +45,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
|
||||
|
||||
@@ -14,6 +14,7 @@ import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -37,6 +38,8 @@ public class BeamDrill extends Block{
|
||||
update = true;
|
||||
solid = true;
|
||||
drawArrow = false;
|
||||
|
||||
envEnabled |= Env.space;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,7 @@ public class StorageBlock extends Block{
|
||||
destructible = true;
|
||||
group = BlockGroup.transportation;
|
||||
flags = EnumSet.of(BlockFlag.storage);
|
||||
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);
|
||||
|
||||
@@ -36,6 +36,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){
|
||||
|
||||
Reference in New Issue
Block a user