mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Bugfixes
This commit is contained in:
parent
77911385e1
commit
de6cde6ddd
@ -742,6 +742,7 @@ keybind.toggle_block_status.name = Toggle Block Statuses
|
|||||||
keybind.move_x.name = Move X
|
keybind.move_x.name = Move X
|
||||||
keybind.move_y.name = Move Y
|
keybind.move_y.name = Move Y
|
||||||
keybind.mouse_move.name = Follow Mouse
|
keybind.mouse_move.name = Follow Mouse
|
||||||
|
keybind.pan.name = Pan
|
||||||
keybind.boost.name = Boost
|
keybind.boost.name = Boost
|
||||||
keybind.schematic_select.name = Select Region
|
keybind.schematic_select.name = Select Region
|
||||||
keybind.schematic_menu.name = Schematic Menu
|
keybind.schematic_menu.name = Schematic Menu
|
||||||
|
@ -14,7 +14,7 @@ import static mindustry.Vars.net;
|
|||||||
abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
||||||
private static final Vec2 tmp1 = new Vec2(), tmp2 = new Vec2();
|
private static final Vec2 tmp1 = new Vec2(), tmp2 = new Vec2();
|
||||||
|
|
||||||
@Import float x, y;
|
@Import float x, y, speedMultiplier;
|
||||||
@Import Vec2 vel;
|
@Import Vec2 vel;
|
||||||
|
|
||||||
@SyncLocal float elevation;
|
@SyncLocal float elevation;
|
||||||
@ -56,7 +56,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
|||||||
|
|
||||||
float floorSpeedMultiplier(){
|
float floorSpeedMultiplier(){
|
||||||
Floor on = isFlying() || hovering ? Blocks.air.asFloor() : floorOn();
|
Floor on = isFlying() || hovering ? Blocks.air.asFloor() : floorOn();
|
||||||
return on.speedMultiplier;
|
return on.speedMultiplier * speedMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,7 +8,8 @@ import arc.input.*;
|
|||||||
public enum Binding implements KeyBind{
|
public enum Binding implements KeyBind{
|
||||||
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
|
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
|
||||||
move_y(new Axis(KeyCode.s, KeyCode.w)),
|
move_y(new Axis(KeyCode.s, KeyCode.w)),
|
||||||
mouse_move(KeyCode.mouseForward),
|
mouse_move(KeyCode.mouseBack),
|
||||||
|
pan(KeyCode.mouseForward),
|
||||||
|
|
||||||
boost(KeyCode.shiftLeft),
|
boost(KeyCode.shiftLeft),
|
||||||
control(KeyCode.controlLeft),
|
control(KeyCode.controlLeft),
|
||||||
|
@ -43,6 +43,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
/** Whether player is currently deleting removal requests. */
|
/** Whether player is currently deleting removal requests. */
|
||||||
private boolean deleting = false, shouldShoot = false;
|
private boolean deleting = false, shouldShoot = false;
|
||||||
|
|
||||||
|
private boolean panning = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildUI(Group group){
|
public void buildUI(Group group){
|
||||||
group.fill(t -> {
|
group.fill(t -> {
|
||||||
@ -178,22 +180,35 @@ public class DesktopInput extends InputHandler{
|
|||||||
ui.listfrag.toggle();
|
ui.listfrag.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO awful UI state checking code
|
boolean panCam = false;
|
||||||
if((player.dead() || state.isPaused()) && !ui.chatfrag.shown()){
|
float camSpeed = !Core.input.keyDown(Binding.boost) ? 3f : 8f;
|
||||||
if(!(scene.getKeyboardFocus() instanceof TextField) && !scene.hasDialog()){
|
|
||||||
//move camera around
|
|
||||||
float camSpeed = !Core.input.keyDown(Binding.boost) ? 3f : 8f;
|
|
||||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed));
|
|
||||||
|
|
||||||
if(Core.input.keyDown(Binding.mouse_move)){
|
if(input.keyDown(Binding.pan)){
|
||||||
Core.camera.position.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * 0.005f, -1, 1) * camSpeed;
|
panCam = true;
|
||||||
Core.camera.position.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * 0.005f, -1, 1) * camSpeed;
|
panning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Math.abs(Core.input.axis(Binding.move_x)) > 0 || Math.abs(Core.input.axis(Binding.move_y)) > 0){
|
||||||
|
panning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO awful UI state checking code
|
||||||
|
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && (!(scene.getKeyboardFocus() instanceof TextField) && !scene.hasDialog())){
|
||||||
|
if(input.keyDown(Binding.mouse_move)){
|
||||||
|
panCam = true;
|
||||||
}
|
}
|
||||||
}else if(!player.dead()){
|
panning = false;
|
||||||
|
|
||||||
|
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed));
|
||||||
|
}else if(!player.dead() && !panning){
|
||||||
Core.camera.position.lerpDelta(player, Core.settings.getBool("smoothcamera") ? 0.08f : 1f);
|
Core.camera.position.lerpDelta(player, Core.settings.getBool("smoothcamera") ? 0.08f : 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(panCam){
|
||||||
|
Core.camera.position.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * 0.005f, -1, 1) * camSpeed;
|
||||||
|
Core.camera.position.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * 0.005f, -1, 1) * camSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
shouldShoot = !scene.hasMouse();
|
shouldShoot = !scene.hasMouse();
|
||||||
|
|
||||||
if(!scene.hasMouse()){
|
if(!scene.hasMouse()){
|
||||||
|
@ -5,6 +5,7 @@ import arc.func.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import arc.util.Log.*;
|
||||||
import arc.util.pooling.Pool.*;
|
import arc.util.pooling.Pool.*;
|
||||||
import arc.util.pooling.*;
|
import arc.util.pooling.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
@ -576,7 +577,8 @@ public class Administration{
|
|||||||
motd("The message displayed to people on connection.", "off"),
|
motd("The message displayed to people on connection.", "off"),
|
||||||
autosave("Whether the periodically save the map when playing.", false),
|
autosave("Whether the periodically save the map when playing.", false),
|
||||||
autosaveAmount("The maximum amount of autosaves. Older ones get replaced.", 10),
|
autosaveAmount("The maximum amount of autosaves. Older ones get replaced.", 10),
|
||||||
autosaveSpacing("Spacing between autosaves in seconds.", 60 * 5);
|
autosaveSpacing("Spacing between autosaves in seconds.", 60 * 5),
|
||||||
|
debug("Enable debug logging", false, () -> Log.setLogLevel(debug() ? LogLevel.debug : LogLevel.info));
|
||||||
|
|
||||||
public static final Config[] all = values();
|
public static final Config[] all = values();
|
||||||
|
|
||||||
@ -635,6 +637,10 @@ public class Administration{
|
|||||||
Core.settings.put(key, value);
|
Core.settings.put(key, value);
|
||||||
changed.run();
|
changed.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean debug(){
|
||||||
|
return Config.debug.bool();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PlayerInfo{
|
public static class PlayerInfo{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package mindustry.net;
|
package mindustry.net;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.net.*;
|
import arc.net.*;
|
||||||
import arc.net.FrameworkMessage.*;
|
import arc.net.FrameworkMessage.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.async.*;
|
import arc.util.async.*;
|
||||||
import arc.util.pooling.*;
|
import arc.util.pooling.*;
|
||||||
@ -28,7 +28,9 @@ public class ArcNetProvider implements NetProvider{
|
|||||||
Thread serverThread;
|
Thread serverThread;
|
||||||
|
|
||||||
public ArcNetProvider(){
|
public ArcNetProvider(){
|
||||||
client = new Client(8192, 4096, new PacketSerializer());
|
ArcNet.errorHandler = e -> Log.debug(Strings.getStackTrace(e));
|
||||||
|
|
||||||
|
client = new Client(8192, 8192, new PacketSerializer());
|
||||||
client.setDiscoveryPacket(packetSupplier);
|
client.setDiscoveryPacket(packetSupplier);
|
||||||
client.addListener(new NetListener(){
|
client.addListener(new NetListener(){
|
||||||
@Override
|
@Override
|
||||||
@ -66,7 +68,7 @@ public class ArcNetProvider implements NetProvider{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server = new Server(4096 * 2, 4096, new PacketSerializer());
|
server = new Server(8192, 8192, new PacketSerializer());
|
||||||
server.setMulticast(multicastGroup, multicastPort);
|
server.setMulticast(multicastGroup, multicastPort);
|
||||||
server.setDiscoveryHandler((address, handler) -> {
|
server.setDiscoveryHandler((address, handler) -> {
|
||||||
ByteBuffer buffer = NetworkIO.writeServerData();
|
ByteBuffer buffer = NetworkIO.writeServerData();
|
||||||
|
@ -25,7 +25,7 @@ import java.util.zip.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class LogicBlock extends Block{
|
public class LogicBlock extends Block{
|
||||||
public static final int maxInstructions = 2000;
|
public static final int maxInstructions = 1500;
|
||||||
|
|
||||||
public int maxInstructionScale = 5;
|
public int maxInstructionScale = 5;
|
||||||
public int instructionsPerTick = 1;
|
public int instructionsPerTick = 1;
|
||||||
|
@ -64,6 +64,9 @@ public class ServerControl implements ApplicationListener{
|
|||||||
"globalrules", "{reactorExplosions: false}"
|
"globalrules", "{reactorExplosions: false}"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//update log level
|
||||||
|
Config.debug.set(Config.debug.bool());
|
||||||
|
|
||||||
Log.setLogger((level, text) -> {
|
Log.setLogger((level, text) -> {
|
||||||
String result = "[" + dateTime.format(LocalDateTime.now()) + "] " + format(tags[level.ordinal()] + " " + text + "&fr");
|
String result = "[" + dateTime.format(LocalDateTime.now()) + "] " + format(tags[level.ordinal()] + " " + text + "&fr");
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
|
Loading…
Reference in New Issue
Block a user