Minor fixes / Desktop detach camera hotkey
This commit is contained in:
@@ -1042,7 +1042,7 @@ public class UnitTypes{
|
|||||||
|
|
||||||
status = StatusEffects.blasted;
|
status = StatusEffects.blasted;
|
||||||
statusDuration = 60f;
|
statusDuration = 60f;
|
||||||
damage = splashDamage * 0.7f;
|
damage = splashDamage * 0.5f;
|
||||||
}};
|
}};
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
ui.showInfo("@mods.initfailed");
|
ui.showInfo("@mods.initfailed");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
checkAutoUnlocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(StateChangeEvent.class, event -> {
|
Events.on(StateChangeEvent.class, event -> {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public enum Binding implements KeyBind{
|
|||||||
block_select_10(KeyCode.num0),
|
block_select_10(KeyCode.num0),
|
||||||
|
|
||||||
zoom(new Axis(KeyCode.scroll), "view"),
|
zoom(new Axis(KeyCode.scroll), "view"),
|
||||||
|
detach_camera(KeyCode.unset),
|
||||||
menu(Vars.android ? KeyCode.back : KeyCode.escape),
|
menu(Vars.android ? KeyCode.back : KeyCode.escape),
|
||||||
fullscreen(KeyCode.f11),
|
fullscreen(KeyCode.f11),
|
||||||
pause(KeyCode.space),
|
pause(KeyCode.space),
|
||||||
|
|||||||
@@ -226,18 +226,31 @@ public class DesktopInput extends InputHandler{
|
|||||||
boolean locked = locked();
|
boolean locked = locked();
|
||||||
boolean panCam = false;
|
boolean panCam = false;
|
||||||
float camSpeed = (!Core.input.keyDown(Binding.boost) ? panSpeed : panBoostSpeed) * Time.delta;
|
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()){
|
if(!scene.hasField() && !scene.hasDialog()){
|
||||||
panCam = true;
|
if(input.keyTap(Binding.detach_camera)){
|
||||||
panning = true;
|
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 |= detached;
|
||||||
panning = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!locked){
|
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)){
|
if(input.keyDown(Binding.mouse_move)){
|
||||||
panCam = true;
|
panCam = true;
|
||||||
}
|
}
|
||||||
@@ -859,9 +872,20 @@ public class DesktopInput extends InputHandler{
|
|||||||
float ya = Core.input.axis(Binding.move_y);
|
float ya = Core.input.axis(Binding.move_y);
|
||||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||||
|
|
||||||
movement.set(xa, ya).nor().scl(speed);
|
if(settings.getBool("detach-camera")){
|
||||||
if(Core.input.keyDown(Binding.mouse_move)){
|
Vec2 targetPos = camera.position;
|
||||||
movement.add(input.mouseWorld().sub(player).scl(1f / 25f * speed)).limit(speed);
|
|
||||||
|
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);
|
float mouseAngle = Angles.mouseAngle(unit.x, unit.y);
|
||||||
|
|||||||
Reference in New Issue
Block a user