From 8e952a550b287277aa7745ddba66c66f2ba4ac26 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 17 Oct 2018 10:20:58 -0400 Subject: [PATCH] Fixed: map mirror / crashes / mech pads / player list / mobile placement --- build.gradle | 2 +- core/assets/bundles/bundle_de.properties | 2 +- core/assets/bundles/bundle_in_ID.properties | 2 +- core/assets/bundles/bundle_ko.properties | 2 +- core/assets/bundles/bundle_pl.properties | 2 +- core/assets/bundles/bundle_pt_BR.properties | 2 +- core/assets/bundles/bundle_tk.properties | 2 +- core/assets/bundles/bundle_zh_TW.properties | 2 +- core/src/io/anuke/mindustry/ai/WaveSpawner.java | 6 ++++-- core/src/io/anuke/mindustry/core/NetClient.java | 8 ++++---- .../mindustry/entities/effect/ItemTransfer.java | 2 +- .../mindustry/entities/traits/TypeTrait.java | 2 +- .../io/anuke/mindustry/input/DesktopInput.java | 1 + .../io/anuke/mindustry/input/MobileInput.java | 17 ++++++++++------- core/src/io/anuke/mindustry/io/MapIO.java | 2 +- .../ui/fragments/PlayerListFragment.java | 8 +++++++- .../world/consumers/ConsumePowerExact.java | 4 +++- 17 files changed, 40 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 6bc7a2ed45..e22b8f4529 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ allprojects { appName = 'Mindustry' gdxVersion = '1.9.8' roboVMVersion = '2.3.0' - uCoreVersion = '7143baa7e05e4e852e0c299d631b291ca37950b0' + uCoreVersion = '53f99fbdc50910a15b4f55e9739385f47cf800cf' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/assets/bundles/bundle_de.properties b/core/assets/bundles/bundle_de.properties index 6a905167c2..242e3038f7 100644 --- a/core/assets/bundles/bundle_de.properties +++ b/core/assets/bundles/bundle_de.properties @@ -460,7 +460,7 @@ text.none= 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.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.speed=[LIGHT_GRAY]Speed: {0} block.mass-driver.name=Mass Driver diff --git a/core/assets/bundles/bundle_in_ID.properties b/core/assets/bundles/bundle_in_ID.properties index adadaae8ad..209e232cdd 100644 --- a/core/assets/bundles/bundle_in_ID.properties +++ b/core/assets/bundles/bundle_in_ID.properties @@ -460,7 +460,7 @@ text.none= 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.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.speed=[LIGHT_GRAY]Speed: {0} block.mass-driver.name=Mass Driver diff --git a/core/assets/bundles/bundle_ko.properties b/core/assets/bundles/bundle_ko.properties index 1fe446d3d3..84731713cf 100644 --- a/core/assets/bundles/bundle_ko.properties +++ b/core/assets/bundles/bundle_ko.properties @@ -474,7 +474,7 @@ text.none=<없음> text.sector.corrupted=[orange]저장 파일에서 구역을 발견했으나 불러오지 못했습니다.\n새로 생성되었습니다. text.mission.complete=미션 성공! 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.speed=[LIGHT_GRAY]속도:{0} block.mass-driver.name=물질 이동기 diff --git a/core/assets/bundles/bundle_pl.properties b/core/assets/bundles/bundle_pl.properties index 5c2859e8fb..019af7a37a 100644 --- a/core/assets/bundles/bundle_pl.properties +++ b/core/assets/bundles/bundle_pl.properties @@ -460,7 +460,7 @@ text.none= 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.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.speed=[LIGHT_GRAY]Speed: {0} block.mass-driver.name=Mass Driver diff --git a/core/assets/bundles/bundle_pt_BR.properties b/core/assets/bundles/bundle_pt_BR.properties index d887ffea7d..0de151b2db 100644 --- a/core/assets/bundles/bundle_pt_BR.properties +++ b/core/assets/bundles/bundle_pt_BR.properties @@ -459,7 +459,7 @@ text.none= 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.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.unit.health=[LIGHT_GRAY]Health: {0} text.unit.speed=[LIGHT_GRAY]Speed: {0} diff --git a/core/assets/bundles/bundle_tk.properties b/core/assets/bundles/bundle_tk.properties index c27406eb5a..f0abb37eab 100644 --- a/core/assets/bundles/bundle_tk.properties +++ b/core/assets/bundles/bundle_tk.properties @@ -460,7 +460,7 @@ text.none= 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.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.speed=[LIGHT_GRAY]Speed: {0} block.mass-driver.name=Mass Driver diff --git a/core/assets/bundles/bundle_zh_TW.properties b/core/assets/bundles/bundle_zh_TW.properties index 2ce1141012..ebceea33a0 100644 --- a/core/assets/bundles/bundle_zh_TW.properties +++ b/core/assets/bundles/bundle_zh_TW.properties @@ -460,7 +460,7 @@ text.none= 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.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.speed=[LIGHT_GRAY]Speed: {0} block.mass-driver.name=Mass Driver diff --git a/core/src/io/anuke/mindustry/ai/WaveSpawner.java b/core/src/io/anuke/mindustry/ai/WaveSpawner.java index aa9cbf7758..f3a6eb49ed 100644 --- a/core/src/io/anuke/mindustry/ai/WaveSpawner.java +++ b/core/src/io/anuke/mindustry/ai/WaveSpawner.java @@ -75,7 +75,7 @@ public class WaveSpawner{ int amount = group.getGroupsSpawned(state.wave); if(group.type.isFlying){ flyGroups += amount; - }else{ + }else if(dynamicSpawn){ groundGroups += amount; } } @@ -109,6 +109,8 @@ public class WaveSpawner{ float spawnX, spawnY; float spread; + if(!group.type.isFlying && groundCount >= groundSpawns.size) continue; + if(group.type.isFlying){ FlyerSpawn spawn = flySpawns.get(flyCount); //TODO verify flyer spawn @@ -119,7 +121,7 @@ public class WaveSpawner{ spread = margin / 1.5f; flyCount++; - }else{ + }else{ //make sure it works for non-dynamic spawns GroundSpawn spawn = groundSpawns.get(groundCount); if(dynamicSpawn){ diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index 990f6d1686..d934d62e61 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -12,7 +12,6 @@ import io.anuke.annotations.Annotations.Variant; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState.State; 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.SyncTrait; 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.TraceInfo; import io.anuke.mindustry.net.ValidateException; +import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.modules.InventoryModule; import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Settings; @@ -292,9 +292,9 @@ public class NetClient extends Module{ byte cores = input.readByte(); for(int i = 0; i < cores; i++){ int pos = input.readInt(); - TileEntity entity = world.tile(pos).entity; - if(entity != null){ - entity.items.read(input); + Tile tile = world.tile(pos); + if(tile != null && tile.entity != null){ + tile.entity.items.read(input); }else{ new InventoryModule().read(input); } diff --git a/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java b/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java index 3a0a70e358..90e35dd496 100644 --- a/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java +++ b/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java @@ -49,7 +49,7 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{ @Remote(called = Loc.server) 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++){ Timers.run(i * 3, () -> create(item, x, y, tile, () -> { })); diff --git a/core/src/io/anuke/mindustry/entities/traits/TypeTrait.java b/core/src/io/anuke/mindustry/entities/traits/TypeTrait.java index 9bde9509fc..774b2b4143 100644 --- a/core/src/io/anuke/mindustry/entities/traits/TypeTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/TypeTrait.java @@ -14,7 +14,7 @@ public interface TypeTrait{ */ static void registerType(Class type, Supplier supplier){ if(typeToID.get(type, -1) != -1){ - throw new RuntimeException("Type is already registered: '" + type + "'!"); + return; //already registered } registeredTypes.add(supplier); diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index da1042dade..ead49a6218 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -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); }else if(isPlacing()){ if(recipe.result.rotate){ diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index 162cb3f8ca..d9f83cdd22 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -178,11 +178,13 @@ public class MobileInput extends InputHandler implements GestureListener{ request.recipe.result.rotate ? request.rotation * 90 : 0); } }else{ + float rad = (tile.block().size * tilesize / 2f - 1) * request.scale; + Draw.alpha(0f); //draw removing request - Draw.color(Palette.removeBack); - Lines.square(tile.drawx(), tile.drawy()-1, tile.block().size * tilesize / 2f); - Draw.color(Palette.remove); - Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f); + Draw.tint(Palette.removeBack); + Lines.square(tile.drawx(), tile.drawy()-1, rad); + Draw.tint(Palette.remove); + 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); selection.clear(); selecting = false; @@ -383,12 +385,13 @@ public class MobileInput extends InputHandler implements GestureListener{ other = other.target(); 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); - 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); } diff --git a/core/src/io/anuke/mindustry/io/MapIO.java b/core/src/io/anuke/mindustry/io/MapIO.java index 253e9013bd..4e07de02e3 100644 --- a/core/src/io/anuke/mindustry/io/MapIO.java +++ b/core/src/io/anuke/mindustry/io/MapIO.java @@ -78,7 +78,7 @@ public class MapIO{ for(int x = 0; x < data.width(); x++){ 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); data.write(x, y, DataPosition.floor, block.floor.id); diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java index 56e742cc43..718b071751 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.ui.fragments; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.Batch; import io.anuke.mindustry.core.GameState.State; 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.NetConnection; import io.anuke.mindustry.net.Packets.AdminAction; +import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Timers; import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Lines; @@ -36,6 +38,10 @@ public class PlayerListFragment extends Fragment{ if(visible && Timers.get("player-list-rebuild", 20)){ 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, () -> 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); t.row(); diff --git a/core/src/io/anuke/mindustry/world/consumers/ConsumePowerExact.java b/core/src/io/anuke/mindustry/world/consumers/ConsumePowerExact.java index efc95d39d3..8e9dfdd1b7 100644 --- a/core/src/io/anuke/mindustry/world/consumers/ConsumePowerExact.java +++ b/core/src/io/anuke/mindustry/world/consumers/ConsumePowerExact.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.world.consumers; +import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.world.Block; public class ConsumePowerExact extends ConsumePower{ @@ -8,7 +9,8 @@ public class ConsumePowerExact extends ConsumePower{ super(use); } - protected float use(Block block){ + @Override + protected float use(Block block, TileEntity entity){ return this.use; } }