mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-29 00:50:06 +07:00
Minor fixes / Desktop detach camera hotkey
This commit is contained in:
parent
ab39291626
commit
bd1f750673
@ -1042,7 +1042,7 @@ public class UnitTypes{
|
||||
|
||||
status = StatusEffects.blasted;
|
||||
statusDuration = 60f;
|
||||
damage = splashDamage * 0.7f;
|
||||
damage = splashDamage * 0.5f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
@ -74,6 +74,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
ui.showInfo("@mods.initfailed");
|
||||
});
|
||||
}
|
||||
checkAutoUnlocks();
|
||||
});
|
||||
|
||||
Events.on(StateChangeEvent.class, event -> {
|
||||
|
@ -81,6 +81,7 @@ public enum Binding implements KeyBind{
|
||||
block_select_10(KeyCode.num0),
|
||||
|
||||
zoom(new Axis(KeyCode.scroll), "view"),
|
||||
detach_camera(KeyCode.unset),
|
||||
menu(Vars.android ? KeyCode.back : KeyCode.escape),
|
||||
fullscreen(KeyCode.f11),
|
||||
pause(KeyCode.space),
|
||||
|
@ -226,18 +226,31 @@ public class DesktopInput extends InputHandler{
|
||||
boolean locked = locked();
|
||||
boolean panCam = false;
|
||||
float camSpeed = (!Core.input.keyDown(Binding.boost) ? panSpeed : panBoostSpeed) * Time.delta;
|
||||
boolean detached = settings.getBool("detach-camera", false);
|
||||
|
||||
if(input.keyDown(Binding.pan) && !scene.hasField() && !scene.hasDialog()){
|
||||
panCam = true;
|
||||
panning = true;
|
||||
if(!scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyTap(Binding.detach_camera)){
|
||||
settings.put("detach-camera", detached = !detached);
|
||||
if(!detached){
|
||||
panning = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(input.keyDown(Binding.pan)){
|
||||
panCam = true;
|
||||
panning = true;
|
||||
}
|
||||
|
||||
if((Math.abs(Core.input.axis(Binding.move_x)) > 0 || Math.abs(Core.input.axis(Binding.move_y)) > 0 || input.keyDown(Binding.mouse_move))){
|
||||
panning = false;
|
||||
}
|
||||
}
|
||||
|
||||
if((Math.abs(Core.input.axis(Binding.move_x)) > 0 || Math.abs(Core.input.axis(Binding.move_y)) > 0 || input.keyDown(Binding.mouse_move)) && (!scene.hasField())){
|
||||
panning = false;
|
||||
}
|
||||
panning |= detached;
|
||||
|
||||
|
||||
if(!locked){
|
||||
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
||||
if(((player.dead() || state.isPaused() || detached) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyDown(Binding.mouse_move)){
|
||||
panCam = true;
|
||||
}
|
||||
@ -859,9 +872,20 @@ public class DesktopInput extends InputHandler{
|
||||
float ya = Core.input.axis(Binding.move_y);
|
||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||
|
||||
movement.set(xa, ya).nor().scl(speed);
|
||||
if(Core.input.keyDown(Binding.mouse_move)){
|
||||
movement.add(input.mouseWorld().sub(player).scl(1f / 25f * speed)).limit(speed);
|
||||
if(settings.getBool("detach-camera")){
|
||||
Vec2 targetPos = camera.position;
|
||||
|
||||
movement.set(targetPos).sub(player).limit(speed);
|
||||
|
||||
if(player.within(targetPos, 15f)){
|
||||
movement.setZero();
|
||||
unit.vel.approachDelta(Vec2.ZERO, unit.speed() * unit.type().accel / 2f);
|
||||
}
|
||||
}else{
|
||||
movement.set(xa, ya).nor().scl(speed);
|
||||
if(Core.input.keyDown(Binding.mouse_move)){
|
||||
movement.add(input.mouseWorld().sub(player).scl(1f / 25f * speed)).limit(speed);
|
||||
}
|
||||
}
|
||||
|
||||
float mouseAngle = Angles.mouseAngle(unit.x, unit.y);
|
||||
|
Loading…
Reference in New Issue
Block a user