@@ -14,6 +14,7 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:isGame="true"
|
android:isGame="true"
|
||||||
android:appCategory="game"
|
android:appCategory="game"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/GdxTheme" android:fullBackupContent="@xml/backup_rules">
|
android:theme="@style/GdxTheme" android:fullBackupContent="@xml/backup_rules">
|
||||||
<meta-data android:name="android.max_aspect" android:value="2.1"/>
|
<meta-data android:name="android.max_aspect" android:value="2.1"/>
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
player.pointerX, player.pointerY, player.rotation, player.baseRotation,
|
player.pointerX, player.pointerY, player.rotation, player.baseRotation,
|
||||||
player.velocity().x, player.velocity().y,
|
player.velocity().x, player.velocity().y,
|
||||||
player.getMineTile(),
|
player.getMineTile(),
|
||||||
player.isBoosting, player.isShooting, ui.chatfrag.chatOpen(),
|
player.isBoosting, player.isShooting, ui.chatfrag.chatOpen(), player.isBuilding,
|
||||||
requests,
|
requests,
|
||||||
Core.camera.position.x, Core.camera.position.y,
|
Core.camera.position.x, Core.camera.position.y,
|
||||||
Core.camera.width * viewScale, Core.camera.height * viewScale);
|
Core.camera.width * viewScale, Core.camera.height * viewScale);
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
float rotation, float baseRotation,
|
float rotation, float baseRotation,
|
||||||
float xVelocity, float yVelocity,
|
float xVelocity, float yVelocity,
|
||||||
Tile mining,
|
Tile mining,
|
||||||
boolean boosting, boolean shooting, boolean chatting,
|
boolean boosting, boolean shooting, boolean chatting, boolean building,
|
||||||
BuildRequest[] requests,
|
BuildRequest[] requests,
|
||||||
float viewX, float viewY, float viewWidth, float viewHeight
|
float viewX, float viewY, float viewWidth, float viewHeight
|
||||||
){
|
){
|
||||||
@@ -477,6 +477,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
player.isTyping = chatting;
|
player.isTyping = chatting;
|
||||||
player.isBoosting = boosting;
|
player.isBoosting = boosting;
|
||||||
player.isShooting = shooting;
|
player.isShooting = shooting;
|
||||||
|
player.isBuilding = building;
|
||||||
player.buildQueue().clear();
|
player.buildQueue().clear();
|
||||||
for(BuildRequest req : requests){
|
for(BuildRequest req : requests){
|
||||||
if(req == null) continue;
|
if(req == null) continue;
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ public class Schematics implements Loadable{
|
|||||||
|
|
||||||
target.tiles.clear();
|
target.tiles.clear();
|
||||||
target.tiles.addAll(newSchematic.tiles);
|
target.tiles.addAll(newSchematic.tiles);
|
||||||
|
target.width = newSchematic.width;
|
||||||
|
target.height = newSchematic.height;
|
||||||
newSchematic.tags.putAll(target.tags);
|
newSchematic.tags.putAll(target.tags);
|
||||||
newSchematic.file = target.file;
|
newSchematic.file = target.file;
|
||||||
|
|
||||||
|
|||||||
@@ -302,12 +302,12 @@ public class DesktopInput extends InputHandler{
|
|||||||
player.clearBuilding();
|
player.clearBuilding();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Core.input.keyTap(Binding.schematic_select)){
|
if(Core.input.keyTap(Binding.schematic_select) && !ui.chatfrag.chatOpen()){
|
||||||
schemX = rawCursorX;
|
schemX = rawCursorX;
|
||||||
schemY = rawCursorY;
|
schemY = rawCursorY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Core.input.keyTap(Binding.schematic_menu)){
|
if(Core.input.keyTap(Binding.schematic_menu) && !ui.chatfrag.chatOpen()){
|
||||||
ui.schematics.show();
|
ui.schematics.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -401,6 +401,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
protected void flushSelectRequests(Array<BuildRequest> requests){
|
protected void flushSelectRequests(Array<BuildRequest> requests){
|
||||||
for(BuildRequest req : requests){
|
for(BuildRequest req : requests){
|
||||||
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
|
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
|
||||||
|
BuildRequest other = getRequest(req.x, req.y);
|
||||||
|
if(other != null){
|
||||||
|
selectRequests.remove(other);
|
||||||
|
}
|
||||||
|
|
||||||
selectRequests.add(req.copy());
|
selectRequests.add(req.copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ public class TypeIO{
|
|||||||
if(!request.breaking){
|
if(!request.breaking){
|
||||||
buffer.putShort(request.block.id);
|
buffer.putShort(request.block.id);
|
||||||
buffer.put((byte)request.rotation);
|
buffer.put((byte)request.rotation);
|
||||||
|
buffer.put(request.hasConfig ? (byte)1 : 0);
|
||||||
|
buffer.putInt(request.config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,7 +150,12 @@ public class TypeIO{
|
|||||||
}else{ //place
|
}else{ //place
|
||||||
short block = buffer.getShort();
|
short block = buffer.getShort();
|
||||||
byte rotation = buffer.get();
|
byte rotation = buffer.get();
|
||||||
|
boolean hasConfig = buffer.get() == 1;
|
||||||
|
int config = buffer.getInt();
|
||||||
currentRequest = new BuildRequest(Pos.x(position), Pos.y(position), rotation, content.block(block));
|
currentRequest = new BuildRequest(Pos.x(position), Pos.y(position), rotation, content.block(block));
|
||||||
|
if(hasConfig){
|
||||||
|
currentRequest.configure(config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reqs[i] = (currentRequest);
|
reqs[i] = (currentRequest);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
file.copyTo(dest);
|
file.copyTo(dest);
|
||||||
try{
|
try{
|
||||||
loaded.add(loadMod(dest, false));
|
loaded.add(loadMod(dest));
|
||||||
requiresReload = true;
|
requiresReload = true;
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
dest.delete();
|
dest.delete();
|
||||||
@@ -172,7 +172,7 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
Log.debug("[Mods] Loading mod {0}", file);
|
Log.debug("[Mods] Loading mod {0}", file);
|
||||||
try{
|
try{
|
||||||
LoadedMod mod = loadMod(file, false);
|
LoadedMod mod = loadMod(file);
|
||||||
if(mod.enabled() || headless){
|
if(mod.enabled() || headless){
|
||||||
loaded.add(mod);
|
loaded.add(mod);
|
||||||
}else{
|
}else{
|
||||||
@@ -187,12 +187,13 @@ public class Mods implements Loadable{
|
|||||||
//load workshop mods now
|
//load workshop mods now
|
||||||
for(FileHandle file : platform.getWorkshopContent(LoadedMod.class)){
|
for(FileHandle file : platform.getWorkshopContent(LoadedMod.class)){
|
||||||
try{
|
try{
|
||||||
LoadedMod mod = loadMod(file, true);
|
LoadedMod mod = loadMod(file);
|
||||||
if(mod.enabled()){
|
if(mod.enabled()){
|
||||||
loaded.add(mod);
|
loaded.add(mod);
|
||||||
}else{
|
}else{
|
||||||
disabled.add(mod);
|
disabled.add(mod);
|
||||||
}
|
}
|
||||||
|
mod.addSteamID(file.parent().name());
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Log.err("Failed to load mod workshop file {0}. Skipping.", file);
|
Log.err("Failed to load mod workshop file {0}. Skipping.", file);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
@@ -399,7 +400,7 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
/** Loads a mod file+meta, but does not add it to the list.
|
/** Loads a mod file+meta, but does not add it to the list.
|
||||||
* Note that directories can be loaded as mods.*/
|
* Note that directories can be loaded as mods.*/
|
||||||
private LoadedMod loadMod(FileHandle sourceFile, boolean workshop) throws Exception{
|
private LoadedMod loadMod(FileHandle sourceFile) throws Exception{
|
||||||
FileHandle zip = sourceFile.isDirectory() ? sourceFile : new ZipFileHandle(sourceFile);
|
FileHandle zip = sourceFile.isDirectory() ? sourceFile : new ZipFileHandle(sourceFile);
|
||||||
if(zip.list().length == 1 && zip.list()[0].isDirectory()){
|
if(zip.list().length == 1 && zip.list()[0].isDirectory()){
|
||||||
zip = zip.list()[0];
|
zip = zip.list()[0];
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.Net.*;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.arc.files.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.io.*;
|
import io.anuke.arc.util.io.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
@@ -34,19 +36,27 @@ public class ModsDialog extends FloatingDialog{
|
|||||||
ui.loadfrag.show();
|
ui.loadfrag.show();
|
||||||
Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> {
|
Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> {
|
||||||
Core.net.httpGet(loc.getHeader("Location"), result -> {
|
Core.net.httpGet(loc.getHeader("Location"), result -> {
|
||||||
try{
|
if(result.getStatus() != HttpStatus.OK){
|
||||||
Streams.copyStream(result.getResultAsStream(), modDirectory.child(text.replace("/", "") + ".zip").write(false));
|
ui.showErrorMessage(Core.bundle.format("connectfail", result.getStatus()));
|
||||||
Core.app.post(() -> {
|
ui.loadfrag.hide();
|
||||||
try{
|
}else{
|
||||||
mods.reloadContent();
|
try{
|
||||||
setup();
|
FileHandle file = tmpDirectory.child(text.replace("/", "") + ".zip");
|
||||||
ui.loadfrag.hide();
|
Streams.copyStream(result.getResultAsStream(), file.write(false));
|
||||||
}catch(Throwable e){
|
mods.importMod(file);
|
||||||
ui.showException(e);
|
file.delete();
|
||||||
}
|
Core.app.post(() -> {
|
||||||
});
|
try{
|
||||||
}catch(Throwable e){
|
mods.reloadContent();
|
||||||
ui.showException(e);
|
setup();
|
||||||
|
ui.loadfrag.hide();
|
||||||
|
}catch(Throwable e){
|
||||||
|
ui.showException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}catch(Throwable e){
|
||||||
|
ui.showException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, t -> Core.app.post(() -> ui.showException(t)));
|
}, t -> Core.app.post(() -> ui.showException(t)));
|
||||||
}, t -> Core.app.post(() -> ui.showException(t)));
|
}, t -> Core.app.post(() -> ui.showException(t)));
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class Build{
|
|||||||
|
|
||||||
/** Returns whether a tile can be placed at this location by this team. */
|
/** Returns whether a tile can be placed at this location by this team. */
|
||||||
public static boolean validPlace(Team team, int x, int y, Block type, int rotation){
|
public static boolean validPlace(Team team, int x, int y, Block type, int rotation){
|
||||||
if(!type.isVisible() || type.isHidden()){
|
if(type == null || !type.isVisible() || type.isHidden()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class LiquidSource extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Player player, int value){
|
public void configured(Tile tile, Player player, int value){
|
||||||
tile.<LiquidSourceEntity>entity().source = content.liquid(value);
|
tile.<LiquidSourceEntity>entity().source = value == -1 ? null : content.liquid(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
class LiquidSourceEntity extends TileEntity{
|
class LiquidSourceEntity extends TileEntity{
|
||||||
|
|||||||
Reference in New Issue
Block a user