diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index a29988cb38..407fed03bc 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -818,7 +818,7 @@ public class Blocks implements ContentList{ size = 1; reload = 200f; range = 40f; - healPercent = 5f; + healPercent = 4f; phaseBoost = 4f; phaseRangeBoost = 20f; health = 80; @@ -1088,11 +1088,11 @@ public class Blocks implements ContentList{ requirements(Category.power, ItemStack.with(Items.lead, 1000, Items.silicon, 600, Items.graphite, 800, Items.thorium, 200, Items.surgealloy, 500, Items.metaglass, 500)); size = 4; health = 900; - powerProduction = 100f; + powerProduction = 110f; itemDuration = 40f; consumes.power(25f); consumes.item(Items.blastCompound); - consumes.liquid(Liquids.cryofluid, 0.8f); + consumes.liquid(Liquids.cryofluid, 0.3f); }}; //endregion power diff --git a/core/src/io/anuke/mindustry/content/Bullets.java b/core/src/io/anuke/mindustry/content/Bullets.java index 5b19d26914..006cffb694 100644 --- a/core/src/io/anuke/mindustry/content/Bullets.java +++ b/core/src/io/anuke/mindustry/content/Bullets.java @@ -694,6 +694,8 @@ public class Bullets implements ContentList{ bulletWidth = 9f; bulletHeight = 13f; hitEffect = Fx.flakExplosion; + shootEffect = Fx.none; + smokeEffect = Fx.none; }}; bombIncendiary = new BombBulletType(7f, 10f, "shell"){{ diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index cad54f3588..b717092a5d 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -82,7 +82,6 @@ public class Mechs implements ContentList{ roundrobin = true; shots = 3; inaccuracy = 0f; - velocityRnd = 0.2f; ejectEffect = Fx.none; bullet = Bullets.lightning; }}; diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index 9d3289eac2..5265ca09a4 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -352,7 +352,8 @@ public class NetClient implements ApplicationListener{ player.pointerX, player.pointerY, player.rotation, player.baseRotation, player.velocity().x, player.velocity().y, player.getMineTile(), - player.isBoosting, player.isShooting, requests, + player.isBoosting, player.isShooting, ui.chatfrag.chatOpen(), + requests, Core.camera.position.x, Core.camera.position.y, Core.camera.width * viewScale, Core.camera.height * viewScale); } diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index 45a0f12f03..eca9567343 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -269,7 +269,7 @@ public class NetServer implements ApplicationListener{ float rotation, float baseRotation, float xVelocity, float yVelocity, Tile mining, - boolean boosting, boolean shooting, + boolean boosting, boolean shooting, boolean chatting, BuildRequest[] requests, float viewX, float viewY, float viewWidth, float viewHeight ){ @@ -293,6 +293,7 @@ public class NetServer implements ApplicationListener{ player.pointerX = pointerX; player.pointerY = pointerY; player.setMineTile(mining); + player.isTyping = chatting; player.isBoosting = boosting; player.isShooting = shooting; player.getPlaceQueue().clear(); diff --git a/core/src/io/anuke/mindustry/editor/MapGenerateDialog.java b/core/src/io/anuke/mindustry/editor/MapGenerateDialog.java index d35f0048f7..22484498bc 100644 --- a/core/src/io/anuke/mindustry/editor/MapGenerateDialog.java +++ b/core/src/io/anuke/mindustry/editor/MapGenerateDialog.java @@ -305,6 +305,9 @@ public class MapGenerateDialog extends FloatingDialog{ } Core.app.post(() -> { + if(pixmap == null || texture == null){ + return; + } texture.draw(pixmap, 0, 0); generating = false; }); diff --git a/core/src/io/anuke/mindustry/entities/Predict.java b/core/src/io/anuke/mindustry/entities/Predict.java index 71b95ee7f2..950ad58912 100644 --- a/core/src/io/anuke/mindustry/entities/Predict.java +++ b/core/src/io/anuke/mindustry/entities/Predict.java @@ -39,7 +39,7 @@ public class Predict{ Vector2 ts = quad(a, b, c); // Find smallest positive solution - Vector2 sol = vresult.set(0, 0); + Vector2 sol = vresult.set(dstx, dsty); if(ts != null){ float t0 = ts.x, t1 = ts.y; float t = Math.min(t0, t1); diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 3e1eeda4fc..75b0d491cd 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -58,7 +58,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ public float pointerX, pointerY; public String name = "name"; public String uuid, usid; - public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile; + public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile, isTyping; public float boostHeat, shootHeat, destructTime; public boolean achievedFlight; public Color color = new Color(); @@ -850,7 +850,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ public void write(DataOutput buffer) throws IOException{ super.writeSave(buffer, !isLocal); TypeIO.writeStringData(buffer, name); //TODO writing strings is very inefficient - buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2)); + buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2) | (Pack.byteValue(isTyping) << 3)); buffer.writeInt(Color.rgba8888(color)); buffer.writeByte(mech.id); buffer.writeInt(mining == null ? noSpawner : mining.pos()); @@ -869,6 +869,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ isAdmin = (bools & 1) != 0; dead = (bools & 2) != 0; boolean boosting = (bools & 4) != 0; + isTyping = (bools & 8) != 0; color.set(buffer.readInt()); mech = content.getByID(ContentType.mech, buffer.readByte()); int mine = buffer.readInt(); diff --git a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java index 0612b44c08..6327ffa657 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java @@ -1,16 +1,12 @@ package io.anuke.mindustry.ui.fragments; import io.anuke.arc.Core; +import io.anuke.arc.Input.TextInput; import io.anuke.arc.collection.Array; import io.anuke.arc.graphics.Color; -import io.anuke.arc.graphics.g2d.BitmapFont; -import io.anuke.arc.graphics.g2d.Draw; -import io.anuke.arc.graphics.g2d.Fill; -import io.anuke.arc.graphics.g2d.GlyphLayout; -import io.anuke.arc.input.KeyCode; +import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.math.Mathf; import io.anuke.arc.scene.Group; -import io.anuke.arc.scene.ui.Dialog; import io.anuke.arc.scene.ui.Label; import io.anuke.arc.scene.ui.Label.LabelStyle; import io.anuke.arc.scene.ui.TextField; @@ -115,35 +111,6 @@ public class ChatFragment extends Table{ chatfield.getStyle().fontColor = Color.WHITE; chatfield.setStyle(chatfield.getStyle()); - if(mobile){ - chatfield.tapped(() -> { - Dialog dialog = new Dialog("", "dialog"); - dialog.setFillParent(true); - dialog.cont.top(); - dialog.cont.defaults().height(65f); - TextField to = dialog.cont.addField("", t-> {}).pad(15).width(250f).get(); - to.setMaxLength(maxTextLength); - to.keyDown(KeyCode.ENTER, () -> { - dialog.cont.find("okb").fireClick(); - }); - dialog.cont.addButton("$ok", () -> { - chatfield.clearText(); - chatfield.appendText(to.getText()); - chatfield.change(); - dialog.hide(); - Core.input.setOnscreenKeyboardVisible(false); - toggle(); - }).width(90f).name("okb"); - - dialog.show(); - Time.runTask(1f, () -> { - to.setCursorPosition(to.getText().length()); - Core.scene.setKeyboardFocus(to); - Core.input.setOnscreenKeyboardVisible(true); - }); - }); - } - bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(6f); add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28); @@ -214,8 +181,21 @@ public class ChatFragment extends Table{ if(!chatOpen){ scene.setKeyboardFocus(chatfield); - chatfield.fireClick(); chatOpen = !chatOpen; + if(mobile){ + TextInput input = new TextInput(); + input.maxLength = maxTextLength; + input.accepted = text -> { + chatfield.setText(text); + sendMessage(); + hide(); + Core.input.setOnscreenKeyboardVisible(false); + }; + input.canceled = this::hide; + Core.input.getTextInput(input); + }else{ + chatfield.fireClick(); + } }else{ scene.setKeyboardFocus(null); chatOpen = !chatOpen; diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index 4be0898881..c32962ef47 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -202,6 +202,7 @@ public class HudFragment extends Fragment{ //'core is under attack' table parent.fill(t -> { + t.touchable(Touchable.disabled); float notifDuration = 240f; Events.on(StateChangeEvent.class, event -> { @@ -236,7 +237,7 @@ public class HudFragment extends Fragment{ return coreAttackOpacity > 0; }); t.table("button", top -> top.add("$coreattack").pad(2) - .update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))); + .update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))).touchable(Touchable.disabled); }); //launch button diff --git a/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java b/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java index ab9bf15732..d8ddeefd67 100644 --- a/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java +++ b/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java @@ -1,8 +1,9 @@ package io.anuke.mindustry.desktop; import io.anuke.arc.Core; -import io.anuke.arc.util.Log; -import io.anuke.arc.util.OS; +import io.anuke.arc.collection.ObjectMap; +import io.anuke.arc.util.*; +import io.anuke.arc.util.io.PropertiesUtils; import io.anuke.arc.util.serialization.JsonValue; import io.anuke.arc.util.serialization.JsonValue.ValueType; import io.anuke.arc.util.serialization.JsonWriter.OutputType; @@ -11,11 +12,8 @@ import io.anuke.mindustry.game.Version; import io.anuke.mindustry.net.Net; import org.lwjgl.util.tinyfd.TinyFileDialogs; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.io.*; +import java.nio.file.*; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -23,6 +21,25 @@ public class CrashHandler{ public static void handle(Throwable e){ e.printStackTrace(); + if(Version.number == 0){ + try{ + ObjectMap map = new ObjectMap<>(); + PropertiesUtils.load(map, new InputStreamReader(CrashHandler.class.getResourceAsStream("/version.properties"))); + + Version.type = map.get("type"); + Version.number = Integer.parseInt(map.get("number")); + Version.modifier = map.get("modifier"); + if(map.get("build").contains(".")){ + String[] split = map.get("build").split("\\."); + Version.build = Integer.parseInt(split[0]); + Version.revision = Integer.parseInt(split[1]); + }else{ + Version.build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1; + } + }catch(Throwable ignored){ + + } + } try{ //check crash report setting