Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -8,12 +8,11 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0'
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0'
|
||||||
classpath "com.badlogicgames.gdx:gdx-tools:1.9.8"
|
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: "eclipse"
|
|
||||||
apply plugin: "idea"
|
apply plugin: "idea"
|
||||||
|
|
||||||
version = 'release'
|
version = 'release'
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import io.anuke.mindustry.game.Team;
|
|||||||
import io.anuke.mindustry.game.Waves;
|
import io.anuke.mindustry.game.Waves;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Events;
|
import io.anuke.ucore.core.Events;
|
||||||
import io.anuke.ucore.util.Structs;
|
|
||||||
import io.anuke.ucore.util.GridBits;
|
import io.anuke.ucore.util.GridBits;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
import io.anuke.ucore.util.Structs;
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
|
|||||||
@@ -92,8 +92,11 @@ public class DebugBlocks extends BlockList implements ContentList{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
SorterEntity entity = tile.entity();
|
SorterEntity entity = tile.entity();
|
||||||
|
if(entity.sortItem == null) return;
|
||||||
|
|
||||||
entity.items.set(entity.sortItem, 1);
|
entity.items.set(entity.sortItem, 1);
|
||||||
tryDump(tile, entity.sortItem);
|
tryDump(tile, entity.sortItem);
|
||||||
|
entity.items.set(entity.sortItem, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -602,7 +602,8 @@ public class NetServer extends Module{
|
|||||||
try{
|
try{
|
||||||
|
|
||||||
//iterate through each player
|
//iterate through each player
|
||||||
for(Player player : playerGroup.all()){
|
for(int i = 0; i < playerGroup.size(); i ++){
|
||||||
|
Player player = playerGroup.all().get(i);
|
||||||
if(player.isLocal) continue;
|
if(player.isLocal) continue;
|
||||||
|
|
||||||
NetConnection connection = player.con;
|
NetConnection connection = player.con;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ public class World extends Module{
|
|||||||
public final Sectors sectors = new Sectors();
|
public final Sectors sectors = new Sectors();
|
||||||
public final WorldGenerator generator = new WorldGenerator();
|
public final WorldGenerator generator = new WorldGenerator();
|
||||||
public final BlockIndexer indexer = new BlockIndexer();
|
public final BlockIndexer indexer = new BlockIndexer();
|
||||||
public final Pathfinder pathfinder = new Pathfinder();
|
|
||||||
public final WaveSpawner spawner = new WaveSpawner();
|
public final WaveSpawner spawner = new WaveSpawner();
|
||||||
|
public final Pathfinder pathfinder = new Pathfinder();
|
||||||
|
|
||||||
private Map currentMap;
|
private Map currentMap;
|
||||||
private Sector currentSector;
|
private Sector currentSector;
|
||||||
|
|||||||
@@ -242,8 +242,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
if(tile != null){
|
if(tile != null){
|
||||||
if(!request.remove){
|
if(!request.remove){
|
||||||
rotation = request.rotation;
|
rotation = request.rotation;
|
||||||
|
Recipe before = recipe;
|
||||||
recipe = request.recipe;
|
recipe = request.recipe;
|
||||||
tryPlaceBlock(tile.x, tile.y);
|
tryPlaceBlock(tile.x, tile.y);
|
||||||
|
recipe = before;
|
||||||
}else{
|
}else{
|
||||||
tryBreakBlock(tile.x, tile.y);
|
tryBreakBlock(tile.x, tile.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
versionString = Bundles.get("text.server.outdated");
|
versionString = Bundles.get("text.server.outdated");
|
||||||
}else if(host.version < Version.build && Version.build != -1){
|
}else if(host.version < Version.build && Version.build != -1){
|
||||||
versionString = Bundles.get("text.server.outdated") + "\n" +
|
versionString = Bundles.get("text.server.outdated") + "\n" +
|
||||||
Bundles.format("text.server.version", host.version);
|
Bundles.format("text.server.version", host.version, "");
|
||||||
}else if(host.version > Version.build && Version.build != -1){
|
}else if(host.version > Version.build && Version.build != -1){
|
||||||
versionString = Bundles.get("text.server.outdated.client") + "\n" +
|
versionString = Bundles.get("text.server.outdated.client") + "\n" +
|
||||||
Bundles.format("text.server.version", host.version, "");
|
Bundles.format("text.server.version", host.version, "");
|
||||||
@@ -273,7 +273,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
|
|
||||||
local.row();
|
local.row();
|
||||||
|
|
||||||
TextButton button = local.addButton("[accent]" + host.name, () -> connect(host.address, port))
|
TextButton button = local.addButton("[accent]" + host.name, "clear", () -> connect(host.address, port))
|
||||||
.width(w).height(80f).pad(4f).get();
|
.width(w).height(80f).pad(4f).get();
|
||||||
button.left();
|
button.left();
|
||||||
button.row();
|
button.row();
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ public class HudFragment extends Fragment{
|
|||||||
if(shown){
|
if(shown){
|
||||||
shown = false;
|
shown = false;
|
||||||
blockfrag.toggle(dur, in);
|
blockfrag.toggle(dur, in);
|
||||||
wavetable.actions(Actions.translateBy(0, (wavetable.getHeight() + dsize + Unit.dp.scl(6)) - wavetable.getTranslation().y, dur, in));
|
wavetable.actions(Actions.translateBy(0, (wavetable.getHeight() + Unit.dp.scl(dsize) + Unit.dp.scl(6)) - wavetable.getTranslation().y, dur, in));
|
||||||
infolabel.actions(Actions.translateBy(0, (wavetable.getHeight()) - wavetable.getTranslation().y, dur, in));
|
infolabel.actions(Actions.translateBy(0, (wavetable.getHeight()) - wavetable.getTranslation().y, dur, in));
|
||||||
}else{
|
}else{
|
||||||
shown = true;
|
shown = true;
|
||||||
|
|||||||
@@ -4,43 +4,32 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.function.Supplier;
|
import io.anuke.ucore.function.Supplier;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
|
||||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.content;
|
||||||
|
import static io.anuke.mindustry.Vars.control;
|
||||||
|
|
||||||
public interface SelectionTrait{
|
public interface SelectionTrait{
|
||||||
|
|
||||||
default void buildItemTable(Table table, Supplier<Item> holder, Consumer<Item> consumer){
|
default void buildItemTable(Table table, Supplier<Item> holder, Consumer<Item> consumer){
|
||||||
buildItemTable(table, false, holder, consumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
default void buildItemTable(Table table, boolean nullItem, Supplier<Item> holder, Consumer<Item> consumer){
|
|
||||||
|
|
||||||
Array<Item> items = content.items();
|
Array<Item> items = content.items();
|
||||||
|
|
||||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||||
|
group.setMinCheckCount(0);
|
||||||
Table cont = new Table();
|
Table cont = new Table();
|
||||||
cont.defaults().size(38);
|
cont.defaults().size(38);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if(nullItem){
|
|
||||||
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> consumer.accept(null)).group(group).get();
|
|
||||||
button.getStyle().imageUp = new TextureRegionDrawable(Draw.region("icon-nullitem"));
|
|
||||||
button.setChecked(holder.get() == null);
|
|
||||||
|
|
||||||
i ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Item item : items){
|
for(Item item : items){
|
||||||
if(!control.unlocks.isUnlocked(item)) continue;
|
if(!control.unlocks.isUnlocked(item)) continue;
|
||||||
|
|
||||||
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> consumer.accept(item))
|
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> {}).group(group).get();
|
||||||
.group(group).get();
|
button.changed(() -> consumer.accept(button.isChecked() ? item : null));
|
||||||
button.getStyle().imageUp = new TextureRegionDrawable(item.region);
|
button.getStyle().imageUp = new TextureRegionDrawable(item.region);
|
||||||
button.setChecked(holder.get() == item);
|
button.setChecked(holder.get() == item);
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ public class Sorter extends Block implements SelectionTrait{
|
|||||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||||
public static void setSorterItem(Player player, Tile tile, Item item){
|
public static void setSorterItem(Player player, Tile tile, Item item){
|
||||||
SorterEntity entity = tile.entity();
|
SorterEntity entity = tile.entity();
|
||||||
if(entity != null) entity.sortItem = item;
|
if(entity != null){
|
||||||
|
entity.sortItem = item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,6 +58,7 @@ public class Sorter extends Block implements SelectionTrait{
|
|||||||
super.draw(tile);
|
super.draw(tile);
|
||||||
|
|
||||||
SorterEntity entity = tile.entity();
|
SorterEntity entity = tile.entity();
|
||||||
|
if(entity.sortItem == null) return;
|
||||||
|
|
||||||
Draw.color(entity.sortItem.color);
|
Draw.color(entity.sortItem.color);
|
||||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
||||||
@@ -130,16 +133,17 @@ public class Sorter extends Block implements SelectionTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class SorterEntity extends TileEntity{
|
public static class SorterEntity extends TileEntity{
|
||||||
public Item sortItem = content.item(0);
|
public Item sortItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeConfig(DataOutput stream) throws IOException{
|
public void writeConfig(DataOutput stream) throws IOException{
|
||||||
stream.writeByte(sortItem.id);
|
stream.writeByte(sortItem == null ? -1 : sortItem.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readConfig(DataInput stream) throws IOException{
|
public void readConfig(DataInput stream) throws IOException{
|
||||||
sortItem = content.items().get(stream.readByte());
|
byte b = stream.readByte();
|
||||||
|
sortItem = b == -1 ? null : content.items().get(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||||
public static void unlinkPowerNodes(Player player, Tile tile, Tile other){
|
public static void unlinkPowerNodes(Player player, Tile tile, Tile other){
|
||||||
if(tile.entity.power == null) return;
|
if(tile.entity.power == null || other.entity == null || other.entity.power == null) return;
|
||||||
|
|
||||||
TileEntity entity = tile.entity();
|
TileEntity entity = tile.entity();
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class SortedUnloader extends Unloader implements SelectionTrait{
|
|||||||
@Override
|
@Override
|
||||||
public void buildTable(Tile tile, Table table){
|
public void buildTable(Tile tile, Table table){
|
||||||
SortedUnloaderEntity entity = tile.entity();
|
SortedUnloaderEntity entity = tile.entity();
|
||||||
buildItemTable(table, true, () -> entity.sortItem, item -> Call.setSortedUnloaderItem(null, tile, item));
|
buildItemTable(table, () -> entity.sortItem, item -> Call.setSortedUnloaderItem(null, tile, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ apply plugin: "java"
|
|||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user