Fixed: map mirror / crashes / mech pads / player list / mobile placement

This commit is contained in:
Anuken 2018-10-17 10:20:58 -04:00
parent a29f95194d
commit 8e952a550b
17 changed files with 40 additions and 26 deletions

View File

@ -27,7 +27,7 @@ allprojects {
appName = 'Mindustry' appName = 'Mindustry'
gdxVersion = '1.9.8' gdxVersion = '1.9.8'
roboVMVersion = '2.3.0' roboVMVersion = '2.3.0'
uCoreVersion = '7143baa7e05e4e852e0c299d631b291ca37950b0' uCoreVersion = '53f99fbdc50910a15b4f55e9739385f47cf800cf'
getVersionString = { getVersionString = {
String buildVersion = getBuildVersion() String buildVersion = getBuildVersion()

View File

@ -460,7 +460,7 @@ text.none=<none>
text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created. text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created.
text.mission.complete=Mission complete! text.mission.complete=Mission complete!
text.mission.complete.body=Sector {0},{1} has been conquered. text.mission.complete.body=Sector {0},{1} has been conquered.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.unit.health=[LIGHT_GRAY]Health: {0} text.unit.health=[LIGHT_GRAY]Health: {0}
text.unit.speed=[LIGHT_GRAY]Speed: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0}
block.mass-driver.name=Mass Driver block.mass-driver.name=Mass Driver

View File

@ -460,7 +460,7 @@ text.none=<none>
text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created. text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created.
text.mission.complete=Mission complete! text.mission.complete=Mission complete!
text.mission.complete.body=Sector {0},{1} has been conquered. text.mission.complete.body=Sector {0},{1} has been conquered.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.unit.health=[LIGHT_GRAY]Health: {0} text.unit.health=[LIGHT_GRAY]Health: {0}
text.unit.speed=[LIGHT_GRAY]Speed: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0}
block.mass-driver.name=Mass Driver block.mass-driver.name=Mass Driver

View File

@ -474,7 +474,7 @@ text.none=<없음>
text.sector.corrupted=[orange]저장 파일에서 구역을 발견했으나 불러오지 못했습니다.\n새로 생성되었습니다. text.sector.corrupted=[orange]저장 파일에서 구역을 발견했으나 불러오지 못했습니다.\n새로 생성되었습니다.
text.mission.complete=미션 성공! text.mission.complete=미션 성공!
text.mission.complete.body=구역 {0},{1} 탐색 성공. text.mission.complete.body=구역 {0},{1} 탐색 성공.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.unit.health=[LIGHT_GRAY]체력:{0} text.unit.health=[LIGHT_GRAY]체력:{0}
text.unit.speed=[LIGHT_GRAY]속도:{0} text.unit.speed=[LIGHT_GRAY]속도:{0}
block.mass-driver.name=물질 이동기 block.mass-driver.name=물질 이동기

View File

@ -460,7 +460,7 @@ text.none=<none>
text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created. text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created.
text.mission.complete=Mission complete! text.mission.complete=Mission complete!
text.mission.complete.body=Sector {0},{1} has been conquered. text.mission.complete.body=Sector {0},{1} has been conquered.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.unit.health=[LIGHT_GRAY]Health: {0} text.unit.health=[LIGHT_GRAY]Health: {0}
text.unit.speed=[LIGHT_GRAY]Speed: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0}
block.mass-driver.name=Mass Driver block.mass-driver.name=Mass Driver

View File

@ -459,7 +459,7 @@ text.none=<none>
text.sector.corrupted=[orange]Um arquivo de save Foi encontrado neste setor, Mas o login falhou.\nUm novo foi criado. text.sector.corrupted=[orange]Um arquivo de save Foi encontrado neste setor, Mas o login falhou.\nUm novo foi criado.
text.mission.complete=Mission complete! text.mission.complete=Mission complete!
text.mission.complete.body=Sector {0},{1} has been conquered. text.mission.complete.body=Sector {0},{1} has been conquered.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.join.info=Here, you can enter a [accent]server IP[] to connect to, or discover [accent]local network[] servers to connect to.\nBoth LAN and WAN multiplayer is supported.\n\n[LIGHT_GRAY]Note: There is no automatic global server list; if you want to connect to someone by IP, you would need to ask the host for their IP. text.join.info=Here, you can enter a [accent]server IP[] to connect to, or discover [accent]local network[] servers to connect to.\nBoth LAN and WAN multiplayer is supported.\n\n[LIGHT_GRAY]Note: There is no automatic global server list; if you want to connect to someone by IP, you would need to ask the host for their IP.
text.unit.health=[LIGHT_GRAY]Health: {0} text.unit.health=[LIGHT_GRAY]Health: {0}
text.unit.speed=[LIGHT_GRAY]Speed: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0}

View File

@ -460,7 +460,7 @@ text.none=<none>
text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created. text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created.
text.mission.complete=Mission complete! text.mission.complete=Mission complete!
text.mission.complete.body=Sector {0},{1} has been conquered. text.mission.complete.body=Sector {0},{1} has been conquered.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.unit.health=[LIGHT_GRAY]Health: {0} text.unit.health=[LIGHT_GRAY]Health: {0}
text.unit.speed=[LIGHT_GRAY]Speed: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0}
block.mass-driver.name=Mass Driver block.mass-driver.name=Mass Driver

View File

@ -460,7 +460,7 @@ text.none=<none>
text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created. text.sector.corrupted=[orange]A save file for this sector was found, but loading failed.\nA new one has been created.
text.mission.complete=Mission complete! text.mission.complete=Mission complete!
text.mission.complete.body=Sector {0},{1} has been conquered. text.mission.complete.body=Sector {0},{1} has been conquered.
text.mission.resource=Obtain {0} x{1} text.mission.resource=Obtain {0}:\n[accent]{1}/{2}[]
text.unit.health=[LIGHT_GRAY]Health: {0} text.unit.health=[LIGHT_GRAY]Health: {0}
text.unit.speed=[LIGHT_GRAY]Speed: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0}
block.mass-driver.name=Mass Driver block.mass-driver.name=Mass Driver

View File

@ -75,7 +75,7 @@ public class WaveSpawner{
int amount = group.getGroupsSpawned(state.wave); int amount = group.getGroupsSpawned(state.wave);
if(group.type.isFlying){ if(group.type.isFlying){
flyGroups += amount; flyGroups += amount;
}else{ }else if(dynamicSpawn){
groundGroups += amount; groundGroups += amount;
} }
} }
@ -109,6 +109,8 @@ public class WaveSpawner{
float spawnX, spawnY; float spawnX, spawnY;
float spread; float spread;
if(!group.type.isFlying && groundCount >= groundSpawns.size) continue;
if(group.type.isFlying){ if(group.type.isFlying){
FlyerSpawn spawn = flySpawns.get(flyCount); FlyerSpawn spawn = flySpawns.get(flyCount);
//TODO verify flyer spawn //TODO verify flyer spawn
@ -119,7 +121,7 @@ public class WaveSpawner{
spread = margin / 1.5f; spread = margin / 1.5f;
flyCount++; flyCount++;
}else{ }else{ //make sure it works for non-dynamic spawns
GroundSpawn spawn = groundSpawns.get(groundCount); GroundSpawn spawn = groundSpawns.get(groundCount);
if(dynamicSpawn){ if(dynamicSpawn){

View File

@ -12,7 +12,6 @@ import io.anuke.annotations.Annotations.Variant;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
import io.anuke.mindustry.entities.traits.SyncTrait; import io.anuke.mindustry.entities.traits.SyncTrait;
import io.anuke.mindustry.entities.traits.TypeTrait; import io.anuke.mindustry.entities.traits.TypeTrait;
@ -24,6 +23,7 @@ import io.anuke.mindustry.net.NetworkIO;
import io.anuke.mindustry.net.Packets.*; import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.net.TraceInfo; import io.anuke.mindustry.net.TraceInfo;
import io.anuke.mindustry.net.ValidateException; import io.anuke.mindustry.net.ValidateException;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.modules.InventoryModule; import io.anuke.mindustry.world.modules.InventoryModule;
import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Settings;
@ -292,9 +292,9 @@ public class NetClient extends Module{
byte cores = input.readByte(); byte cores = input.readByte();
for(int i = 0; i < cores; i++){ for(int i = 0; i < cores; i++){
int pos = input.readInt(); int pos = input.readInt();
TileEntity entity = world.tile(pos).entity; Tile tile = world.tile(pos);
if(entity != null){ if(tile != null && tile.entity != null){
entity.items.read(input); tile.entity.items.read(input);
}else{ }else{
new InventoryModule().read(input); new InventoryModule().read(input);
} }

View File

@ -49,7 +49,7 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
@Remote(called = Loc.server) @Remote(called = Loc.server)
public static void transferItemTo(Item item, int amount, float x, float y, Tile tile){ public static void transferItemTo(Item item, int amount, float x, float y, Tile tile){
if(tile == null) return; if(tile == null || tile.entity == null || tile.entity.items == null) return;
for(int i = 0; i < Mathf.clamp(amount / 3, 1, 8); i++){ for(int i = 0; i < Mathf.clamp(amount / 3, 1, 8); i++){
Timers.run(i * 3, () -> create(item, x, y, tile, () -> { Timers.run(i * 3, () -> create(item, x, y, tile, () -> {
})); }));

View File

@ -14,7 +14,7 @@ public interface TypeTrait{
*/ */
static <T extends TypeTrait> void registerType(Class<T> type, Supplier<T> supplier){ static <T extends TypeTrait> void registerType(Class<T> type, Supplier<T> supplier){
if(typeToID.get(type, -1) != -1){ if(typeToID.get(type, -1) != -1){
throw new RuntimeException("Type is already registered: '" + type + "'!"); return; //already registered
} }
registeredTypes.add(supplier); registeredTypes.add(supplier);

View File

@ -107,6 +107,7 @@ public class DesktopInput extends InputHandler{
} }
} }
Draw.color(Palette.remove);
Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y); Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y);
}else if(isPlacing()){ }else if(isPlacing()){
if(recipe.result.rotate){ if(recipe.result.rotate){

View File

@ -178,11 +178,13 @@ public class MobileInput extends InputHandler implements GestureListener{
request.recipe.result.rotate ? request.rotation * 90 : 0); request.recipe.result.rotate ? request.rotation * 90 : 0);
} }
}else{ }else{
float rad = (tile.block().size * tilesize / 2f - 1) * request.scale;
Draw.alpha(0f);
//draw removing request //draw removing request
Draw.color(Palette.removeBack); Draw.tint(Palette.removeBack);
Lines.square(tile.drawx(), tile.drawy()-1, tile.block().size * tilesize / 2f); Lines.square(tile.drawx(), tile.drawy()-1, rad);
Draw.color(Palette.remove); Draw.tint(Palette.remove);
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f); Lines.square(tile.drawx(), tile.drawy(), rad);
} }
} }
@ -242,7 +244,7 @@ public class MobileInput extends InputHandler implements GestureListener{
} }
} }
//move all current requests to removal array to they fade out //move all current requests to removal array so they fade out
removals.addAll(selection); removals.addAll(selection);
selection.clear(); selection.clear();
selecting = false; selecting = false;
@ -383,12 +385,13 @@ public class MobileInput extends InputHandler implements GestureListener{
other = other.target(); other = other.target();
Draw.color(Palette.removeBack); Draw.color(Palette.removeBack);
Lines.square(other.drawx(), other.drawy()-1, other.block().size * tilesize / 2f); Lines.square(other.drawx(), other.drawy()-1, other.block().size * tilesize / 2f - 1);
Draw.color(Palette.remove); Draw.color(Palette.remove);
Lines.square(other.drawx(), other.drawy(), other.block().size * tilesize / 2f); Lines.square(other.drawx(), other.drawy(), other.block().size * tilesize / 2f - 1);
} }
} }
Draw.color(Palette.remove);
Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y); Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y);
} }

View File

@ -78,7 +78,7 @@ public class MapIO{
for(int x = 0; x < data.width(); x++){ for(int x = 0; x < data.width(); x++){
for(int y = 0; y < data.height(); y++){ for(int y = 0; y < data.height(); y++){
int color = pixmap.getPixel(y, pixmap.getWidth() - 1 - x); int color = pixmap.getPixel(x, pixmap.getHeight() - 1 - y);
LegacyBlock block = LegacyColorMapper.get(color); LegacyBlock block = LegacyColorMapper.get(color);
data.write(x, y, DataPosition.floor, block.floor.id); data.write(x, y, DataPosition.floor, block.floor.id);

View File

@ -1,5 +1,6 @@
package io.anuke.mindustry.ui.fragments; package io.anuke.mindustry.ui.fragments;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
@ -8,6 +9,7 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.net.Packets.AdminAction; import io.anuke.mindustry.net.Packets.AdminAction;
import io.anuke.ucore.core.Core;
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;
@ -36,6 +38,10 @@ public class PlayerListFragment extends Fragment{
if(visible && Timers.get("player-list-rebuild", 20)){ if(visible && Timers.get("player-list-rebuild", 20)){
rebuild(); rebuild();
content.pack();
content.act(Gdx.graphics.getDeltaTime());
//TODO hack
Core.scene.act(0f);
} }
}); });
@ -104,7 +110,7 @@ public class PlayerListFragment extends Fragment{
t.addImageButton("icon-ban", 14 * 2, t.addImageButton("icon-ban", 14 * 2,
() -> ui.showConfirm("$text.confirm", "$text.confirmban", () -> Call.onAdminRequest(player, AdminAction.ban))).padBottom(-5.1f); () -> ui.showConfirm("$text.confirm", "$text.confirmban", () -> Call.onAdminRequest(player, AdminAction.ban))).padBottom(-5.1f);
t.addImageButton("icon-cancel", 14 * 2, t.addImageButton("icon-cancel", 16 * 2,
() -> ui.showConfirm("$text.confirm", "$text.confirmkick", () -> Call.onAdminRequest(player, AdminAction.kick))).padBottom(-5.1f); () -> ui.showConfirm("$text.confirm", "$text.confirmkick", () -> Call.onAdminRequest(player, AdminAction.kick))).padBottom(-5.1f);
t.row(); t.row();

View File

@ -1,5 +1,6 @@
package io.anuke.mindustry.world.consumers; package io.anuke.mindustry.world.consumers;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
public class ConsumePowerExact extends ConsumePower{ public class ConsumePowerExact extends ConsumePower{
@ -8,7 +9,8 @@ public class ConsumePowerExact extends ConsumePower{
super(use); super(use);
} }
protected float use(Block block){ @Override
protected float use(Block block, TileEntity entity){
return this.use; return this.use;
} }
} }