Env rules for many various blocks
This commit is contained in:
@@ -730,6 +730,7 @@ public class Blocks implements ContentList{
|
|||||||
solid = true;
|
solid = true;
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
drawer = new DrawMixer();
|
drawer = new DrawMixer();
|
||||||
|
envEnabled = Env.any;
|
||||||
|
|
||||||
consumes.power(1f);
|
consumes.power(1f);
|
||||||
consumes.item(Items.titanium);
|
consumes.item(Items.titanium);
|
||||||
|
|||||||
@@ -6,15 +6,10 @@ import arc.math.geom.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
|
||||||
import mindustry.graphics.g3d.*;
|
import mindustry.graphics.g3d.*;
|
||||||
import mindustry.graphics.g3d.PlanetGrid.*;
|
import mindustry.graphics.g3d.PlanetGrid.*;
|
||||||
import mindustry.maps.generators.*;
|
|
||||||
import mindustry.maps.planet.*;
|
import mindustry.maps.planet.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.meta.*;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class Planets implements ContentList{
|
public class Planets implements ContentList{
|
||||||
public static Planet
|
public static Planet
|
||||||
@@ -70,23 +65,7 @@ public class Planets implements ContentList{
|
|||||||
drawOrbit = false;
|
drawOrbit = false;
|
||||||
orbitOffset = offsets[fi];
|
orbitOffset = offsets[fi];
|
||||||
|
|
||||||
generator = new BlankPlanetGenerator(){
|
generator = new AsteroidGenerator();
|
||||||
@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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
meshLoader = () -> {
|
meshLoader = () -> {
|
||||||
Seq<GenericMesh> meshes = new Seq<>();
|
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;
|
buildCostMultiplier = 6f;
|
||||||
canOverdrive = false;
|
canOverdrive = false;
|
||||||
drawDisabled = false;
|
drawDisabled = false;
|
||||||
|
|
||||||
|
//it's a wall of course it's supported everywhere
|
||||||
|
envEnabled = Env.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class PowerTurret extends Turret{
|
|||||||
public PowerTurret(String name){
|
public PowerTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
|
envEnabled |= Env.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.blocks.distribution.*;
|
import mindustry.world.blocks.distribution.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class LiquidBlock extends Block{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
group = BlockGroup.liquids;
|
group = BlockGroup.liquids;
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
|
envEnabled |= Env.space | Env.underwater;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ public class LogicBlock extends Block{
|
|||||||
group = BlockGroup.logic;
|
group = BlockGroup.logic;
|
||||||
schematicPriority = 5;
|
schematicPriority = 5;
|
||||||
|
|
||||||
|
//universal, no real requirements
|
||||||
|
envEnabled = Env.any;
|
||||||
|
|
||||||
config(byte[].class, (LogicBuild build, byte[] data) -> build.readCompressed(data, true));
|
config(byte[].class, (LogicBuild build, byte[] data) -> build.readCompressed(data, true));
|
||||||
|
|
||||||
config(Integer.class, (LogicBuild entity, Integer pos) -> {
|
config(Integer.class, (LogicBuild entity, Integer pos) -> {
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public class Battery extends PowerDistributor{
|
|||||||
outputsPower = true;
|
outputsPower = true;
|
||||||
consumesPower = true;
|
consumesPower = true;
|
||||||
flags = EnumSet.of(BlockFlag.battery);
|
flags = EnumSet.of(BlockFlag.battery);
|
||||||
|
//TODO could be supported everywhere...
|
||||||
|
envEnabled |= Env.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BatteryBuild extends Building{
|
public class BatteryBuild extends Building{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.world.blocks.power;
|
package mindustry.world.blocks.power;
|
||||||
|
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class DecayGenerator extends ItemLiquidGenerator{
|
public class DecayGenerator extends ItemLiquidGenerator{
|
||||||
|
|
||||||
@@ -8,6 +9,7 @@ public class DecayGenerator extends ItemLiquidGenerator{
|
|||||||
super(true, false, name);
|
super(true, false, name);
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
hasLiquids = false;
|
hasLiquids = false;
|
||||||
|
envEnabled = Env.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
||||||
lightRadius = 115f;
|
lightRadius = 115f;
|
||||||
emitLight = true;
|
emitLight = true;
|
||||||
|
envEnabled = Env.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
rebuildable = false;
|
rebuildable = false;
|
||||||
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
||||||
schematicPriority = -5;
|
schematicPriority = -5;
|
||||||
|
envEnabled = Env.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
swapDiagonalPlacement = true;
|
swapDiagonalPlacement = true;
|
||||||
schematicPriority = -10;
|
schematicPriority = -10;
|
||||||
drawDisabled = false;
|
drawDisabled = false;
|
||||||
|
envEnabled |= Env.space;
|
||||||
|
|
||||||
config(Integer.class, (entity, value) -> {
|
config(Integer.class, (entity, value) -> {
|
||||||
PowerModule power = entity.power;
|
PowerModule power = entity.power;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class SolarGenerator extends PowerGenerator{
|
|||||||
super(name);
|
super(name);
|
||||||
//remove the BlockFlag.generator flag to make this a lower priority target than other generators.
|
//remove the BlockFlag.generator flag to make this a lower priority target than other generators.
|
||||||
flags = EnumSet.of();
|
flags = EnumSet.of();
|
||||||
|
envEnabled = Env.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import mindustry.gen.*;
|
|||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -37,6 +38,8 @@ public class BeamDrill extends Block{
|
|||||||
update = true;
|
update = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
drawArrow = false;
|
drawArrow = false;
|
||||||
|
|
||||||
|
envEnabled |= Env.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public class SolidPump extends Pump{
|
|||||||
public SolidPump(String name){
|
public SolidPump(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
|
//only supports ground by default
|
||||||
|
envEnabled = Env.terrestrial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class StorageBlock extends Block{
|
|||||||
destructible = true;
|
destructible = true;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
flags = EnumSet.of(BlockFlag.storage);
|
flags = EnumSet.of(BlockFlag.storage);
|
||||||
|
envEnabled = Env.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class Unloader extends Block{
|
|||||||
itemCapacity = 0;
|
itemCapacity = 0;
|
||||||
noUpdateDisabled = true;
|
noUpdateDisabled = true;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
|
envEnabled = Env.any;
|
||||||
|
|
||||||
config(Item.class, (UnloaderBuild tile, Item item) -> tile.sortItem = item);
|
config(Item.class, (UnloaderBuild tile, Item item) -> tile.sortItem = item);
|
||||||
configClear((UnloaderBuild tile) -> tile.sortItem = null);
|
configClear((UnloaderBuild tile) -> tile.sortItem = null);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class CommandCenter extends Block{
|
|||||||
configurable = true;
|
configurable = true;
|
||||||
drawDisabled = false;
|
drawDisabled = false;
|
||||||
logicConfigurable = true;
|
logicConfigurable = true;
|
||||||
|
envEnabled = Env.any;
|
||||||
|
|
||||||
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
|
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
|
||||||
if(build.team.data().command != command){
|
if(build.team.data().command != command){
|
||||||
|
|||||||
Reference in New Issue
Block a user