Fixed bugs with multiplayer on Android and new place modes
This commit is contained in:
@@ -10,7 +10,7 @@ import io.anuke.ucore.UCore;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
|
||||||
public class Vars{
|
public class Vars{
|
||||||
public static final boolean testAndroid = false;
|
public static final boolean testAndroid = true;
|
||||||
//shorthand for whether or not this is running on android
|
//shorthand for whether or not this is running on android
|
||||||
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
|
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
|
||||||
//shorthand for whether or not this is running on GWT
|
//shorthand for whether or not this is running on GWT
|
||||||
|
|||||||
@@ -546,6 +546,7 @@ public class Control extends Module{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
//UCore.log(input.placeMode, input.breakMode, input.lastPlaceMode);
|
||||||
|
|
||||||
if(Gdx.input != proxy){
|
if(Gdx.input != proxy){
|
||||||
Gdx.input = proxy;
|
Gdx.input = proxy;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class NetClient extends Module {
|
|||||||
IntSet requests = new IntSet();
|
IntSet requests = new IntSet();
|
||||||
IntSet recieved = new IntSet();
|
IntSet recieved = new IntSet();
|
||||||
float playerSyncTime = 2;
|
float playerSyncTime = 2;
|
||||||
float dataTimeout = 60*13; //13 seconds timeout
|
float dataTimeout = 60*15; //13 seconds timeout
|
||||||
|
|
||||||
public NetClient(){
|
public NetClient(){
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class DamageArea{
|
|||||||
};
|
};
|
||||||
|
|
||||||
Entities.getNearby(Vars.control.enemyGroup, rect, cons);
|
Entities.getNearby(Vars.control.enemyGroup, rect, cons);
|
||||||
Entities.getNearby(Vars.control.playerGroup, rect, cons);
|
if(!Vars.control.isFriendlyFire()) Entities.getNearby(Vars.control.playerGroup, rect, cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void damageEntities(float x, float y, float radius, int damage){
|
public static void damageEntities(float x, float y, float radius, int damage){
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
public PlaceMode placeMode = android ? PlaceMode.cursor : PlaceMode.hold;
|
public PlaceMode placeMode = android ? PlaceMode.cursor : PlaceMode.hold;
|
||||||
public PlaceMode breakMode = android ? PlaceMode.none : PlaceMode.holdDelete;
|
public PlaceMode breakMode = android ? PlaceMode.none : PlaceMode.holdDelete;
|
||||||
public PlaceMode lastPlaceMode = placeMode;
|
public PlaceMode lastPlaceMode = placeMode;
|
||||||
|
public PlaceMode lastBreakMode = breakMode;
|
||||||
|
|
||||||
public abstract void update();
|
public abstract void update();
|
||||||
public abstract float getCursorX();
|
public abstract float getCursorX();
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package io.anuke.mindustry.input;
|
package io.anuke.mindustry.input;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Buttons;
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
@@ -11,7 +9,6 @@ import io.anuke.mindustry.ui.fragments.ToolFragment;
|
|||||||
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.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.core.Inputs;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.scene.utils.Cursors;
|
import io.anuke.ucore.scene.utils.Cursors;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
@@ -97,12 +94,9 @@ public enum PlaceMode{
|
|||||||
Vector2 offset = tile.block().getPlaceOffset();
|
Vector2 offset = tile.block().getPlaceOffset();
|
||||||
float fract = control.getInput().breaktime / tile.getBreakTime();
|
float fract = control.getInput().breaktime / tile.getBreakTime();
|
||||||
|
|
||||||
if(Inputs.buttonDown(Buttons.RIGHT)){
|
if(android && control.getInput().breaktime > 0){
|
||||||
Draw.color(Color.YELLOW, Color.SCARLET, fract);
|
|
||||||
Draw.linecrect(tile.worldx() + offset.x, tile.worldy() + offset.y, tile.block().width * Vars.tilesize, tile.block().height * Vars.tilesize);
|
|
||||||
}else if(android && control.getInput().breaktime > 0){
|
|
||||||
Draw.color(Colors.get("breakStart"), Colors.get("break"), fract);
|
Draw.color(Colors.get("breakStart"), Colors.get("break"), fract);
|
||||||
Draw.polygon(tile.worldy() + offset.y, tile.worldx() + offset.x, 25, 4 + (1f - fract) * 26);
|
Draw.polygon(tile.worldx() + offset.y, tile.worldy() + offset.x, 25, 4 + (1f - fract) * 26);
|
||||||
}
|
}
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
placing = false;
|
placing = false;
|
||||||
container.clearActions();
|
container.clearActions();
|
||||||
container.actions(Actions.translateBy(0, -(container.getTranslation().y + translation), i, n));
|
container.actions(Actions.translateBy(0, -(container.getTranslation().y + translation), i, n));
|
||||||
|
if (!input.lastBreakMode.both) input.placeMode = input.lastBreakMode;
|
||||||
}else{
|
}else{
|
||||||
placing = true;
|
placing = true;
|
||||||
container.clearActions();
|
container.clearActions();
|
||||||
@@ -131,6 +132,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
||||||
control.getInput().resetCursor();
|
control.getInput().resetCursor();
|
||||||
input.breakMode = mode;
|
input.breakMode = mode;
|
||||||
|
input.lastBreakMode = mode;
|
||||||
if (!mode.both){
|
if (!mode.both){
|
||||||
input.placeMode = mode;
|
input.placeMode = mode;
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.AbstractList;
|
import java.util.AbstractList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
@@ -235,7 +236,7 @@ public class Conveyor extends Block{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
wrapper.sort(Conveyor::compareItems);
|
Collections.sort(wrapper, Conveyor::compareItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int compareItems(Integer a, Integer b){
|
private static int compareItems(Integer a, Integer b){
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.production;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import io.anuke.mindustry.resource.Liquid;
|
import io.anuke.mindustry.resource.Liquid;
|
||||||
|
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.mindustry.world.blocks.types.LiquidBlock;
|
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||||
@@ -25,6 +26,11 @@ public class Pump extends LiquidBlock{
|
|||||||
flowfactor = 3f;
|
flowfactor = 3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canReplace(Block other) {
|
||||||
|
return other instanceof Pump && other != this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getStats(Array<String> list){
|
public void getStats(Array<String> list){
|
||||||
super.getStats(list);
|
super.getStats(list);
|
||||||
|
|||||||
Reference in New Issue
Block a user