Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: gradle.properties
This commit is contained in:
@@ -57,7 +57,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
||||
accepting = 0f;
|
||||
|
||||
if(amount >= maxLiquid / 1.5f){
|
||||
float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f) * Time.delta;
|
||||
float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f * Time.delta);
|
||||
int targets = 0;
|
||||
for(Point2 point : Geometry.d4){
|
||||
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
||||
|
||||
@@ -192,6 +192,7 @@ public class DesktopInput extends InputHandler{
|
||||
ui.listfrag.toggle();
|
||||
}
|
||||
|
||||
boolean locked = locked();
|
||||
boolean panCam = false;
|
||||
float camSpeed = (!Core.input.keyDown(Binding.boost) ? panSpeed : panBoostSpeed) * Time.delta;
|
||||
|
||||
@@ -204,24 +205,27 @@ public class DesktopInput extends InputHandler{
|
||||
panning = false;
|
||||
}
|
||||
|
||||
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyDown(Binding.mouse_move)){
|
||||
panCam = true;
|
||||
if(!locked){
|
||||
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyDown(Binding.mouse_move)){
|
||||
panCam = true;
|
||||
}
|
||||
|
||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(camSpeed));
|
||||
}else if(!player.dead() && !panning){
|
||||
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) * panScale, -1, 1) * camSpeed;
|
||||
Core.camera.position.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * panScale, -1, 1) * camSpeed;
|
||||
}
|
||||
|
||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(camSpeed));
|
||||
}else if(!player.dead() && !panning){
|
||||
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) * panScale, -1, 1) * camSpeed;
|
||||
Core.camera.position.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * panScale, -1, 1) * camSpeed;
|
||||
}
|
||||
shouldShoot = !scene.hasMouse() && !locked;
|
||||
|
||||
shouldShoot = !scene.hasMouse();
|
||||
|
||||
if(!scene.hasMouse()){
|
||||
if(!scene.hasMouse() && !locked){
|
||||
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
|
||||
Unit on = selectedUnit();
|
||||
var build = selectedControlBuild();
|
||||
@@ -236,7 +240,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
}
|
||||
|
||||
if(!player.dead() && !state.isPaused() && !scene.hasField() && !renderer.isCutscene()){
|
||||
if(!player.dead() && !state.isPaused() && !scene.hasField() && !locked){
|
||||
updateMovement(player.unit());
|
||||
|
||||
if(Core.input.keyTap(Binding.respawn)){
|
||||
@@ -271,7 +275,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
}
|
||||
|
||||
if(player.dead()){
|
||||
if(player.dead() || locked){
|
||||
cursorType = SystemCursor.arrow;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
public final OverlayFragment frag = new OverlayFragment();
|
||||
|
||||
/** If any of these functions return true, input is locked. */
|
||||
public Seq<Boolp> inputLocks = Seq.with(() -> renderer.isCutscene());
|
||||
public Interval controlInterval = new Interval();
|
||||
public @Nullable Block block;
|
||||
public boolean overrideLineRotation;
|
||||
@@ -433,6 +435,16 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds an input lock; if this function returns true, input is locked. Used for mod 'cutscenes' or custom camera panning. */
|
||||
public void addLock(Boolp lock){
|
||||
inputLocks.add(lock);
|
||||
}
|
||||
|
||||
/** @return whether most input is locked, for 'cutscenes' */
|
||||
public boolean locked(){
|
||||
return inputLocks.contains(Boolp::get);
|
||||
}
|
||||
|
||||
public Eachable<BuildPlan> allRequests(){
|
||||
return cons -> {
|
||||
for(BuildPlan request : player.unit().plans()) cons.get(request);
|
||||
@@ -460,6 +472,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
player.unit().type.weapons.first().noAmmoSound.at(player.unit());
|
||||
}
|
||||
|
||||
//you don't want selected blocks while locked, looks weird
|
||||
if(locked()){
|
||||
block = null;
|
||||
}
|
||||
|
||||
wasShooting = player.shooting;
|
||||
|
||||
//only reset the controlled type and control a unit after the timer runs out
|
||||
@@ -1186,6 +1203,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
public boolean validPlace(int x, int y, Block type, int rotation, BuildPlan ignore){
|
||||
//TODO with many requests, this is O(n * m), very laggy
|
||||
for(BuildPlan req : player.unit().plans()){
|
||||
if(req != ignore
|
||||
&& !req.breaking
|
||||
|
||||
@@ -435,7 +435,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){
|
||||
if(state.isMenu()) return false;
|
||||
if(state.isMenu() || locked()) return false;
|
||||
|
||||
down = true;
|
||||
|
||||
@@ -515,7 +515,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public boolean longPress(float x, float y){
|
||||
if(state.isMenu()|| player.dead()) return false;
|
||||
if(state.isMenu()|| player.dead() || locked()) return false;
|
||||
|
||||
//get tile on cursor
|
||||
Tile cursor = tileAt(x, y);
|
||||
@@ -575,7 +575,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public boolean tap(float x, float y, int count, KeyCode button){
|
||||
if(state.isMenu() || lineMode) return false;
|
||||
if(state.isMenu() || lineMode || locked()) return false;
|
||||
|
||||
float worldx = Core.input.mouseWorld(x, y).x, worldy = Core.input.mouseWorld(x, y).y;
|
||||
|
||||
@@ -654,6 +654,8 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
public void update(){
|
||||
super.update();
|
||||
|
||||
boolean locked = locked();
|
||||
|
||||
if(player.dead()){
|
||||
mode = none;
|
||||
manualShooting = false;
|
||||
@@ -661,11 +663,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}
|
||||
|
||||
//zoom camera
|
||||
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectRequests.isEmpty()))){
|
||||
if(!locked && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectRequests.isEmpty()))){
|
||||
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
|
||||
}
|
||||
|
||||
if(!Core.settings.getBool("keyboard")){
|
||||
if(!Core.settings.getBool("keyboard") && !locked){
|
||||
//move camera around
|
||||
float camSpeed = 6f;
|
||||
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));
|
||||
@@ -681,7 +683,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
if(!player.dead() && !state.isPaused() && !renderer.isCutscene()){
|
||||
if(!player.dead() && !state.isPaused() && !locked){
|
||||
updateMovement(player.unit());
|
||||
}
|
||||
|
||||
@@ -791,7 +793,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public boolean pan(float x, float y, float deltaX, float deltaY){
|
||||
if(Core.scene == null || Core.scene.hasDialog() || Core.settings.getBool("keyboard")) return false;
|
||||
if(Core.scene == null || Core.scene.hasDialog() || Core.settings.getBool("keyboard") || locked()) return false;
|
||||
|
||||
float scale = Core.camera.width / Core.graphics.getWidth();
|
||||
deltaX *= scale;
|
||||
|
||||
@@ -327,7 +327,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
boolean naval = (float)waters / total >= 0.26f;
|
||||
boolean naval = (float)waters / total >= 0.15f;
|
||||
|
||||
//create water pathway if the map is flooded
|
||||
if(naval){
|
||||
|
||||
@@ -68,20 +68,34 @@ public class Menus{
|
||||
ui.showText("", message);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both)
|
||||
@Remote(variants = Variant.both, unreliable = true)
|
||||
public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){
|
||||
if(message == null) return;
|
||||
|
||||
ui.showInfoPopup(message, duration, align, top, left, bottom, right);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both)
|
||||
@Remote(variants = Variant.both, unreliable = true)
|
||||
public static void label(String message, float duration, float worldx, float worldy){
|
||||
if(message == null) return;
|
||||
|
||||
ui.showLabel(message, duration, worldx, worldy);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both)
|
||||
public static void infoPopupReliable(String message, float duration, int align, int top, int left, int bottom, int right){
|
||||
if(message == null) return;
|
||||
|
||||
ui.showInfoPopup(message, duration, align, top, left, bottom, right);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both)
|
||||
public static void labelReliable(String message, float duration, float worldx, float worldy){
|
||||
if(message == null) return;
|
||||
|
||||
ui.showLabel(message, duration, worldx, worldy);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both)
|
||||
public static void infoToast(String message, float duration){
|
||||
if(message == null) return;
|
||||
|
||||
@@ -149,6 +149,7 @@ public class ChatFragment extends Table{
|
||||
if(i - scrollPos == 0) theight -= textspacing + 1;
|
||||
|
||||
font.getCache().clear();
|
||||
font.getCache().setColor(Color.white);
|
||||
font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
|
||||
|
||||
if(!shown && fadetime - i < 1f && fadetime - i >= 0f){
|
||||
|
||||
@@ -133,6 +133,7 @@ public class ScriptConsoleFragment extends Table{
|
||||
if(i - scrollPos == 0) theight -= textspacing + 1;
|
||||
|
||||
font.getCache().clear();
|
||||
font.getCache().setColor(Color.white);
|
||||
font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
|
||||
|
||||
if(!open){
|
||||
|
||||
@@ -40,7 +40,7 @@ public class SolidPump extends Pump{
|
||||
drawPotentialLinks(x, y);
|
||||
|
||||
if(attribute != null){
|
||||
drawPlaceText(Core.bundle.format("bar.efficiency", Math.round(Math.max(sumAttribute(attribute, x, y) / size / size + baseEfficiency, 0f) * 100 * percentSolid(x, y))), x, y, valid);
|
||||
drawPlaceText(Core.bundle.format("bar.efficiency", Math.round(Math.max((sumAttribute(attribute, x, y)) / size / size + percentSolid(x, y) * baseEfficiency, 0f) * 100)), x, y, valid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SolidPump extends Pump{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("efficiency", (SolidPumpBuild entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed",
|
||||
entity.lastPump / Time.delta * 60, 1),
|
||||
entity.lastPump * 60, 1),
|
||||
() -> Pal.ammo,
|
||||
() -> entity.warmup * entity.efficiency()));
|
||||
}
|
||||
@@ -92,7 +92,6 @@ public class SolidPump extends Pump{
|
||||
public float validTiles;
|
||||
public float lastPump;
|
||||
|
||||
|
||||
@Override
|
||||
public void drawCracks(){}
|
||||
|
||||
@@ -118,7 +117,7 @@ public class SolidPump extends Pump{
|
||||
if(cons.valid() && typeLiquid() < liquidCapacity - 0.001f){
|
||||
float maxPump = Math.min(liquidCapacity - typeLiquid(), pumpAmount * delta() * fraction * efficiency());
|
||||
liquids.add(result, maxPump);
|
||||
lastPump = maxPump;
|
||||
lastPump = maxPump / Time.delta;
|
||||
warmup = Mathf.lerpDelta(warmup, 1f, 0.02f);
|
||||
if(Mathf.chance(delta() * updateEffectChance))
|
||||
updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f));
|
||||
|
||||
Reference in New Issue
Block a user