Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	gradle.properties
This commit is contained in:
Anuken
2021-10-05 12:08:58 -04:00
12 changed files with 73 additions and 34 deletions

View File

@@ -57,7 +57,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
accepting = 0f; accepting = 0f;
if(amount >= maxLiquid / 1.5f){ 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; int targets = 0;
for(Point2 point : Geometry.d4){ for(Point2 point : Geometry.d4){
Tile other = world.tile(tile.x + point.x, tile.y + point.y); Tile other = world.tile(tile.x + point.x, tile.y + point.y);

View File

@@ -192,6 +192,7 @@ public class DesktopInput extends InputHandler{
ui.listfrag.toggle(); ui.listfrag.toggle();
} }
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;
@@ -204,24 +205,27 @@ public class DesktopInput extends InputHandler{
panning = false; panning = false;
} }
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){ if(!locked){
if(input.keyDown(Binding.mouse_move)){ if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
panCam = true; 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){ shouldShoot = !scene.hasMouse() && !locked;
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(); if(!scene.hasMouse() && !locked){
if(!scene.hasMouse()){
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){ if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
Unit on = selectedUnit(); Unit on = selectedUnit();
var build = selectedControlBuild(); 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()); updateMovement(player.unit());
if(Core.input.keyTap(Binding.respawn)){ 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; cursorType = SystemCursor.arrow;
return; return;
} }

View File

@@ -50,6 +50,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public final OverlayFragment frag = new OverlayFragment(); 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 Interval controlInterval = new Interval();
public @Nullable Block block; public @Nullable Block block;
public boolean overrideLineRotation; 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(){ public Eachable<BuildPlan> allRequests(){
return cons -> { return cons -> {
for(BuildPlan request : player.unit().plans()) cons.get(request); 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()); 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; wasShooting = player.shooting;
//only reset the controlled type and control a unit after the timer runs out //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){ 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()){ for(BuildPlan req : player.unit().plans()){
if(req != ignore if(req != ignore
&& !req.breaking && !req.breaking

View File

@@ -435,7 +435,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){ public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){
if(state.isMenu()) return false; if(state.isMenu() || locked()) return false;
down = true; down = true;
@@ -515,7 +515,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean longPress(float x, float y){ 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 //get tile on cursor
Tile cursor = tileAt(x, y); Tile cursor = tileAt(x, y);
@@ -575,7 +575,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean tap(float x, float y, int count, KeyCode button){ 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; 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(){ public void update(){
super.update(); super.update();
boolean locked = locked();
if(player.dead()){ if(player.dead()){
mode = none; mode = none;
manualShooting = false; manualShooting = false;
@@ -661,11 +663,11 @@ public class MobileInput extends InputHandler implements GestureListener{
} }
//zoom camera //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)); renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
} }
if(!Core.settings.getBool("keyboard")){ if(!Core.settings.getBool("keyboard") && !locked){
//move camera around //move camera around
float camSpeed = 6f; 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)); 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()); updateMovement(player.unit());
} }
@@ -791,7 +793,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean pan(float x, float y, float deltaX, float deltaY){ 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(); float scale = Core.camera.width / Core.graphics.getWidth();
deltaX *= scale; deltaX *= scale;

View File

@@ -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 //create water pathway if the map is flooded
if(naval){ if(naval){

View File

@@ -68,20 +68,34 @@ public class Menus{
ui.showText("", message); 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){ public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){
if(message == null) return; if(message == null) return;
ui.showInfoPopup(message, duration, align, top, left, bottom, right); 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){ public static void label(String message, float duration, float worldx, float worldy){
if(message == null) return; if(message == null) return;
ui.showLabel(message, duration, worldx, worldy); 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) @Remote(variants = Variant.both)
public static void infoToast(String message, float duration){ public static void infoToast(String message, float duration){
if(message == null) return; if(message == null) return;

View File

@@ -149,6 +149,7 @@ public class ChatFragment extends Table{
if(i - scrollPos == 0) theight -= textspacing + 1; if(i - scrollPos == 0) theight -= textspacing + 1;
font.getCache().clear(); font.getCache().clear();
font.getCache().setColor(Color.white);
font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
if(!shown && fadetime - i < 1f && fadetime - i >= 0f){ if(!shown && fadetime - i < 1f && fadetime - i >= 0f){

View File

@@ -133,6 +133,7 @@ public class ScriptConsoleFragment extends Table{
if(i - scrollPos == 0) theight -= textspacing + 1; if(i - scrollPos == 0) theight -= textspacing + 1;
font.getCache().clear(); font.getCache().clear();
font.getCache().setColor(Color.white);
font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
if(!open){ if(!open){

View File

@@ -40,7 +40,7 @@ public class SolidPump extends Pump{
drawPotentialLinks(x, y); drawPotentialLinks(x, y);
if(attribute != null){ 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(){ public void setBars(){
super.setBars(); super.setBars();
bars.add("efficiency", (SolidPumpBuild entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed", bars.add("efficiency", (SolidPumpBuild entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed",
entity.lastPump / Time.delta * 60, 1), entity.lastPump * 60, 1),
() -> Pal.ammo, () -> Pal.ammo,
() -> entity.warmup * entity.efficiency())); () -> entity.warmup * entity.efficiency()));
} }
@@ -92,7 +92,6 @@ public class SolidPump extends Pump{
public float validTiles; public float validTiles;
public float lastPump; public float lastPump;
@Override @Override
public void drawCracks(){} public void drawCracks(){}
@@ -118,7 +117,7 @@ public class SolidPump extends Pump{
if(cons.valid() && typeLiquid() < liquidCapacity - 0.001f){ if(cons.valid() && typeLiquid() < liquidCapacity - 0.001f){
float maxPump = Math.min(liquidCapacity - typeLiquid(), pumpAmount * delta() * fraction * efficiency()); float maxPump = Math.min(liquidCapacity - typeLiquid(), pumpAmount * delta() * fraction * efficiency());
liquids.add(result, maxPump); liquids.add(result, maxPump);
lastPump = maxPump; lastPump = maxPump / Time.delta;
warmup = Mathf.lerpDelta(warmup, 1f, 0.02f); warmup = Mathf.lerpDelta(warmup, 1f, 0.02f);
if(Mathf.chance(delta() * updateEffectChance)) if(Mathf.chance(delta() * updateEffectChance))
updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f)); updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f));

View File

@@ -24,4 +24,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
archash=159f05aff28e1f4edf6214f225aef2d63c4c37a6 archash=ea2d4b8455a8502eeea80795cd2b6d10d8dfe21c

View File

@@ -60,8 +60,8 @@
"address": ["yeeth.mindustry.me:2004","185.86.230.61:25570"] "address": ["yeeth.mindustry.me:2004","185.86.230.61:25570"]
}, },
{ {
"name": "md.obvilionnetwork.ru", "name": "Obvilion Network",
"address": ["obvilionnetwork.ru", "obvilionnetwork.ru:7001", "obvilionnetwork.ru:7002", "obvilionnetwork.ru:7003"] "address": ["obvilion.ru", "obvilion.ru:7001", "obvilion.ru:7002", "obvilion.ru:7003"]
}, },
{ {
"name": "Mindustry PLAY", "name": "Mindustry PLAY",

View File

@@ -33,7 +33,7 @@
}, },
{ {
"name": "Obvilion Network", "name": "Obvilion Network",
"address": ["obvilionnetwork.ru:7004", "obvilionnetwork.ru:7005"] "address": ["obvilion.ru:7004", "obvilion.ru:7005"]
}, },
{ {
"name": "io", "name": "io",