This commit is contained in:
Anuken
2019-04-07 11:25:08 -04:00
parent 7c81a807ea
commit 08a2872527
11 changed files with 58 additions and 53 deletions

View File

@@ -818,7 +818,7 @@ public class Blocks implements ContentList{
size = 1; size = 1;
reload = 200f; reload = 200f;
range = 40f; range = 40f;
healPercent = 5f; healPercent = 4f;
phaseBoost = 4f; phaseBoost = 4f;
phaseRangeBoost = 20f; phaseRangeBoost = 20f;
health = 80; 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)); 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; size = 4;
health = 900; health = 900;
powerProduction = 100f; powerProduction = 110f;
itemDuration = 40f; itemDuration = 40f;
consumes.power(25f); consumes.power(25f);
consumes.item(Items.blastCompound); consumes.item(Items.blastCompound);
consumes.liquid(Liquids.cryofluid, 0.8f); consumes.liquid(Liquids.cryofluid, 0.3f);
}}; }};
//endregion power //endregion power

View File

@@ -694,6 +694,8 @@ public class Bullets implements ContentList{
bulletWidth = 9f; bulletWidth = 9f;
bulletHeight = 13f; bulletHeight = 13f;
hitEffect = Fx.flakExplosion; hitEffect = Fx.flakExplosion;
shootEffect = Fx.none;
smokeEffect = Fx.none;
}}; }};
bombIncendiary = new BombBulletType(7f, 10f, "shell"){{ bombIncendiary = new BombBulletType(7f, 10f, "shell"){{

View File

@@ -82,7 +82,6 @@ public class Mechs implements ContentList{
roundrobin = true; roundrobin = true;
shots = 3; shots = 3;
inaccuracy = 0f; inaccuracy = 0f;
velocityRnd = 0.2f;
ejectEffect = Fx.none; ejectEffect = Fx.none;
bullet = Bullets.lightning; bullet = Bullets.lightning;
}}; }};

View File

@@ -352,7 +352,8 @@ 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, requests, player.isBoosting, player.isShooting, ui.chatfrag.chatOpen(),
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);
} }

View File

@@ -269,7 +269,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 boosting, boolean shooting, boolean chatting,
BuildRequest[] requests, BuildRequest[] requests,
float viewX, float viewY, float viewWidth, float viewHeight float viewX, float viewY, float viewWidth, float viewHeight
){ ){
@@ -293,6 +293,7 @@ public class NetServer implements ApplicationListener{
player.pointerX = pointerX; player.pointerX = pointerX;
player.pointerY = pointerY; player.pointerY = pointerY;
player.setMineTile(mining); player.setMineTile(mining);
player.isTyping = chatting;
player.isBoosting = boosting; player.isBoosting = boosting;
player.isShooting = shooting; player.isShooting = shooting;
player.getPlaceQueue().clear(); player.getPlaceQueue().clear();

View File

@@ -305,6 +305,9 @@ public class MapGenerateDialog extends FloatingDialog{
} }
Core.app.post(() -> { Core.app.post(() -> {
if(pixmap == null || texture == null){
return;
}
texture.draw(pixmap, 0, 0); texture.draw(pixmap, 0, 0);
generating = false; generating = false;
}); });

View File

@@ -39,7 +39,7 @@ public class Predict{
Vector2 ts = quad(a, b, c); Vector2 ts = quad(a, b, c);
// Find smallest positive solution // Find smallest positive solution
Vector2 sol = vresult.set(0, 0); Vector2 sol = vresult.set(dstx, dsty);
if(ts != null){ if(ts != null){
float t0 = ts.x, t1 = ts.y; float t0 = ts.x, t1 = ts.y;
float t = Math.min(t0, t1); float t = Math.min(t0, t1);

View File

@@ -58,7 +58,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public float pointerX, pointerY; public float pointerX, pointerY;
public String name = "name"; public String name = "name";
public String uuid, usid; 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 float boostHeat, shootHeat, destructTime;
public boolean achievedFlight; public boolean achievedFlight;
public Color color = new Color(); public Color color = new Color();
@@ -850,7 +850,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public void write(DataOutput buffer) throws IOException{ public void write(DataOutput buffer) throws IOException{
super.writeSave(buffer, !isLocal); super.writeSave(buffer, !isLocal);
TypeIO.writeStringData(buffer, name); //TODO writing strings is very inefficient 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.writeInt(Color.rgba8888(color));
buffer.writeByte(mech.id); buffer.writeByte(mech.id);
buffer.writeInt(mining == null ? noSpawner : mining.pos()); buffer.writeInt(mining == null ? noSpawner : mining.pos());
@@ -869,6 +869,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
isAdmin = (bools & 1) != 0; isAdmin = (bools & 1) != 0;
dead = (bools & 2) != 0; dead = (bools & 2) != 0;
boolean boosting = (bools & 4) != 0; boolean boosting = (bools & 4) != 0;
isTyping = (bools & 8) != 0;
color.set(buffer.readInt()); color.set(buffer.readInt());
mech = content.getByID(ContentType.mech, buffer.readByte()); mech = content.getByID(ContentType.mech, buffer.readByte());
int mine = buffer.readInt(); int mine = buffer.readInt();

View File

@@ -1,16 +1,12 @@
package io.anuke.mindustry.ui.fragments; package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.Input.TextInput;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.BitmapFont; import io.anuke.arc.graphics.g2d.*;
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.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.Group; 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;
import io.anuke.arc.scene.ui.Label.LabelStyle; import io.anuke.arc.scene.ui.Label.LabelStyle;
import io.anuke.arc.scene.ui.TextField; import io.anuke.arc.scene.ui.TextField;
@@ -115,35 +111,6 @@ public class ChatFragment extends Table{
chatfield.getStyle().fontColor = Color.WHITE; chatfield.getStyle().fontColor = Color.WHITE;
chatfield.setStyle(chatfield.getStyle()); 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); bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(6f);
add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28); add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28);
@@ -214,8 +181,21 @@ public class ChatFragment extends Table{
if(!chatOpen){ if(!chatOpen){
scene.setKeyboardFocus(chatfield); scene.setKeyboardFocus(chatfield);
chatfield.fireClick();
chatOpen = !chatOpen; 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{ }else{
scene.setKeyboardFocus(null); scene.setKeyboardFocus(null);
chatOpen = !chatOpen; chatOpen = !chatOpen;

View File

@@ -202,6 +202,7 @@ public class HudFragment extends Fragment{
//'core is under attack' table //'core is under attack' table
parent.fill(t -> { parent.fill(t -> {
t.touchable(Touchable.disabled);
float notifDuration = 240f; float notifDuration = 240f;
Events.on(StateChangeEvent.class, event -> { Events.on(StateChangeEvent.class, event -> {
@@ -236,7 +237,7 @@ public class HudFragment extends Fragment{
return coreAttackOpacity > 0; return coreAttackOpacity > 0;
}); });
t.table("button", top -> top.add("$coreattack").pad(2) 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 //launch button

View File

@@ -1,8 +1,9 @@
package io.anuke.mindustry.desktop; package io.anuke.mindustry.desktop;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.util.Log; import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.util.OS; 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;
import io.anuke.arc.util.serialization.JsonValue.ValueType; import io.anuke.arc.util.serialization.JsonValue.ValueType;
import io.anuke.arc.util.serialization.JsonWriter.OutputType; 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 io.anuke.mindustry.net.Net;
import org.lwjgl.util.tinyfd.TinyFileDialogs; import org.lwjgl.util.tinyfd.TinyFileDialogs;
import java.io.PrintWriter; import java.io.*;
import java.io.StringWriter; import java.nio.file.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@@ -23,6 +21,25 @@ public class CrashHandler{
public static void handle(Throwable e){ public static void handle(Throwable e){
e.printStackTrace(); e.printStackTrace();
if(Version.number == 0){
try{
ObjectMap<String, String> 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{ try{
//check crash report setting //check crash report setting