Improved power grid sprites / Bugfixes
This commit is contained in:
@@ -27,9 +27,9 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":core")
|
implementation project(":core")
|
||||||
implementation project(":kryonet")
|
implementation project(":kryonet")
|
||||||
implementation 'com.android.support:support-v4:25.3.1'
|
implementation 'com.android.support:support-v4:28.0.0'
|
||||||
implementation 'org.sufficientlysecure:donations:2.5'
|
implementation 'org.sufficientlysecure:donations:2.5'
|
||||||
implementation 'com.google.android.gms:play-services-auth:11.8.0'
|
implementation 'com.google.android.gms:play-services-auth:16.0.1'
|
||||||
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 244 B |
Binary file not shown.
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
@@ -60,14 +60,15 @@ public class Palette{
|
|||||||
bar = Color.SLATE,
|
bar = Color.SLATE,
|
||||||
interact = Color.ORANGE,
|
interact = Color.ORANGE,
|
||||||
accent = Color.valueOf("f4ba6e"),
|
accent = Color.valueOf("f4ba6e"),
|
||||||
accentBack = new Color(accent.r * 0.8f, accent.g * 0.8f, accent.b * 0.8f, 1f),
|
accentBack = Color.valueOf("d58c4b"),
|
||||||
place = Color.valueOf("6335f8"),
|
place = Color.valueOf("6335f8"),
|
||||||
remove = Color.valueOf("e55454"),
|
remove = Color.valueOf("e55454"),
|
||||||
removeBack = Color.valueOf("a73e3e"),
|
removeBack = Color.valueOf("a73e3e"),
|
||||||
placeRotate = accent,
|
placeRotate = accent,
|
||||||
breakInvalid = Color.valueOf("d44b3d"),
|
breakInvalid = Color.valueOf("d44b3d"),
|
||||||
range = Color.valueOf("f4ba6e"),
|
range = Color.valueOf("f4ba6e"),
|
||||||
power = Color.valueOf("fbd367"),
|
power = Color.valueOf("fbad67"),
|
||||||
|
powerLight = Color.valueOf("fbd367"),
|
||||||
placing = Color.valueOf("616161"),
|
placing = Color.valueOf("616161"),
|
||||||
|
|
||||||
lightTrail = Color.valueOf("ffe2a9"),
|
lightTrail = Color.valueOf("ffe2a9"),
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
|
|||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.net.ValidateException;
|
import io.anuke.mindustry.net.ValidateException;
|
||||||
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.type.Recipe;
|
import io.anuke.mindustry.type.Recipe;
|
||||||
import io.anuke.mindustry.ui.fragments.OverlayFragment;
|
import io.anuke.mindustry.ui.fragments.OverlayFragment;
|
||||||
@@ -76,10 +77,11 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
|
|
||||||
player.isTransferring = true;
|
player.isTransferring = true;
|
||||||
|
|
||||||
ItemStack stack = player.inventory.getItem();
|
Item item = player.inventory.getItem().item;
|
||||||
int accepted = tile.block().acceptStack(stack.item, stack.amount, tile, player);
|
int amount = player.inventory.getItem().amount;
|
||||||
|
int accepted = tile.block().acceptStack(item, amount, tile, player);
|
||||||
|
player.inventory.getItem().amount -= accepted;
|
||||||
|
|
||||||
boolean clear = stack.amount == accepted;
|
|
||||||
int sent = Mathf.clamp(accepted / 4, 1, 8);
|
int sent = Mathf.clamp(accepted / 4, 1, 8);
|
||||||
int removed = accepted / sent;
|
int removed = accepted / sent;
|
||||||
int[] remaining = {accepted, accepted};
|
int[] remaining = {accepted, accepted};
|
||||||
@@ -88,29 +90,24 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
for(int i = 0; i < sent; i++){
|
for(int i = 0; i < sent; i++){
|
||||||
boolean end = i == sent - 1;
|
boolean end = i == sent - 1;
|
||||||
Timers.run(i * 3, () -> {
|
Timers.run(i * 3, () -> {
|
||||||
tile.block().getStackOffset(stack.item, tile, stackTrns);
|
tile.block().getStackOffset(item, tile, stackTrns);
|
||||||
|
|
||||||
ItemTransfer.create(stack.item,
|
ItemTransfer.create(item,
|
||||||
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
|
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
|
||||||
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
|
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
|
||||||
if(tile.block() != block || tile.entity == null) return;
|
if(tile.block() != block || tile.entity == null) return;
|
||||||
|
|
||||||
tile.block().handleStack(stack.item, removed, tile, player);
|
tile.block().handleStack(item, removed, tile, player);
|
||||||
remaining[1] -= removed;
|
remaining[1] -= removed;
|
||||||
|
|
||||||
if(end && remaining[1] > 0){
|
if(end && remaining[1] > 0){
|
||||||
tile.block().handleStack(stack.item, remaining[1], tile, player);
|
tile.block().handleStack(item, remaining[1], tile, player);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stack.amount -= removed;
|
|
||||||
remaining[0] -= removed;
|
remaining[0] -= removed;
|
||||||
|
|
||||||
if(end){
|
if(end){
|
||||||
stack.amount -= remaining[0];
|
|
||||||
if(clear){
|
|
||||||
player.inventory.clearItem();
|
|
||||||
}
|
|
||||||
player.isTransferring = false;
|
player.isTransferring = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class BlockLocMission extends Mission{
|
|||||||
float rot = players[0].angleTo(x * tilesize + block.offset(), y * tilesize + block.offset());
|
float rot = players[0].angleTo(x * tilesize + block.offset(), y * tilesize + block.offset());
|
||||||
float len = 12f;
|
float len = 12f;
|
||||||
|
|
||||||
Draw.color(Palette.accent.r * 0.8f,Palette.accent.g * 0.8f,Palette.accent.b * 0.8f);
|
Draw.color(Palette.accentBack);
|
||||||
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len), rot);
|
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len), rot);
|
||||||
Draw.color(Palette.accent);
|
Draw.color(Palette.accent);
|
||||||
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len) + 1f, rot);
|
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len) + 1f, rot);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class Conveyor extends Block{
|
|||||||
if(pos.item == null) continue;
|
if(pos.item == null) continue;
|
||||||
|
|
||||||
tr1.trns(rotation * 90, tilesize, 0);
|
tr1.trns(rotation * 90, tilesize, 0);
|
||||||
tr2.trns(rotation * 90, -tilesize / 2, pos.x * tilesize / 2);
|
tr2.trns(rotation * 90, -tilesize / 2f, pos.x * tilesize / 2f);
|
||||||
|
|
||||||
Draw.rect(pos.item.region,
|
Draw.rect(pos.item.region,
|
||||||
(int) (tile.x * tilesize + tr1.x * pos.y + tr2.x),
|
(int) (tile.x * tilesize + tr1.x * pos.y + tr2.x),
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import io.anuke.mindustry.entities.TileEntity;
|
|||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.world.Edges;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.PowerBlock;
|
import io.anuke.mindustry.world.blocks.PowerBlock;
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
@@ -17,7 +16,6 @@ import io.anuke.ucore.core.Settings;
|
|||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.graphics.Shapes;
|
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Translator;
|
import io.anuke.ucore.util.Translator;
|
||||||
@@ -145,11 +143,10 @@ public class PowerNode extends PowerBlock{
|
|||||||
public void drawSelect(Tile tile){
|
public void drawSelect(Tile tile){
|
||||||
super.drawSelect(tile);
|
super.drawSelect(tile);
|
||||||
|
|
||||||
Draw.color(Palette.power);
|
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
|
|
||||||
Lines.poly(Edges.getPixelPolygon(laserRange), tile.worldx() - tilesize / 2, tile.worldy() - tilesize / 2, tilesize);
|
Draw.color(Palette.accent);
|
||||||
|
Lines.poly(tile.drawx(), tile.drawy(), 50, laserRange*tilesize);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,14 +157,10 @@ public class PowerNode extends PowerBlock{
|
|||||||
Draw.color(Palette.accent);
|
Draw.color(Palette.accent);
|
||||||
|
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Lines.square(tile.drawx(), tile.drawy(),
|
Lines.circle(tile.drawx(), tile.drawy(),
|
||||||
tile.block().size * tilesize / 2f + 1f + Mathf.absin(Timers.time(), 4f, 1f));
|
tile.block().size * tilesize / 2f + 1f + Mathf.absin(Timers.time(), 4f, 1f));
|
||||||
|
|
||||||
Lines.stroke(1f);
|
Lines.poly(tile.drawx(), tile.drawy(), 50, laserRange*tilesize);
|
||||||
|
|
||||||
Lines.poly(Edges.getPixelPolygon(laserRange), tile.worldx() - tilesize / 2, tile.worldy() - tilesize / 2, tilesize);
|
|
||||||
|
|
||||||
Draw.color(Palette.power);
|
|
||||||
|
|
||||||
for(int x = (int) (tile.x - laserRange); x <= tile.x + laserRange; x++){
|
for(int x = (int) (tile.x - laserRange); x <= tile.x + laserRange; x++){
|
||||||
for(int y = (int) (tile.y - laserRange); y <= tile.y + laserRange; y++){
|
for(int y = (int) (tile.y - laserRange); y <= tile.y + laserRange; y++){
|
||||||
@@ -178,7 +171,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
boolean linked = linked(tile, link);
|
boolean linked = linked(tile, link);
|
||||||
Draw.color(linked ? Palette.place : Palette.breakInvalid);
|
Draw.color(linked ? Palette.place : Palette.breakInvalid);
|
||||||
|
|
||||||
Lines.square(link.drawx(), link.drawy(),
|
Lines.circle(link.drawx(), link.drawy(),
|
||||||
link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Timers.time(), 4f, 1f)));
|
link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Timers.time(), 4f, 1f)));
|
||||||
|
|
||||||
if((entity.power.links.size >= maxNodes || (link.block() instanceof PowerNode && link.entity.power.links.size >= ((PowerNode) link.block()).maxNodes)) && !linked){
|
if((entity.power.links.size >= maxNodes || (link.block() instanceof PowerNode && link.entity.power.links.size >= ((PowerNode) link.block()).maxNodes)) && !linked){
|
||||||
@@ -194,11 +187,9 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
Draw.color(Palette.placing);
|
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
|
Draw.color(Palette.placing);
|
||||||
Lines.poly(Edges.getPixelPolygon(laserRange), x * tilesize - tilesize / 2, y * tilesize - tilesize / 2, tilesize);
|
Lines.poly(x * tilesize + offset(), y * tilesize + offset(), 50, laserRange*tilesize);
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,14 +199,15 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
TileEntity entity = tile.entity();
|
TileEntity entity = tile.entity();
|
||||||
|
|
||||||
Draw.color(Palette.powerLaserFrom, Palette.powerLaserTo, 0f * (1f - flashScl) + Mathf.sin(Timers.time(), 1.7f, flashScl));
|
|
||||||
|
|
||||||
for(int i = 0; i < entity.power.links.size; i++){
|
for(int i = 0; i < entity.power.links.size; i++){
|
||||||
Tile link = world.tile(entity.power.links.get(i));
|
Tile link = world.tile(entity.power.links.get(i));
|
||||||
if(linkValid(tile, link)) drawLaser(tile, link);
|
if(linkValid(tile, link) && (!(link.block() instanceof PowerNode)
|
||||||
|
|| ((tile.block().size > link.block().size) || (tile.block().size == link.block().size && tile.id() < link.id())))){
|
||||||
|
drawLaser(tile, link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean linked(Tile tile, Tile other){
|
protected boolean linked(Tile tile, Tile other){
|
||||||
@@ -233,12 +225,12 @@ public class PowerNode extends PowerBlock{
|
|||||||
TileEntity oe = link.entity();
|
TileEntity oe = link.entity();
|
||||||
|
|
||||||
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy()) <= Math.max(laserRange * tilesize,
|
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy()) <= Math.max(laserRange * tilesize,
|
||||||
((PowerNode) link.block()).laserRange * tilesize) - tilesize / 2f
|
((PowerNode) link.block()).laserRange * tilesize)
|
||||||
+ (link.block().size - 1) * tilesize / 2f + (tile.block().size - 1) * tilesize / 2f &&
|
+ (link.block().size - 1) * tilesize / 2f + (tile.block().size - 1) * tilesize / 2f &&
|
||||||
(!checkMaxNodes || (oe.power.links.size < ((PowerNode) link.block()).maxNodes || oe.power.links.contains(tile.packedPosition())));
|
(!checkMaxNodes || (oe.power.links.size < ((PowerNode) link.block()).maxNodes || oe.power.links.contains(tile.packedPosition())));
|
||||||
}else{
|
}else{
|
||||||
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy())
|
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy())
|
||||||
<= laserRange * tilesize - tilesize / 2f + (link.block().size - 1) * tilesize;
|
<= laserRange * tilesize + (link.block().size - 1) * tilesize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,11 +241,31 @@ public class PowerNode extends PowerBlock{
|
|||||||
float angle1 = Angles.angle(x1, y1, x2, y2);
|
float angle1 = Angles.angle(x1, y1, x2, y2);
|
||||||
float angle2 = angle1 + 180f;
|
float angle2 = angle1 + 180f;
|
||||||
|
|
||||||
t1.trns(angle1, tile.block().size * tilesize / 2f + 1f);
|
t1.trns(angle1, tile.block().size * tilesize / 2f - 1f);
|
||||||
t2.trns(angle2, target.block().size * tilesize / 2f + 1f);
|
t2.trns(angle2, target.block().size * tilesize / 2f - 1f);
|
||||||
|
|
||||||
Shapes.laser("laser", "laser-end", x1 + t1.x, y1 + t1.y,
|
x1 += t1.x;
|
||||||
x2 + t2.x, y2 + t2.y, thicknessScl);
|
y1 += t1.y;
|
||||||
|
x2 += t2.x;
|
||||||
|
y2 += t2.y;
|
||||||
|
|
||||||
|
float space = Vector2.dst(x1, y1, x2, y2);
|
||||||
|
float scl = 4f, mag = 2f, tscl = 4f, segscl = 3f;
|
||||||
|
|
||||||
|
int segments = Mathf.ceil(space / segscl);
|
||||||
|
|
||||||
|
Draw.color(Palette.power, Palette.powerLight, Mathf.absin(Timers.time(), 5f, 1f));
|
||||||
|
Lines.stroke(1f);
|
||||||
|
|
||||||
|
for(int i = 0; i < segments; i++){
|
||||||
|
float f1 = (float)i / segments;
|
||||||
|
float f2 = (float)(i+1) / segments;
|
||||||
|
t1.trns(angle1 + 90f, Mathf.lerp(Mathf.sin(tile.entity.id * 124f + Timers.time()/tscl + f1 * space, scl, mag), 0f, Math.abs(f1 - 0.5f)*2f));
|
||||||
|
t2.trns(angle1 + 90f, Mathf.lerp(Mathf.sin(tile.entity.id * 124f + Timers.time()/tscl + f2 * space, scl, mag), 0f, Math.abs(f2 - 0.5f)*2f));
|
||||||
|
|
||||||
|
Lines.line(x1 + (x2 - x1) * f1 + t1.x, y1 + (y2 - y1) * f1 + t1.y,
|
||||||
|
x1 + (x2 - x1) * f2 + t2.x, y1 + (y2 - y1) * f2 + t2.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user