Added system to query block outputs / Editor bugfixes
This commit is contained in:
@@ -472,8 +472,8 @@ block.carbide-drill.name=Carbide Drill
|
|||||||
block.laser-drill.name=Laser Drill
|
block.laser-drill.name=Laser Drill
|
||||||
block.water-extractor.name=Water Extractor
|
block.water-extractor.name=Water Extractor
|
||||||
block.cultivator.name=Cultivator
|
block.cultivator.name=Cultivator
|
||||||
block.dart-ship-factory.name=Dart Ship Factory
|
block.dart-ship-factory.name=Dart Ship Reonstructor
|
||||||
block.delta-mech-factory.name=Delta Mech Factory
|
block.delta-mech-factory.name=Delta Mech Reconstructor
|
||||||
block.dronefactory.name=Drone Factory
|
block.dronefactory.name=Drone Factory
|
||||||
block.repairpoint.name=Repair Point
|
block.repairpoint.name=Repair Point
|
||||||
block.resupplypoint.name=Resupply Point
|
block.resupplypoint.name=Resupply Point
|
||||||
|
|||||||
@@ -566,7 +566,8 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
for(Block block : Block.all()){
|
for(Block block : Block.all()){
|
||||||
TextureRegion[] regions = block.getCompactIcon();
|
TextureRegion[] regions = block.getCompactIcon();
|
||||||
if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block)))) && !debug && block != StorageBlocks.core){
|
if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block))))
|
||||||
|
&& !debug && block != StorageBlocks.core){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,6 +575,10 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Recipe.getByResult(block) != null && Recipe.getByResult(block).desktopOnly && mobile && !debug){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(regions.length == 0 || regions[0] == Draw.region("jjfgj")) continue;
|
if(regions.length == 0 || regions[0] == Draw.region("jjfgj")) continue;
|
||||||
|
|
||||||
Stack stack = new Stack();
|
Stack stack = new Stack();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class Sector{
|
|||||||
public transient Array<SpawnGroup> spawns = new Array<>();
|
public transient Array<SpawnGroup> spawns = new Array<>();
|
||||||
/**Ores that appear in this sector.*/
|
/**Ores that appear in this sector.*/
|
||||||
public transient Array<Item> ores = new Array<>();
|
public transient Array<Item> ores = new Array<>();
|
||||||
/**Difficulty of the sector, measured by calculating distance from origin.*/
|
/**Difficulty of the sector, measured by calculating distance from origin and applying scaling.*/
|
||||||
public transient int difficulty;
|
public transient int difficulty;
|
||||||
|
|
||||||
public int getSeed(){
|
public int getSeed(){
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.type.Liquid;
|
|||||||
import io.anuke.mindustry.world.consumers.ConsumeItem;
|
import io.anuke.mindustry.world.consumers.ConsumeItem;
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
||||||
import io.anuke.mindustry.world.consumers.Consumers;
|
import io.anuke.mindustry.world.consumers.Consumers;
|
||||||
|
import io.anuke.mindustry.world.meta.Producers;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
@@ -31,6 +32,7 @@ public abstract class BaseBlock{
|
|||||||
public float powerCapacity = 10f;
|
public float powerCapacity = 10f;
|
||||||
|
|
||||||
public Consumers consumes = new Consumers();
|
public Consumers consumes = new Consumers();
|
||||||
|
public Producers produces = new Producers();
|
||||||
|
|
||||||
public boolean shouldConsume(Tile tile){
|
public boolean shouldConsume(Tile tile){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class Block extends BaseBlock implements Content{
|
|||||||
private static int lastid;
|
private static int lastid;
|
||||||
private static Array<Block> blocks = new Array<>(140);
|
private static Array<Block> blocks = new Array<>(140);
|
||||||
private static ObjectMap<String, Block> map = new ObjectMap<>();
|
private static ObjectMap<String, Block> map = new ObjectMap<>();
|
||||||
|
|
||||||
/** internal name */
|
/** internal name */
|
||||||
public final String name;
|
public final String name;
|
||||||
/** internal ID */
|
/** internal ID */
|
||||||
@@ -104,12 +105,14 @@ public class Block extends BaseBlock implements Content{
|
|||||||
public Color minimapColor = Color.CLEAR;
|
public Color minimapColor = Color.CLEAR;
|
||||||
/** View range of this block type. Use a value < 0 to disable. */
|
/** View range of this block type. Use a value < 0 to disable. */
|
||||||
public float viewRange = 10;
|
public float viewRange = 10;
|
||||||
|
|
||||||
protected Array<Tile> tempTiles = new Array<>();
|
protected Array<Tile> tempTiles = new Array<>();
|
||||||
protected Color tempColor = new Color();
|
protected Color tempColor = new Color();
|
||||||
protected TextureRegion[] blockIcon;
|
protected TextureRegion[] blockIcon;
|
||||||
protected TextureRegion[] icon;
|
protected TextureRegion[] icon;
|
||||||
protected TextureRegion[] compactIcon;
|
protected TextureRegion[] compactIcon;
|
||||||
protected TextureRegion editorIcon;
|
protected TextureRegion editorIcon;
|
||||||
|
|
||||||
public TextureRegion shadowRegion;
|
public TextureRegion shadowRegion;
|
||||||
public TextureRegion region;
|
public TextureRegion region;
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ public class GenericCrafter extends Block{
|
|||||||
tile -> (float) tile.entity.items.get(consumes.item()) / itemCapacity));
|
tile -> (float) tile.entity.items.get(consumes.item()) / itemCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
produces.set(output);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
|
|||||||
@@ -24,6 +24,13 @@ public class LiquidMixer extends LiquidBlock{
|
|||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
produces.set(outputLiquid);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ public class PowerCrafter extends Block{
|
|||||||
if(outputLiquid != null){
|
if(outputLiquid != null){
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(outputLiquid != null){
|
||||||
|
produces.set(outputLiquid);
|
||||||
|
}else if(outputItem != null){
|
||||||
|
produces.set(outputItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ public class PowerSmelter extends PowerBlock{
|
|||||||
itemCapacity = 20;
|
itemCapacity = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
produces.set(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
super.load();
|
super.load();
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ public class Smelter extends Block{
|
|||||||
throw new IllegalArgumentException("'" + name + "' has input item '" + item.item.name + "', which is a flux, when useFlux is enabled. To prevent ambiguous item use, either remove this flux item from the inputs, or set useFlux to false.");
|
throw new IllegalArgumentException("'" + name + "' has input item '" + item.item.name + "', which is a flux, when useFlux is enabled. To prevent ambiguous item use, either remove this flux item from the inputs, or set useFlux to false.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
produces.set(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
15
core/src/io/anuke/mindustry/world/meta/Producers.java
Normal file
15
core/src/io/anuke/mindustry/world/meta/Producers.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package io.anuke.mindustry.world.meta;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.game.Content;
|
||||||
|
|
||||||
|
public class Producers{
|
||||||
|
private Content output;
|
||||||
|
|
||||||
|
public void set(Content content){
|
||||||
|
this.output = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Content get(){
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user