More reorganization, implemented multiblock drills, API changes

This commit is contained in:
Anuken
2018-03-04 22:00:32 -05:00
parent 099d88ba7b
commit 292dbf101b
70 changed files with 606 additions and 559 deletions

View File

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 383 B

View File

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

View File

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

View File

Before

Width:  |  Height:  |  Size: 370 B

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

View File

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 128 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

View File

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 141 B

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 307 B

View File

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 221 B

View File

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 198 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

View File

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 307 B

View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

View File

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 295 B

View File

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

View File

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 276 B

View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

View File

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View File

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Sun Mar 04 15:33:08 EST 2018 #Sun Mar 04 21:59:47 EST 2018
version=release version=release
androidBuildCode=369 androidBuildCode=384
name=Mindustry name=Mindustry
code=3.4 code=3.4
build=custom build build=custom build

View File

@@ -288,7 +288,6 @@ public class Control extends Module{
Timers.run(1f, Musics::shuffleAll); Timers.run(1f, Musics::shuffleAll);
Entities.initPhysics(); Entities.initPhysics();
Entities.collisions().setCollider(tilesize, world::solid);
Platform.instance.updateRPC(); Platform.instance.updateRPC();

View File

@@ -389,7 +389,7 @@ public class Renderer extends RendererModule{
Draw.color(Colors.get("accent")); Draw.color(Colors.get("accent"));
Lines.stroke(1f); Lines.stroke(1f);
Lines.square(tile.drawx(), tile.drawy(), Lines.square(tile.drawx(), tile.drawy(),
tile.block().width * tilesize / 2f + 1f); tile.block().size * tilesize / 2f + 1f);
Draw.reset(); Draw.reset();
} }
@@ -447,7 +447,7 @@ public class Renderer extends RendererModule{
if(showBlockDebug && target.entity != null){ if(showBlockDebug && target.entity != null){
Draw.color(Color.RED); Draw.color(Color.RED);
Lines.crect(target.drawx(), target.drawy(), target.block().width * tilesize, target.block().height * tilesize); Lines.crect(target.drawx(), target.drawy(), target.block().size * tilesize, target.block().size * tilesize);
Vector2 v = new Vector2(); Vector2 v = new Vector2();
@@ -472,14 +472,14 @@ public class Renderer extends RendererModule{
if(Inputs.keyDown("block_info") && target.block().fullDescription != null){ if(Inputs.keyDown("block_info") && target.block().fullDescription != null){
Draw.color(Colors.get("accent")); Draw.color(Colors.get("accent"));
Lines.crect(target.drawx(), target.drawy(), target.block().width * tilesize, target.block().height * tilesize); Lines.crect(target.drawx(), target.drawy(), target.block().size * tilesize, target.block().size * tilesize);
Draw.color(); Draw.color();
} }
if(target.entity != null) { if(target.entity != null) {
int bot = 0, top = 0; int bot = 0, top = 0;
for (BlockBar bar : target.block().bars) { for (BlockBar bar : target.block().bars) {
float offset = Mathf.sign(bar.top) * (target.block().height / 2f * tilesize + 3f + 4f * ((bar.top ? top : bot))) + float offset = Mathf.sign(bar.top) * (target.block().size / 2f * tilesize + 3f + 4f * ((bar.top ? top : bot))) +
(bar.top ? -1f : 0f); (bar.top ? -1f : 0f);
float value = bar.value.get(target); float value = bar.value.get(target);

View File

@@ -32,7 +32,7 @@ public class World extends Module{
private Tile core; private Tile core;
private Array<SpawnPoint> spawns = new Array<>(); private Array<SpawnPoint> spawns = new Array<>();
private Tile[] temptiles = new Tile[4]; private Array<Tile> tempTiles = new Array<>();
public World(){ public World(){
maps.loadMaps(); maps.loadMaps();
@@ -241,7 +241,7 @@ public class World extends Module{
tile.setBlock(Blocks.air); tile.setBlock(Blocks.air);
}else{ }else{
Tile target = tile.target(); Tile target = tile.target();
Array<Tile> removals = target.getLinkedTiles(); Array<Tile> removals = target.getLinkedTiles(tempTiles);
for(Tile toremove : removals){ for(Tile toremove : removals){
//note that setting a new block automatically unlinks it //note that setting a new block automatically unlinks it
toremove.setBlock(Blocks.air); toremove.setBlock(Blocks.air);

View File

@@ -28,7 +28,7 @@ public class BlastType extends EnemyType {
if(enemy.target instanceof TileEntity){ if(enemy.target instanceof TileEntity){
TileEntity e = (TileEntity)enemy.target; TileEntity e = (TileEntity)enemy.target;
range = (e.tile.block().width * tilesize) /2f + 8f; range = (e.tile.block().size * tilesize) /2f + 8f;
ox = e.tile.block().getPlaceOffset().x; ox = e.tile.block().getPlaceOffset().x;
oy = e.tile.block().getPlaceOffset().y; oy = e.tile.block().getPlaceOffset().y;
} }

View File

@@ -1,7 +1,6 @@
package io.anuke.mindustry.game; package io.anuke.mindustry.game;
import com.badlogic.gdx.math.GridPoint2; import com.badlogic.gdx.math.GridPoint2;
import io.anuke.mindustry.core.GameState;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -327,7 +326,7 @@ public class Tutorial{
canForward = false; canForward = false;
showBlock = true; showBlock = true;
canPlace = true; canPlace = true;
targetBlock = WeaponBlocks.turret; targetBlock = WeaponBlocks.doubleturret;
blockPlaceX = 2; blockPlaceX = 2;
blockPlaceY = 2; blockPlaceY = 2;
} }

View File

@@ -158,13 +158,13 @@ public class DesktopInput extends InputHandler{
public int tilex(){ public int tilex(){
return (recipe != null && recipe.result.isMultiblock() && return (recipe != null && recipe.result.isMultiblock() &&
recipe.result.width % 2 == 0) ? recipe.result.size % 2 == 0) ?
Mathf.scl(Graphics.mouseWorld().x, tilesize) : Mathf.scl2(Graphics.mouseWorld().x, tilesize); Mathf.scl(Graphics.mouseWorld().x, tilesize) : Mathf.scl2(Graphics.mouseWorld().x, tilesize);
} }
public int tiley(){ public int tiley(){
return (recipe != null && recipe.result.isMultiblock() && return (recipe != null && recipe.result.isMultiblock() &&
recipe.result.height % 2 == 0) ? recipe.result.size % 2 == 0) ?
Mathf.scl(Graphics.mouseWorld().y, tilesize) : Mathf.scl2(Graphics.mouseWorld().y, tilesize); Mathf.scl(Graphics.mouseWorld().y, tilesize) : Mathf.scl2(Graphics.mouseWorld().y, tilesize);
} }

View File

@@ -71,7 +71,7 @@ public abstract class InputHandler extends InputAdapter{
} }
public boolean round2(){ public boolean round2(){
return !(recipe != null && recipe.result.isMultiblock() && recipe.result.height % 2 == 0); return !(recipe != null && recipe.result.isMultiblock() && recipe.result.size % 2 == 0);
} }
public boolean validPlace(int x, int y, Block type){ public boolean validPlace(int x, int y, Block type){

View File

@@ -36,8 +36,8 @@ public enum PlaceMode{
Draw.color(valid ? Colors.get("place") : Colors.get("placeInvalid")); Draw.color(valid ? Colors.get("place") : Colors.get("placeInvalid"));
Lines.stroke(2f); Lines.stroke(2f);
Lines.crect(x + offset.x, y + offset.y, tilesize * control.input().recipe.result.width + si, Lines.crect(x + offset.x, y + offset.y, tilesize * control.input().recipe.result.size + si,
tilesize * control.input().recipe.result.height + si); tilesize * control.input().recipe.result.size + si);
control.input().recipe.result.drawPlace(tilex, tiley, control.input().rotation, valid); control.input().recipe.result.drawPlace(tilex, tiley, control.input().rotation, valid);
Lines.stroke(2f); Lines.stroke(2f);
@@ -150,7 +150,7 @@ public enum PlaceMode{
tile = tile.getLinked(); tile = tile.getLinked();
if(tile != null && control.input().validBreak(tile.x, tile.y)){ if(tile != null && control.input().validBreak(tile.x, tile.y)){
Lines.crect(tile.drawx(), tile.drawy(), Lines.crect(tile.drawx(), tile.drawy(),
tile.block().width * t, tile.block().height * t); tile.block().size* t, tile.block().size * t);
} }
} }
} }
@@ -251,13 +251,13 @@ public enum PlaceMode{
x2 = this.endx * t, y2 = this.endy * t; x2 = this.endx * t, y2 = this.endy * t;
if(x2 >= x){ if(x2 >= x){
x -= block.width * t/2; x -= block.size * t/2;
x2 += block.width * t/2; x2 += block.size * t/2;
} }
if(y2 >= y){ if(y2 >= y){
y -= block.height * t/2; y -= block.size * t/2;
y2 += block.height * t/2; y2 += block.size * t/2;
} }
x += offset.x; x += offset.x;
@@ -284,7 +284,7 @@ public enum PlaceMode{
if(!control.input().validPlace(px, py, control.input().recipe.result) if(!control.input().validPlace(px, py, control.input().recipe.result)
|| !state.inventory.hasItems(control.input().recipe.requirements, amount)){ || !state.inventory.hasItems(control.input().recipe.requirements, amount)){
Lines.crect(px * t + offset.x, py * t + offset.y, t*block.width, t*block.height); Lines.crect(px * t + offset.x, py * t + offset.y, t*block.size, t*block.size);
} }
amount ++; amount ++;
} }

View File

@@ -9,35 +9,37 @@ public class Item{
private static final Array<Item> items = new Array<>(); private static final Array<Item> items = new Array<>();
public static final Item public static final Item
stone = new Item("stone"), stone = new Item("stone"),
iron = new Item("iron"), iron = new Item("iron"),
coal = new Item("coal"){ coal = new Item("coal"){
{ {
explosiveness = 0.2f; explosiveness = 0.2f;
flammability = 0.5f; flammability = 0.5f;
material = false; material = false;
} }
}, },
steel = new Item("steel"), steel = new Item("steel"),
titanium = new Item("titanium"), titanium = new Item("titanium"),
dirium = new Item("dirium"), dirium = new Item("dirium"),
uranium = new Item("uranium"){ uranium = new Item("uranium"){
{ {
explosiveness = 0.1f; explosiveness = 0.1f;
material = false; material = false;
} }
}, },
quartz = new Item("quartz") { quartz = new Item("quartz") {
{ {
material = false; material = false;
} }
}, },
glass = new Item("glass"), glass = new Item("glass"),
silicon = new Item("silicon"){ silicon = new Item("silicon"),
{ biomatter = new Item("biomatter"){
material = false; {
} material = false;
}; flammability = 0.4f;
}
};
public final int id; public final int id;
public final String name; public final String name;
@@ -55,7 +57,7 @@ public class Item{
} }
public void init(){ public void init(){
this.region = Draw.region("icon-" + name); this.region = Draw.region("item-" + name);
} }
public String localizedName(){ public String localizedName(){

View File

@@ -34,16 +34,14 @@ public class Recipes {
new Recipe(distribution, DistributionBlocks.vault, stack(Item.steel, 50)), new Recipe(distribution, DistributionBlocks.vault, stack(Item.steel, 50)),
new Recipe(distribution, DistributionBlocks.unloader, stack(Item.steel, 5)), new Recipe(distribution, DistributionBlocks.unloader, stack(Item.steel, 5)),
//new Recipe(weapon, WeaponBlocks.turret, stack(Item.stone, 4)),
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)), new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
new Recipe(weapon, WeaponBlocks.machineturret, stack(Item.iron, 8), stack(Item.stone, 10)), new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Item.iron, 8), stack(Item.stone, 10)),
//new Recipe(weapon, WeaponBlocks.shotgunturret, stack(Item.iron, 10), stack(Item.stone, 10)),
new Recipe(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)), new Recipe(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
new Recipe(weapon, WeaponBlocks.sniperturret, stack(Item.iron, 15), stack(Item.steel, 10)), new Recipe(weapon, WeaponBlocks.railgunturret, stack(Item.iron, 15), stack(Item.steel, 10)),
new Recipe(weapon, WeaponBlocks.laserturret, stack(Item.steel, 12), stack(Item.titanium, 12)), new Recipe(weapon, WeaponBlocks.laserturret, stack(Item.steel, 12), stack(Item.titanium, 12)),
new Recipe(weapon, WeaponBlocks.mortarturret, stack(Item.steel, 25), stack(Item.titanium, 15)), new Recipe(weapon, WeaponBlocks.flakturret, stack(Item.steel, 25), stack(Item.titanium, 15)),
new Recipe(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 20), stack(Item.titanium, 25), stack(Item.dirium, 15)), new Recipe(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 20), stack(Item.titanium, 25), stack(Item.dirium, 15)),
//new Recipe(weapon, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 20), stack(Item.dirium, 15)), new Recipe(weapon, WeaponBlocks.magmaturret, stack(Item.steel, 80), stack(Item.titanium, 70), stack(Item.dirium, 60)),
new Recipe(weapon, WeaponBlocks.chainturret, stack(Item.steel, 50), stack(Item.titanium, 25), stack(Item.dirium, 40)), new Recipe(weapon, WeaponBlocks.chainturret, stack(Item.steel, 50), stack(Item.titanium, 25), stack(Item.dirium, 40)),
new Recipe(weapon, WeaponBlocks.titanturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)), new Recipe(weapon, WeaponBlocks.titanturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),

View File

@@ -269,7 +269,7 @@ public class BlocksFragment implements Fragment{
desctable.left(); desctable.left();
for(ItemStack stack : recipe.requirements){ for(ItemStack stack : recipe.requirements){
requirements.addImage(Draw.region("icon-"+stack.item.name)).size(8*3); requirements.addImage(stack.item.region).size(8*3);
Label reqlabel = new Label(""); Label reqlabel = new Label("");
reqlabel.update(()->{ reqlabel.update(()->{
@@ -309,7 +309,7 @@ public class BlocksFragment implements Fragment{
pane.setFadeScrollBars(false); pane.setFadeScrollBars(false);
Table top = new Table(); Table top = new Table();
top.left(); top.left();
top.add(new Image(Draw.region(block.name))).size(8*5 * block.width); top.add(new Image(Draw.region(block.name))).size(8*5 * block.size);
top.add("[accent]"+block.formalName).padLeft(6f); top.add("[accent]"+block.formalName).padLeft(6f);
table.add(top).fill().left(); table.add(top).fill().left();
table.row(); table.row();
@@ -357,8 +357,7 @@ public class BlocksFragment implements Fragment{
int amount = state.inventory.getItems()[i]; int amount = state.inventory.getItems()[i];
if(amount == 0) continue; if(amount == 0) continue;
String formatted = amount > 99999999 ? "inf" : format(amount); String formatted = amount > 99999999 ? "inf" : format(amount);
Image image = new Image(Draw.hasRegion("icon-" + Item.getByID(i).name) ? Image image = new Image(Item.getByID(i).region);
Draw.region("icon-" + Item.getByID(i).name) : Draw.region("blank"));
Label label = new Label(formatted); Label label = new Label(formatted);
label.setFontScale(fontscale*1.5f); label.setFontScale(fontscale*1.5f);
itemtable.add(image).size(8*3); itemtable.add(image).size(8*3);

View File

@@ -29,7 +29,7 @@ public class Block{
private static Array<Block> blocks = new Array<>(); private static Array<Block> blocks = new Array<>();
private static ObjectMap<String, Block> map = new ObjectMap<>(); private static ObjectMap<String, Block> map = new ObjectMap<>();
protected static TextureRegion temp = new TextureRegion(); protected Array<Tile> tempTiles = new Array<>();
protected Vector2 offset = new Vector2(); protected Vector2 offset = new Vector2();
/**internal name*/ /**internal name*/
@@ -72,8 +72,8 @@ public class Block{
public ItemStack drops = null; public ItemStack drops = null;
/**liquids that drop from this block, used for pumps*/ /**liquids that drop from this block, used for pumps*/
public Liquid liquidDrop = null; public Liquid liquidDrop = null;
/**multiblock width/height*/ /**multiblock size*/
public int width = 1, height = 1; public int size = 1;
/**Brief block description. Should be short enough fit in the place menu.*/ /**Brief block description. Should be short enough fit in the place menu.*/
public final String description; public final String description;
/**Detailed description of the block. Can be as long as necesary.*/ /**Detailed description of the block. Can be as long as necesary.*/
@@ -131,7 +131,7 @@ public class Block{
} }
public void getStats(Array<String> list){ public void getStats(Array<String> list){
list.add("[gray]size: " + width + "x" + height); list.add("[gray]size: " + size);
list.add("[healthstats]health: " + health); list.add("[healthstats]health: " + health);
} }
@@ -194,11 +194,11 @@ public class Block{
* Tries to put this item into a nearby container, if there are no available * Tries to put this item into a nearby container, if there are no available
* containers, it gets added to the block's inventory.*/ * containers, it gets added to the block's inventory.*/
public void offloadNear(Tile tile, Item item){ public void offloadNear(Tile tile, Item item){
GridPoint2[] nearby = Edges.getEdges(width); GridPoint2[] nearby = Edges.getEdges(size);
for(int j = 0; j < nearby.length; j ++){ for(int j = 0; j < nearby.length; j ++){
Tile other = tile.getNearby(nearby[j]); Tile other = tile.getNearby(nearby[j]);
Tile in = tile.getNearby(Edges.getInsideEdges(width)[j]); Tile in = tile.getNearby(Edges.getInsideEdges(size)[j]);
if(other != null && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){ if(other != null && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
other.block().handleItem(item, other, in); other.block().handleItem(item, other, in);
return; return;
@@ -215,7 +215,7 @@ public class Block{
/**Try dumping a specific item near the tile.*/ /**Try dumping a specific item near the tile.*/
protected boolean tryDump(Tile tile, Item todump){ protected boolean tryDump(Tile tile, Item todump){
GridPoint2[] nearby = Edges.getEdges(width); GridPoint2[] nearby = Edges.getEdges(size);
byte i = (byte)(tile.getDump() % nearby.length); byte i = (byte)(tile.getDump() % nearby.length);
for(int j = 0; j < nearby.length; j ++){ for(int j = 0; j < nearby.length; j ++){
@@ -224,7 +224,7 @@ public class Block{
for(Item item : Item.getAllItems()){ for(Item item : Item.getAllItems()){
other = tile.getNearby(nearby[i]); other = tile.getNearby(nearby[i]);
in = tile.getNearby(Edges.getInsideEdges(width)[i]); in = tile.getNearby(Edges.getInsideEdges(size)[i]);
if(todump != null && item != todump) continue; if(todump != null && item != todump) continue;
@@ -289,11 +289,11 @@ public class Block{
/**Offset for placing and drawing multiblocks.*/ /**Offset for placing and drawing multiblocks.*/
public Vector2 getPlaceOffset(){ public Vector2 getPlaceOffset(){
return offset.set(((width + 1) % 2) * tilesize/2, ((height + 1) % 2) * tilesize/2); return offset.set(((size + 1) % 2) * tilesize/2, ((size + 1) % 2) * tilesize/2);
} }
public boolean isMultiblock(){ public boolean isMultiblock(){
return width != 1 || height != 1; return size > 1;
} }
public static Array<Block> getAllBlocks(){ public static Array<Block> getAllBlocks(){

View File

@@ -20,6 +20,7 @@ import static io.anuke.mindustry.Vars.*;
public class Placement { public class Placement {
private static final Rectangle rect = new Rectangle(); private static final Rectangle rect = new Rectangle();
private static Array<Tile> tempTiles = new Array<>();
/**Returns block type that was broken, or null if unsuccesful.*/ /**Returns block type that was broken, or null if unsuccesful.*/
public static Block breakBlock(int x, int y, boolean effect, boolean sound){ public static Block breakBlock(int x, int y, boolean effect, boolean sound){
@@ -47,7 +48,7 @@ public class Placement {
if(effect) Effects.effect(Fx.breakBlock, tile.worldx(), tile.worldy()); if(effect) Effects.effect(Fx.breakBlock, tile.worldx(), tile.worldy());
}else{ }else{
Tile target = tile.isLinked() ? tile.getLinked() : tile; Tile target = tile.isLinked() ? tile.getLinked() : tile;
Array<Tile> removals = target.getLinkedTiles(); Array<Tile> removals = target.getLinkedTiles(tempTiles);
for(Tile toremove : removals){ for(Tile toremove : removals){
//note that setting a new block automatically unlinks it //note that setting a new block automatically unlinks it
toremove.setBlock(Blocks.air); toremove.setBlock(Blocks.air);
@@ -67,11 +68,11 @@ public class Placement {
tile.setBlock(result, rotation); tile.setBlock(result, rotation);
if(result.isMultiblock()){ if(result.isMultiblock()){
int offsetx = -(result.width-1)/2; int offsetx = -(result.size-1)/2;
int offsety = -(result.height-1)/2; int offsety = -(result.size-1)/2;
for(int dx = 0; dx < result.width; dx ++){ for(int dx = 0; dx < result.size; dx ++){
for(int dy = 0; dy < result.height; dy ++){ for(int dy = 0; dy < result.size; dy ++){
int worldx = dx + offsetx + x; int worldx = dx + offsetx + x;
int worldy = dy + offsety + y; int worldy = dy + offsety + y;
if(!(worldx == x && worldy == y)){ if(!(worldx == x && worldy == y)){
@@ -102,7 +103,7 @@ public class Placement {
return false; return false;
} }
rect.setSize(type.width * tilesize, type.height * tilesize); rect.setSize(type.size * tilesize, type.size * tilesize);
Vector2 offset = type.getPlaceOffset(); Vector2 offset = type.getPlaceOffset();
rect.setCenter(offset.x + x * tilesize, offset.y + y * tilesize); rect.setCenter(offset.x + x * tilesize, offset.y + y * tilesize);
@@ -130,10 +131,10 @@ public class Placement {
if(tile == null || (isSpawnPoint(tile) && (type.solidifes || type.solid))) return false; if(tile == null || (isSpawnPoint(tile) && (type.solidifes || type.solid))) return false;
if(type.isMultiblock()){ if(type.isMultiblock()){
int offsetx = -(type.width-1)/2; int offsetx = -(type.size-1)/2;
int offsety = -(type.height-1)/2; int offsety = -(type.size-1)/2;
for(int dx = 0; dx < type.width; dx ++){ for(int dx = 0; dx < type.size; dx ++){
for(int dy = 0; dy < type.height; dy ++){ for(int dy = 0; dy < type.size; dy ++){
Tile other = world.tile(x + dx + offsetx, y + dy + offsety); Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) || isSpawnPoint(other)){ if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) || isSpawnPoint(other)){
return false; return false;

View File

@@ -16,7 +16,6 @@ import static io.anuke.mindustry.Vars.world;
public class Tile{ public class Tile{
public static final Object tileSetLock = new Object(); public static final Object tileSetLock = new Object();
private static final Array<Tile> tmpArray = new Array<>();
/**Block ID data.*/ /**Block ID data.*/
private byte floor, wall; private byte floor, wall;
@@ -201,18 +200,20 @@ public class Tile{
/**Returns the list of all tiles linked to this multiblock, or an empty array if it's not a multiblock. /**Returns the list of all tiles linked to this multiblock, or an empty array if it's not a multiblock.
* This array contains all linked tiles, including this tile itself.*/ * This array contains all linked tiles, including this tile itself.*/
public synchronized Array<Tile> getLinkedTiles(){ public synchronized Array<Tile> getLinkedTiles(Array<Tile> tmpArray){
Block block = block(); Block block = block();
tmpArray.clear(); tmpArray.clear();
if(!(block.width == 1 && block.height == 1)){ if(block.isMultiblock()){
int offsetx = -(block.width-1)/2; int offsetx = -(block.size-1)/2;
int offsety = -(block.height-1)/2; int offsety = -(block.size-1)/2;
for(int dx = 0; dx < block.width; dx ++){ for(int dx = 0; dx < block.size; dx ++){
for(int dy = 0; dy < block.height; dy ++){ for(int dy = 0; dy < block.size; dy ++){
Tile other = world.tile(x + dx + offsetx, y + dy + offsety); Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
tmpArray.add(other); tmpArray.add(other);
} }
} }
}else{
tmpArray.add(this);
} }
return tmpArray; return tmpArray;
} }
@@ -229,7 +230,7 @@ public class Tile{
} }
public void allNearby(Consumer<Tile> cons){ public void allNearby(Consumer<Tile> cons){
for(GridPoint2 point : Edges.getEdges(block().width)){ for(GridPoint2 point : Edges.getEdges(block().size)){
Tile tile = world.tile(x + point.x, y + point.y); Tile tile = world.tile(x + point.x, y + point.y);
if(tile != null){ if(tile != null){
cons.accept(tile.target()); cons.accept(tile.target());
@@ -238,7 +239,7 @@ public class Tile{
} }
public void allInside(Consumer<Tile> cons){ public void allInside(Consumer<Tile> cons){
for(GridPoint2 point : Edges.getInsideEdges(block().width)){ for(GridPoint2 point : Edges.getInsideEdges(block().size)){
Tile tile = world.tile(x + point.x, y + point.y); Tile tile = world.tile(x + point.x, y + point.y);
if(tile != null){ if(tile != null){
cons.accept(tile); cons.accept(tile);

View File

@@ -33,15 +33,15 @@ public class DefenseBlocks{
}}, }},
steelwalllarge = new Wall("steelwall-large"){{ steelwalllarge = new Wall("steelwall-large"){{
health = 110*4*wallHealthMultiplier; health = 110*4*wallHealthMultiplier;
width = height = 2; size = 2;
}}, }},
titaniumwalllarge = new Wall("titaniumwall-large"){{ titaniumwalllarge = new Wall("titaniumwall-large"){{
health = 150*4*wallHealthMultiplier; health = 150*4*wallHealthMultiplier;
width = height = 2; size = 2;
}}, }},
diriumwalllarge = new Wall("duriumwall-large"){{ diriumwalllarge = new Wall("duriumwall-large"){{
health = 190*4*wallHealthMultiplier; health = 190*4*wallHealthMultiplier;
width = height = 2; size = 2;
}}, }},
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{ titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
health = 150*wallHealthMultiplier; health = 150*wallHealthMultiplier;
@@ -62,7 +62,7 @@ public class DefenseBlocks{
reload = 12f; reload = 12f;
health = 90; health = 90;
powerUsed = 0.13f; powerUsed = 0.13f;
width = height = 2; size = 2;
} }
}, },
@@ -78,6 +78,6 @@ public class DefenseBlocks{
openfx = Fx.dooropenlarge; openfx = Fx.dooropenlarge;
closefx = Fx.doorcloselarge; closefx = Fx.doorcloselarge;
health = 90*4*wallHealthMultiplier; health = 90*4*wallHealthMultiplier;
width = height = 2; size = 2;
}}; }};
} }

View File

@@ -41,12 +41,12 @@ public class DistributionBlocks{
}}, }},
multiplexer = new Router("multiplexer"){{ multiplexer = new Router("multiplexer"){{
width = height = 2; size = 2;
capacity = 80; capacity = 80;
}}, }},
vault = new Vault("vault"){{ vault = new Vault("vault"){{
width = height = 3; size = 3;
}}, }},
unloader = new Unloader("unloader"){{ unloader = new Unloader("unloader"){{

View File

@@ -178,6 +178,7 @@ public class ProductionBlocks{
resource = Blocks.sand; resource = Blocks.sand;
result = Item.quartz; result = Item.quartz;
time = 5; time = 5;
size = 2;
} }
}, },
@@ -215,15 +216,14 @@ public class ProductionBlocks{
}, },
nuclearReactor = new NuclearReactor("nuclearreactor"){ nuclearReactor = new NuclearReactor("nuclearreactor"){
{ {
width = 3; size = 3;
height = 3;
health = 600; health = 600;
breaktime *= 2.3f; breaktime *= 2.3f;
} }
}, },
weaponFactory = new WeaponFactory("weaponfactory"){ weaponFactory = new WeaponFactory("weaponfactory"){
{ {
width = height = 2; size = 2;
health = 250; health = 250;
} }
}; };

View File

@@ -5,9 +5,11 @@ import io.anuke.mindustry.entities.BulletType;
import io.anuke.mindustry.entities.effect.TeslaOrb; import io.anuke.mindustry.entities.effect.TeslaOrb;
import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret; import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
import io.anuke.mindustry.world.blocks.types.defense.LiquidTurret;
import io.anuke.mindustry.world.blocks.types.defense.PowerTurret; import io.anuke.mindustry.world.blocks.types.defense.PowerTurret;
import io.anuke.mindustry.world.blocks.types.defense.Turret; import io.anuke.mindustry.world.blocks.types.defense.Turret;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
@@ -17,16 +19,6 @@ import io.anuke.ucore.util.Mathf;
public class WeaponBlocks{ public class WeaponBlocks{
public static Block public static Block
turret = new Turret("turret"){
{
range = 52;
reload = 15f;
bullet = BulletType.stone;
health = 45;
ammo = Item.stone;
}
},
doubleturret = new Turret("doubleturret"){ doubleturret = new Turret("doubleturret"){
{ {
range = 44; range = 44;
@@ -48,7 +40,7 @@ public class WeaponBlocks{
} }
}, },
machineturret = new Turret("machineturret"){ gatlingturret = new Turret("gatlingturret"){
{ {
range = 65; range = 65;
reload = 7f; reload = 7f;
@@ -58,19 +50,6 @@ public class WeaponBlocks{
} }
}, },
shotgunturret = new Turret("shotgunturret"){
{
range = 50;
reload = 30f;
bullet = BulletType.iron;
ammo = Item.iron;
health = 70;
shots = 5;
inaccuracy = 15f;
shotDelayScale = 0.7f;
}
},
flameturret = new Turret("flameturret"){ flameturret = new Turret("flameturret"){
{ {
range = 45f; range = 45f;
@@ -82,7 +61,7 @@ public class WeaponBlocks{
} }
}, },
sniperturret = new Turret("sniperturret"){ railgunturret = new Turret("railgunturret"){
{ {
shootsound = "railgun"; shootsound = "railgun";
range = 120; range = 120;
@@ -94,7 +73,7 @@ public class WeaponBlocks{
} }
}, },
mortarturret = new Turret("mortarturret"){ flakturret = new Turret("flakturret"){
{ {
shootsound = "bigshot"; shootsound = "bigshot";
rotatespeed = 0.2f; rotatespeed = 0.2f;
@@ -108,6 +87,7 @@ public class WeaponBlocks{
health = 110; health = 110;
shootEffect = Fx.mortarshot; shootEffect = Fx.mortarshot;
shootShake = 2f; shootShake = 2f;
size = 2;
} }
}, },
@@ -123,7 +103,7 @@ public class WeaponBlocks{
} }
}, },
teslaturret = new PowerTurret("waveturret"){ teslaturret = new PowerTurret("teslaturret"){
{ {
shootsound = "tesla"; shootsound = "tesla";
range = 70; range = 70;
@@ -142,6 +122,20 @@ public class WeaponBlocks{
} }
}, },
magmaturret = new LiquidTurret("magmaturret") {
{
shootsound = "flame2";
inaccuracy = 7f;
range = 90f;
reload = 7f;
bullet = BulletType.plasmaflame;
ammoLiquid = Liquid.lava;
liquidPerShot = 3f;
health = 180*3;
size = 2;
}
},
plasmaturret = new Turret("plasmaturret"){ plasmaturret = new Turret("plasmaturret"){
{ {
shootsound = "flame2"; shootsound = "flame2";
@@ -164,7 +158,7 @@ public class WeaponBlocks{
bullet = BulletType.chain; bullet = BulletType.chain;
ammo = Item.uranium; ammo = Item.uranium;
health = 430; health = 430;
width = height = 2; size = 2;
shootCone = 9f; shootCone = 9f;
ammoMultiplier = 8; ammoMultiplier = 8;
shots = 2; shots = 2;
@@ -198,7 +192,7 @@ public class WeaponBlocks{
ammo = Item.uranium; ammo = Item.uranium;
health = 800; health = 800;
ammoMultiplier = 4; ammoMultiplier = 4;
width = height = 3; size = 3;
rotatespeed = 0.07f; rotatespeed = 0.07f;
shootCone = 9f; shootCone = 9f;
shootEffect = Fx.titanshot; shootEffect = Fx.titanshot;

View File

@@ -11,6 +11,7 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.world; import static io.anuke.mindustry.Vars.world;
public class Floor extends Block{ public class Floor extends Block{
protected TextureRegion tempRegion = new TextureRegion();
protected Predicate<Block> blends = block -> block != this; protected Predicate<Block> blends = block -> block != this;
protected boolean blend = true; protected boolean blend = true;
@@ -50,10 +51,10 @@ public class Floor extends Block{
float rx = Mathf.clamp(dx*8, 0, 8-w); float rx = Mathf.clamp(dx*8, 0, 8-w);
float ry = Mathf.clamp(dy*8, 0, 8-h); float ry = Mathf.clamp(dy*8, 0, 8-h);
temp.setTexture(region.getTexture()); tempRegion.setTexture(region.getTexture());
temp.setRegion(region.getRegionX()+x, region.getRegionY()+y+h, w, -h); tempRegion.setRegion(region.getRegionX()+x, region.getRegionY()+y+h, w, -h);
Draw.crect(temp, tile.worldx()-4 + rx, tile.worldy()-4 + ry, w, h); Draw.crect(tempRegion, tile.worldx()-4 + rx, tile.worldy()-4 + ry, w, h);
} }
} }
} }

View File

@@ -66,7 +66,7 @@ public class Door extends Wall{
boolean anyEntities(Tile tile){ boolean anyEntities(Tile tile){
int x = tile.x, y = tile.y; int x = tile.x, y = tile.y;
Block type = tile.block(); Block type = tile.block();
rect.setSize(type.width * tilesize, type.height * tilesize); rect.setSize(type.size * tilesize, type.size * tilesize);
rect.setCenter(tile.drawx(), tile.drawy()); rect.setCenter(tile.drawx(), tile.drawy());
for(SolidEntity e : Entities.getNearby(enemyGroup, x * tilesize, y * tilesize, tilesize * 2f)){ for(SolidEntity e : Entities.getNearby(enemyGroup, x * tilesize, y * tilesize, tilesize * 2f)){

View File

@@ -11,7 +11,7 @@ import java.io.IOException;
public abstract class LiquidTurret extends Turret implements LiquidAcceptor{ public abstract class LiquidTurret extends Turret implements LiquidAcceptor{
public Liquid ammoLiquid = Liquid.water; public Liquid ammoLiquid = Liquid.water;
public float liquidCapacity = 20f; public float liquidCapacity = 60f;
public float liquidPerShot = 1f; public float liquidPerShot = 1f;
public LiquidTurret(String name) { public LiquidTurret(String name) {

View File

@@ -53,6 +53,7 @@ public class Turret extends Block{
protected float shootShake = 0f; protected float shootShake = 0f;
protected int soundReload = 0; protected int soundReload = 0;
protected Translator tr = new Translator(); protected Translator tr = new Translator();
protected String base = null; //name of the region to draw under turret, usually null
public Turret(String name) { public Turret(String name) {
super(name); super(name);
@@ -83,10 +84,10 @@ public class Turret extends Block{
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
if(isMultiblock()){ if(base == null) {
Draw.rect("block-" + width + "x" + height, tile.drawx(), tile.drawy()); Draw.rect("block-" + size, tile.drawx(), tile.drawy());
}else{ }else{
Draw.rect("block", tile.drawx(), tile.drawy()); Draw.rect(base, tile.drawx(), tile.drawy());
} }
} }
@@ -212,14 +213,14 @@ public class Turret extends Block{
protected void shoot(Tile tile){ protected void shoot(Tile tile){
TurretEntity entity = tile.entity(); TurretEntity entity = tile.entity();
tr.trns(entity.rotation, width * tilesize/2); tr.trns(entity.rotation, size * tilesize/2);
for(int i = 0; i < shots; i ++){ for(int i = 0; i < shots; i ++){
if(Mathf.zero(shotDelayScale)){ if(Mathf.zero(shotDelayScale)){
bullet(tile, entity.rotation + Mathf.range(inaccuracy)); bullet(tile, entity.rotation + Mathf.range(inaccuracy));
}else{ }else{
Timers.run(i * shotDelayScale, () -> { Timers.run(i * shotDelayScale, () -> {
tr.trns(entity.rotation, width * tilesize/2f); tr.trns(entity.rotation, size * tilesize/2f);
bullet(tile, entity.rotation + Mathf.range(inaccuracy)); bullet(tile, entity.rotation + Mathf.range(inaccuracy));
}); });
} }

View File

@@ -1,23 +1,24 @@
package io.anuke.mindustry.world.blocks.types.production; package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Layer; import io.anuke.mindustry.world.Layer;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
public class Drill extends Block{ public class Drill extends Block{
protected final int timerDrill = timers++; protected final int timerDrill = timers++;
protected final int timerDump = timers++; protected final int timerDump = timers++;
protected final Array<Tile> drawTiles = new Array<>();
protected Block resource; protected Block resource;
protected Item result; protected Item result;
protected float time = 5; protected float time = 5;
@@ -42,10 +43,21 @@ public class Drill extends Block{
public void update(Tile tile){ public void update(Tile tile){
TileEntity entity = tile.entity; TileEntity entity = tile.entity;
if((tile.floor() == resource || (resource.drops.equals(tile.floor().drops))) int mines = 0;
&& entity.timer.get(timerDrill, 60 * time) && tile.entity.getItem(result) < capacity){
offloadNear(tile, result); if(isMultiblock()){
Effects.effect(drillEffect, tile.worldx(), tile.worldy()); for(Tile other : tile.getLinkedTiles(tempTiles)){
if(isValid(other)){
mines ++;
}
}
}else{
if(isValid(tile)) mines = 1;
}
if(mines > 0 && entity.timer.get(timerDrill, 60 * time) && tile.entity.getItem(result) < capacity){
for(int i = 0; i < mines; i ++) offloadNear(tile, result);
Effects.effect(drillEffect, tile.drawx(), tile.drawy());
} }
if(entity.timer.get(timerDump, 30)){ if(entity.timer.get(timerDump, 30)){
@@ -55,14 +67,27 @@ public class Drill extends Block{
@Override @Override
public boolean isLayer(Tile tile){ public boolean isLayer(Tile tile){
return tile.floor() != resource && resource != null && !(resource.drops.equals(tile.floor().drops)); if(isMultiblock()){
for(Tile other : tile.getLinkedTiles(drawTiles)){
if(isValid(other)){
return false;
}
}
return true;
}else{
return !isValid(tile);
}
} }
@Override @Override
public void drawLayer(Tile tile){ public void drawLayer(Tile tile){
Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f)); Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f));
Draw.rect("cross", tile.worldx(), tile.worldy()); Draw.rect("cross-" + size, tile.drawx(), tile.drawy());
Draw.color(); Draw.color();
} }
boolean isValid(Tile tile){
return tile.floor() == resource || (resource != null && resource.drops.equals(tile.floor().drops));
}
} }

View File

@@ -194,10 +194,10 @@ public class Generator extends PowerBlock{
if(target != null){ if(target != null){
boolean interfering = isInterfering(target, rotation); boolean interfering = isInterfering(target, rotation);
t1.trns(rotation * 90, target.block().width * tilesize / 2 + 2f + t1.trns(rotation * 90, target.block().size * tilesize / 2 + 2f +
(interfering ? Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - tilesize / 2f * target.block().width + 1 : 0)); (interfering ? Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - tilesize / 2f * target.block().size + 1 : 0));
t2.trns(rotation * 90, width * tilesize / 2 + 2f); t2.trns(rotation * 90, size * tilesize / 2 + 2f);
if(!interfering){ if(!interfering){
Draw.tint(Hue.mix(Color.GRAY, Color.WHITE, 0.904f + Mathf.sin(Timers.time(), 1.7f, 0.06f))); Draw.tint(Hue.mix(Color.GRAY, Color.WHITE, 0.904f + Mathf.sin(Timers.time(), 1.7f, 0.06f)));
@@ -222,8 +222,8 @@ public class Generator extends PowerBlock{
float sclx = (relative == 1 || relative == 3) ? entity.laserThickness : 1f; float sclx = (relative == 1 || relative == 3) ? entity.laserThickness : 1f;
float scly = (relative == 1 || relative == 3) ? 1f : entity.laserThickness; float scly = (relative == 1 || relative == 3) ? 1f : entity.laserThickness;
Draw.rect("laserfull", Draw.rect("laserfull",
tile.worldx() + Geometry.d4[relative].x * width * tilesize / 2f, tile.worldx() + Geometry.d4[relative].x * size * tilesize / 2f,
tile.worldy() + Geometry.d4[relative].y * width * tilesize / 2f , s * sclx, s * scly); tile.worldy() + Geometry.d4[relative].y * size * tilesize / 2f , s * sclx, s * scly);
} }
Draw.color(); Draw.color();

View File

@@ -89,8 +89,8 @@ public class NuclearReactor extends LiquidPowerGenerator{
if(entity.heat > smokeThreshold){ if(entity.heat > smokeThreshold){
float smoke = 1.0f + (entity.heat - smokeThreshold) / (1f - smokeThreshold); //ranges from 1.0 to 2.0 float smoke = 1.0f + (entity.heat - smokeThreshold) / (1f - smokeThreshold); //ranges from 1.0 to 2.0
if(Mathf.chance(smoke / 20.0 * Timers.delta())){ if(Mathf.chance(smoke / 20.0 * Timers.delta())){
Effects.effect(Fx.reactorsmoke, tile.worldx() + Mathf.range(width * tilesize / 2f), Effects.effect(Fx.reactorsmoke, tile.worldx() + Mathf.range(size * tilesize / 2f),
tile.worldy() + Mathf.random(height * tilesize / 2f)); tile.worldy() + Mathf.random(size * tilesize / 2f));
} }
} }
@@ -166,7 +166,7 @@ public class NuclearReactor extends LiquidPowerGenerator{
NuclearReactorEntity entity = tile.entity(); NuclearReactorEntity entity = tile.entity();
Draw.color(coolColor, hotColor, entity.heat); Draw.color(coolColor, hotColor, entity.heat);
Draw.rect("white", tile.drawx(), tile.drawy(), width * tilesize, height * tilesize); Draw.rect("white", tile.drawx(), tile.drawy(), size * tilesize, size * tilesize);
if(entity.heat > flashThreshold){ if(entity.heat > flashThreshold){
float flash = 1f + ((entity.heat - flashThreshold) / (1f - flashThreshold)) * 5.4f; float flash = 1f + ((entity.heat - flashThreshold) / (1f - flashThreshold)) * 5.4f;

View File

@@ -16,8 +16,7 @@ public class CoreBlock extends StorageBlock {
health = 800; health = 800;
solid = true; solid = true;
destructible = true; destructible = true;
width = 3; size = 3;
height = 3;
} }
@Override @Override