Added light item bridge

This commit is contained in:
Anuken 2018-04-08 21:46:48 -04:00
parent 21fe0f9246
commit aa28c3a45b
16 changed files with 394 additions and 117 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

View File

@ -60,44 +60,72 @@ core
orig: 24, 24
offset: 0, 0
index: -1
junction
itembridge
rotate: false
xy: 453, 124
xy: 463, 144
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidjunction
junction
rotate: false
xy: 463, 134
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
lightbridge
rotate: false
xy: 463, 114
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidrouter
lightbridge-arrow
rotate: false
xy: 473, 124
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidrouter-bottom
lightbridge-end
rotate: false
xy: 483, 134
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidjunction
rotate: false
xy: 473, 114
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidrouter
rotate: false
xy: 483, 124
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidrouter-bottom
rotate: false
xy: 493, 134
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidrouter-liquid
rotate: false
xy: 493, 144
xy: 483, 114
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidrouter-top
rotate: false
xy: 473, 114
xy: 493, 124
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -132,70 +160,70 @@ multiplexer
index: -1
poweredconveyor
rotate: false
xy: 523, 133
xy: 543, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
poweredconveyormove
rotate: false
xy: 533, 143
xy: 533, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
pulseconduit-bottom
rotate: false
xy: 533, 123
xy: 553, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
pulseconduit-top
rotate: false
xy: 543, 133
xy: 563, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
router
rotate: false
xy: 513, 113
xy: 553, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sortedunloader
rotate: false
xy: 827, 405
xy: 867, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sorter
rotate: false
xy: 837, 405
xy: 877, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
splitter
rotate: false
xy: 857, 405
xy: 897, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steelconveyor
rotate: false
xy: 867, 405
xy: 907, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steelconveyormove
rotate: false
xy: 877, 405
xy: 917, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -209,7 +237,7 @@ teleporter-top
index: -1
unloader
rotate: false
xy: 876, 385
xy: 896, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -223,7 +251,7 @@ vault
index: -1
vault-icon
rotate: false
xy: 886, 395
xy: 906, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -489,7 +517,7 @@ iron3
index: -1
lava
rotate: false
xy: 463, 134
xy: 473, 144
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -503,63 +531,63 @@ lavaedge
index: -1
lead1
rotate: false
xy: 453, 114
xy: 463, 124
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
lead2
rotate: false
xy: 463, 124
xy: 473, 134
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
lead3
rotate: false
xy: 473, 134
xy: 483, 144
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
metalfloor1
rotate: false
xy: 483, 114
xy: 503, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
metalfloor2
rotate: false
xy: 493, 124
xy: 513, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
metalfloor3
rotate: false
xy: 493, 114
xy: 503, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
metalfloor4
rotate: false
xy: 503, 143
xy: 513, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
metalfloor5
rotate: false
xy: 503, 133
xy: 523, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
metalfloor6
rotate: false
xy: 513, 143
xy: 513, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -573,14 +601,14 @@ metalflooredge
index: -1
mossblock
rotate: false
xy: 503, 123
xy: 523, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
oil
rotate: false
xy: 513, 133
xy: 533, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -594,56 +622,56 @@ oiledge
index: -1
rock1
rotate: false
xy: 563, 123
xy: 533, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
rock2
rotate: false
xy: 503, 113
xy: 543, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sand1
rotate: false
xy: 543, 113
xy: 573, 136
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sand2
rotate: false
xy: 553, 113
xy: 573, 126
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sand3
rotate: false
xy: 563, 113
xy: 573, 116
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sandblock1
rotate: false
xy: 576, 146
xy: 586, 146
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sandblock2
rotate: false
xy: 573, 136
xy: 583, 136
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sandblock3
rotate: false
xy: 573, 126
xy: 583, 126
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -657,56 +685,56 @@ sandedge
index: -1
shrub
rotate: false
xy: 606, 148
xy: 646, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
shrubshadow
rotate: false
xy: 616, 148
xy: 656, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
snow1
rotate: false
xy: 646, 148
xy: 797, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
snow2
rotate: false
xy: 656, 148
xy: 807, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
snow3
rotate: false
xy: 777, 405
xy: 817, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
snowblock1
rotate: false
xy: 787, 405
xy: 827, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
snowblock2
rotate: false
xy: 797, 405
xy: 837, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
snowblock3
rotate: false
xy: 807, 405
xy: 847, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -720,7 +748,7 @@ snowedge
index: -1
space
rotate: false
xy: 847, 405
xy: 887, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -734,42 +762,42 @@ spaceedge
index: -1
stone1
rotate: false
xy: 927, 405
xy: 786, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone2
rotate: false
xy: 776, 395
xy: 796, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone3
rotate: false
xy: 776, 385
xy: 796, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stoneblock1
rotate: false
xy: 786, 395
xy: 806, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stoneblock2
rotate: false
xy: 786, 385
xy: 806, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stoneblock3
rotate: false
xy: 796, 395
xy: 816, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -783,49 +811,49 @@ stoneedge
index: -1
thorium1
rotate: false
xy: 816, 385
xy: 836, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
thorium2
rotate: false
xy: 826, 395
xy: 846, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
thorium3
rotate: false
xy: 826, 385
xy: 846, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titanium1
rotate: false
xy: 836, 395
xy: 856, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titanium2
rotate: false
xy: 836, 385
xy: 856, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titanium3
rotate: false
xy: 846, 395
xy: 866, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
water
rotate: false
xy: 896, 385
xy: 916, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -895,7 +923,7 @@ enemyspawn
index: -1
playerspawn
rotate: false
xy: 513, 123
xy: 533, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1007,7 +1035,7 @@ largesolarpanel
index: -1
liquidcombustiongenerator
rotate: false
xy: 483, 144
xy: 493, 144
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1035,14 +1063,14 @@ nuclearreactor-lights
index: -1
powerinfinite
rotate: false
xy: 523, 123
xy: 543, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
powernode
rotate: false
xy: 533, 133
xy: 553, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1056,28 +1084,28 @@ powernodelarge
index: -1
powervoid
rotate: false
xy: 543, 143
xy: 543, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
rtgenerator
rotate: false
xy: 523, 113
xy: 563, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
rtgenerator-top
rotate: false
xy: 533, 113
xy: 576, 146
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
shieldgenerator
rotate: false
xy: 583, 136
xy: 606, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1091,7 +1119,7 @@ shieldprojector
index: -1
solarpanel
rotate: false
xy: 817, 405
xy: 857, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1112,7 +1140,7 @@ teleporter-top
index: -1
thermalgenerator
rotate: false
xy: 816, 395
xy: 836, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1273,14 +1301,14 @@ irondrill-top
index: -1
itemsource
rotate: false
xy: 463, 144
xy: 443, 114
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
itemvoid
rotate: false
xy: 443, 114
xy: 453, 124
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1308,21 +1336,21 @@ laserdrill-top
index: -1
lavasmelter
rotate: false
xy: 473, 144
xy: 453, 114
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
liquidsource
rotate: false
xy: 483, 124
xy: 493, 114
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
melter
rotate: false
xy: 493, 134
xy: 503, 143
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1385,7 +1413,7 @@ oilextractor-top
index: -1
oilrefinery
rotate: false
xy: 523, 143
xy: 523, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1469,63 +1497,63 @@ siliconsmelter-top
index: -1
pulverizer
rotate: false
xy: 553, 143
xy: 553, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
pulverizer-rotator
rotate: false
xy: 543, 123
xy: 563, 133
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
pump
rotate: false
xy: 553, 133
xy: 563, 123
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
reinforceddrill
rotate: false
xy: 563, 143
xy: 503, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
reinforceddrill-rotator
rotate: false
xy: 553, 123
xy: 513, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
reinforceddrill-top
rotate: false
xy: 563, 133
xy: 523, 113
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
separator
rotate: false
xy: 573, 116
xy: 583, 116
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
separator-liquid
rotate: false
xy: 586, 146
xy: 596, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
siliconextractor
rotate: false
xy: 626, 148
xy: 777, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1539,56 +1567,56 @@ siliconsmelter
index: -1
smelter
rotate: false
xy: 636, 148
xy: 787, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steeldrill
rotate: false
xy: 887, 405
xy: 927, 405
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steeldrill-rotator
rotate: false
xy: 897, 405
xy: 776, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steeldrill-top
rotate: false
xy: 907, 405
xy: 776, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonedrill
rotate: false
xy: 796, 385
xy: 816, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stoneformer
rotate: false
xy: 806, 395
xy: 826, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titaniumdrill
rotate: false
xy: 846, 385
xy: 866, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titaniumdrill-top
rotate: false
xy: 856, 395
xy: 876, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1917,7 +1945,7 @@ ironwall
index: -1
steelwall
rotate: false
xy: 917, 405
xy: 786, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -1931,21 +1959,21 @@ steelwall-large
index: -1
stonewall
rotate: false
xy: 806, 385
xy: 826, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titaniumshieldwall
rotate: false
xy: 856, 385
xy: 876, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
titaniumwall
rotate: false
xy: 866, 395
xy: 886, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -2029,7 +2057,7 @@ shell-back
index: -1
shot
rotate: false
xy: 596, 148
xy: 636, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -3183,42 +3211,42 @@ clustergun-equip
index: -1
shockgun
rotate: false
xy: 583, 126
xy: 616, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
shockgun-equip
rotate: false
xy: 583, 116
xy: 626, 148
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
triblaster
rotate: false
xy: 866, 385
xy: 886, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
triblaster-equip
rotate: false
xy: 876, 395
xy: 896, 395
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
vulcan
rotate: false
xy: 886, 385
xy: 906, 385
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
vulcan-equip
rotate: false
xy: 896, 395
xy: 916, 395
size: 8, 8
orig: 8, 8
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Sun Apr 08 12:22:42 EDT 2018
#Sun Apr 08 21:39:05 EDT 2018
version=release
androidBuildCode=874
androidBuildCode=889
name=Mindustry
code=3.5
build=custom build

View File

@ -39,6 +39,7 @@ public class Recipes {
new Recipe(distribution, StorageBlocks.core, stack(Items.steel, 50)),
new Recipe(distribution, StorageBlocks.unloader, stack(Items.steel, 5)),
new Recipe(distribution, StorageBlocks.sortedunloader, stack(Items.steel, 5)),
new Recipe(distribution, DistributionBlocks.itembridge, stack(Items.steel, 5)),
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Items.iron, 7)),
new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Items.iron, 8)),

View File

@ -38,6 +38,10 @@ public class DistributionBlocks{
speed = 53;
}},
itembridge = new ItemBridge("itembridge"){{
range = 7;
}},
sorter = new Sorter("sorter"),
splitter = new Splitter("splitter");

View File

@ -57,6 +57,8 @@ public class ContentLoader {
block.init();
}
//TODO 128 blocks!
Log.info("--- CONTENT INFO ---");
Log.info("Blocks loaded: {0}\nItems loaded: {1}\nLiquids loaded: {2}\nUpgrades loaded: {3}\nUnits loaded: {4}\nAmmo types loaded: {5}\nStatus effects loaded: {6}",
Block.getAllBlocks().size, Item.getAllItems().size, Liquid.getAllLiquids().size,

View File

@ -108,7 +108,7 @@ public class UI extends SceneModule{
Colors.put("placeRotate", Color.ORANGE);
Colors.put("break", Color.CORAL);
Colors.put("breakStart", Color.YELLOW);
Colors.put("breakInvalid", Color.RED);
Colors.put("breakInvalid", Color.SCARLET);
Colors.put("range", Colors.get("accent"));
Colors.put("power", Color.valueOf("fbd367"));
}

View File

@ -66,7 +66,7 @@ public class BlockRenderer{
int rangex = (int) (camera.viewportWidth * camera.zoom / tilesize / 2)+2;
int rangey = (int) (camera.viewportHeight * camera.zoom / tilesize / 2)+2;
int expandr = 3;
int expandr = 4;
Graphics.surface(renderer.shadowSurface);

View File

@ -75,6 +75,14 @@ public class Tile{
return -1;
}
public byte absoluteRelativeTo(int cx, int cy){
if(x == cx && y <= cy - 1) return 1;
if(x == cx && y >= cy + 1) return 3;
if(x <= cx - 1 && y == cy) return 0;
if(x >= cx + 1 && y == cy) return 2;
return -1;
}
public byte sizedRelativeTo(int cx, int cy){
if(x == cx && y == cy - 1 - block().size/2) return 1;
if(x == cx && y == cy + 1 + block().size/2) return 3;
@ -264,6 +272,10 @@ public class Tile{
return world.tile(x + relative.x, y + relative.y);
}
public Tile getNearby(int dx, int dy){
return world.tile(x + dx, y + dy);
}
public Tile getNearby(int rotation){
if(rotation == 0) return world.tile(x + 1, y);
if(rotation == 1) return world.tile(x, y + 1);

View File

@ -0,0 +1,213 @@
package io.anuke.mindustry.world.blocks.types.distribution;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Layer;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.CapStyle;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world;
public class ItemBridge extends Block {
protected int timerTransport = timers++;
protected int range;
protected float powerUse = 0.05f;
protected float transportTime = 2f;
public ItemBridge(String name) {
super(name);
update = true;
solid = true;
hasPower = true;
layer = Layer.power;
expanded = true;
itemCapacity = 30;
}
@Override
public boolean isConfigurable(Tile tile) {
return true;
}
@Override
public void drawPlace(int x, int y, int rotation, boolean valid) {
Lines.stroke(2f);
Draw.color("place");
for(int i = 0; i < 4; i ++){
Lines.dashLine(
x * tilesize + Geometry.d4[i].x * tilesize/2f,
y * tilesize + Geometry.d4[i].y * tilesize/2f,
x * tilesize + Geometry.d4[i].x * range * tilesize,
y * tilesize + Geometry.d4[i].y * range * tilesize,
range);
}
Draw.reset();
}
@Override
public void drawConfigure(Tile tile){
ItemBridgeEntity entity = tile.entity();
Draw.color("accent");
Lines.stroke(1f);
Lines.square(tile.drawx(), tile.drawy(),
tile.block().size * tilesize / 2f + 1f);
for(int i = 1; i <= range; i ++){
for(int j = 0; j < 4; j ++){
Tile other = tile.getNearby(Geometry.d4[j].x * i, Geometry.d4[j].y * i);
if(linkValid(tile, other)){
boolean linked = other.packedPosition() == entity.link;
Draw.color(linked ? "place" : "breakInvalid");
Lines.square(other.drawx(), other.drawy(),
other.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Timers.time(), 4f, 1f)));
}
}
}
Draw.reset();
}
@Override
public boolean onConfigureTileTapped(Tile tile, Tile other) {
ItemBridgeEntity entity = tile.entity();
if(linkValid(tile, other)){
if(entity.link == other.packedPosition()){
entity.link = -1;
}else{
entity.link = other.packedPosition();
}
return false;
}
return true;
}
@Override
public void update(Tile tile) {
ItemBridgeEntity entity = tile.entity();
entity.time += entity.cycleSpeed*Timers.delta();
entity.time2 += (entity.cycleSpeed-1f)*Timers.delta();
Tile other = world.tile(entity.link);
if(!linkValid(tile, other)){
tryDump(tile);
}else{
float use = Math.min(powerCapacity, powerUse * Timers.delta());
if(entity.power.amount >= use){
entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f);
entity.power.amount -= use;
}else{
entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f);
}
if(entity.uptime >= 0.5f && entity.timer.get(timerTransport, transportTime)){
Item item = entity.inventory.takeItem();
if(item != null && other.block().acceptItem(item, other, tile)){
other.block().handleItem(item, other, tile);
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f);
}else{
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f);
if(item != null) entity.inventory.addItem(item, 1);
}
}
}
}
@Override
public void drawLayer(Tile tile) {
ItemBridgeEntity entity = tile.entity();
Tile other = world.tile(entity.link);
if(!linkValid(tile, other)) return;
int i = tile.absoluteRelativeTo(other.x, other.y);
Draw.color(Color.WHITE, Color.BLACK, Mathf.absin(Timers.time(), 6f, 0.07f));
Draw.alpha(Math.max(entity.uptime, 0.25f));
Draw.rect("lightbridge-end", tile.drawx(), tile.drawy(), i*90 + 90);
Draw.rect("lightbridge-end", other.drawx(), other.drawy(), i*90 + 270);
Lines.stroke(8f);
Lines.line(Draw.region("lightbridge"),
tile.worldx(),
tile.worldy(),
other.worldx(),
other.worldy(), CapStyle.none, -tilesize/2f);
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
float time = entity.time2/1.7f;
int arrows = (dist)*tilesize/4-2;
Draw.color();
for(int a = 0; a < arrows; a ++){
Draw.alpha(Mathf.absin(a/(float)arrows - entity.time/100f, 0.1f, 1f) * entity.uptime);
Draw.rect("lightbridge-arrow",
tile.worldx() + Geometry.d4[i].x*(tilesize/2f + a*4f + time % 4f),
tile.worldy() + Geometry.d4[i].y*(tilesize/2f + a*4f + time % 4f),
i*90f);
}
Draw.reset();
}
@Override
public boolean acceptItem(Item item, Tile tile, Tile source) {
return tile.entity.inventory.totalItems() < itemCapacity;
}
@Override
public TileEntity getEntity() {
return new ItemBridgeEntity();
}
public boolean linkValid(Tile tile, Tile other){
if(other == null) return false;
if(tile.x == other.x){
if(Math.abs(tile.x - other.x) > range) return false;
}else if(tile.y == other.y){
if(Math.abs(tile.y - other.y) > range) return false;
}else{
return false;
}
return other.block() instanceof ItemBridge && other.<ItemBridgeEntity>entity().link != tile.packedPosition();
}
public static class ItemBridgeEntity extends TileEntity{
public int link = -1;
public float uptime;
public float time;
public float time2;
public float cycleSpeed = 1f;
@Override
public void write(DataOutputStream stream) throws IOException {
stream.writeInt(link);
}
@Override
public void read(DataInputStream stream) throws IOException {
link = stream.readInt();
}
}
}

View File

@ -129,14 +129,10 @@ public class PowerDistributor extends PowerBlock{
if(link != tile && linkValid(tile, link)){
boolean linked = linked(tile, link);
if(linked){
Draw.color("place");
}else{
Draw.color(Color.SCARLET);
}
Draw.color(linked ? "place" : "breakInvalid");
Lines.square(link.drawx(), link.drawy(),
link.block().size * tilesize / 2f + 1f + Mathf.absin(Timers.time(), 4f, 1f));
link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Timers.time(), 4f, 1f)));
if(entity.links.size >= maxNodes && !linked){
Draw.color();
@ -266,7 +262,7 @@ public class PowerDistributor extends PowerBlock{
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy()) <= Math.max(laserRange * tilesize,
((PowerDistributor)link.block()).laserRange * tilesize) - tilesize/2f
+ (link.block().size-1)*tilesize/2f + (tile.block().size-1)*tilesize/2f &&
oe.links.size < ((PowerDistributor)link.block()).maxNodes;
(oe.links.size < ((PowerDistributor)link.block()).maxNodes || oe.links.contains(tile.packedPosition()));
}else{
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy())
<= laserRange * tilesize - tilesize/2f + (link.block().size-1)*tilesize;

View File

@ -4,6 +4,8 @@ import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.BarType;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
@ -22,10 +24,17 @@ public class Incinerator extends Block {
super(name);
hasPower = true;
hasInventory = false;
hasLiquids = true;
update = true;
solid = true;
}
@Override
public void setBars() {
super.setBars();
bars.remove(BarType.liquid);
}
@Override
public void update(Tile tile) {
IncineratorEntity entity = tile.entity();
@ -49,7 +58,6 @@ public class Incinerator extends Block {
if(entity.heat > 0f){
float g = 0.3f;
float r = 0.06f;
float cr = Mathf.random(0.05f);
Draw.alpha(((1f-g) + Mathf.absin(Timers.time(), 8f, g) + Mathf.random(r) - r) * entity.heat);
@ -75,6 +83,19 @@ public class Incinerator extends Block {
return entity.heat > 0.5f;
}
@Override
public void handleLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
if(Mathf.chance(0.02)){
Effects.effect(effect, tile.drawx(), tile.drawy());
}
}
@Override
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
IncineratorEntity entity = tile.entity();
return entity.heat > 0.5f;
}
@Override
public TileEntity getEntity() {
return new IncineratorEntity();