Compare commits

..

10 Commits
v145 ... v145.1

Author SHA1 Message Date
Anuken
c7181999b2 Pathfinding improvements 2023-06-19 17:21:21 -04:00
Anuken
974d19fb75 Fixed #8729 2023-06-19 13:50:33 -04:00
Anuken
f4dcd37be3 Conduit padCorners fix 2023-06-19 10:56:30 -04:00
Anuken
014750fa97 Merge remote-tracking branch 'origin/master' 2023-06-19 10:28:59 -04:00
Anuken
5c178c20a1 Conduit padCorners 2023-06-19 10:28:54 -04:00
Даркнесс#3729
3762ee6313 Fix invalid heal targeting for non-sharded teams (#8728) 2023-06-19 09:10:33 -04:00
RTOmega
4289450a4d Fixed Grammar Error on TR Bundle (#8727) 2023-06-18 16:46:01 -04:00
Anuken
509a6a28b5 . 2023-06-18 09:08:09 -04:00
Anuken
54d7f3e17c Fixed #8718 2023-06-18 09:06:52 -04:00
Anuken
7e23272668 Do not crash when reading null planets 2023-06-17 20:39:52 -04:00
13 changed files with 57 additions and 21 deletions

View File

@@ -1662,7 +1662,7 @@ block.electric-heater.name = Elektrikli Isıtıcı
block.slag-heater.name = Cürüflü Isıtıcı block.slag-heater.name = Cürüflü Isıtıcı
block.phase-heater.name = Faz Isıtıcı block.phase-heater.name = Faz Isıtıcı
block.heat-redirector.name = Isı Aktarıcı block.heat-redirector.name = Isı Aktarıcı
block.heat-router.name = Isı Yönelndirici block.heat-router.name = Isı Yönlendirici
block.slag-incinerator.name = Cürüf Yakıcı block.slag-incinerator.name = Cürüf Yakıcı
block.carbide-crucible.name = Karbür Kazanı block.carbide-crucible.name = Karbür Kazanı
block.slag-centrifuge.name = Cürüf Sentrifüjü block.slag-centrifuge.name = Cürüf Sentrifüjü
@@ -1698,7 +1698,7 @@ block.reinforced-pump.name = Güçlendirilmiş Pompa
block.reinforced-conduit.name = Güçlendirilmiş Boru block.reinforced-conduit.name = Güçlendirilmiş Boru
block.reinforced-liquid-junction.name = Güçlendirilmiş Sıvı Kavşağı block.reinforced-liquid-junction.name = Güçlendirilmiş Sıvı Kavşağı
block.reinforced-bridge-conduit.name = Güçlendirilmiş Köprü Borusu block.reinforced-bridge-conduit.name = Güçlendirilmiş Köprü Borusu
block.reinforced-liquid-router.name = Güçlendirilmiş Sıvı Yönelndirici block.reinforced-liquid-router.name = Güçlendirilmiş Sıvı Yönlendirici
block.reinforced-liquid-container.name = Güçlendirilmiş Sıvı Konteyneri block.reinforced-liquid-container.name = Güçlendirilmiş Sıvı Konteyneri
block.reinforced-liquid-tank.name = Güçlendirilmiş Sıvı Tankı block.reinforced-liquid-tank.name = Güçlendirilmiş Sıvı Tankı
block.beam-node.name = ın Noktası block.beam-node.name = ın Noktası

Binary file not shown.

View File

@@ -7,6 +7,7 @@ import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
@@ -50,7 +51,8 @@ public class ControlPathfinder{
costLegs = (team, tile) -> costLegs = (team, tile) ->
PathTile.legSolid(tile) ? impassable : 1 + PathTile.legSolid(tile) ? impassable : 1 +
(PathTile.deep(tile) ? 6000 : 0), (PathTile.deep(tile) ? 6000 : 0) +
(PathTile.nearLegSolid(tile) ? 3 : 0),
costNaval = (team, tile) -> costNaval = (team, tile) ->
//impassable same-team neutral block, or non-liquid //impassable same-team neutral block, or non-liquid
@@ -231,11 +233,11 @@ public class ControlPathfinder{
req.curId = pathId; req.curId = pathId;
//check for the unit getting stuck every N seconds //check for the unit getting stuck every N seconds
if((req.stuckTimer += Time.delta) >= 60f * 2.5f){ if((req.stuckTimer += Time.delta) >= 60f * 1.5f){
req.stuckTimer = 0f; req.stuckTimer = 0f;
//force recalculate //force recalculate
if(req.lastPos.within(unit, 1.5f)){ if(req.lastPos.within(unit, 1.5f)){
req.lastWorldUpdate = -1; req.forceRecalculate();
} }
req.lastPos.set(unit); req.lastPos.set(unit);
} }
@@ -279,6 +281,18 @@ public class ControlPathfinder{
Tile tile = tile(items[req.rayPathIndex]); Tile tile = tile(items[req.rayPathIndex]);
out.set(tile); out.set(tile);
if(req.rayPathIndex > 0){
float angleToNext = tile(items[req.rayPathIndex - 1]).angleTo(tile);
float angleToDest = unit.angleTo(tile);
//force recalculate when the unit moves backwards
if(Angles.angleDist(angleToNext, angleToDest) > 80f && !unit.within(tile, 1f)){
if(showDebug){
Fx.placeBlock.at(unit, 1f);
}
req.forceRecalculate();
}
}
if(unit.within(tile, range)){ if(unit.within(tile, range)){
req.pathIndex = req.rayPathIndex = Math.max(req.pathIndex, req.rayPathIndex + 1); req.pathIndex = req.rayPathIndex = Math.max(req.pathIndex, req.rayPathIndex + 1);
} }
@@ -481,6 +495,7 @@ public class ControlPathfinder{
volatile PathCost cost; volatile PathCost cost;
volatile int team; volatile int team;
volatile int lastWorldUpdate; volatile int lastWorldUpdate;
volatile boolean forcedRecalc;
final Vec2 lastPos = new Vec2(); final Vec2 lastPos = new Vec2();
float stuckTimer = 0f; float stuckTimer = 0f;
@@ -505,6 +520,7 @@ public class ControlPathfinder{
long lastUpdateId; long lastUpdateId;
long lastTime; long lastTime;
long forceRecalcTime;
volatile int lastId, curId; volatile int lastId, curId;
@@ -512,6 +528,13 @@ public class ControlPathfinder{
this.thread = thread; this.thread = thread;
} }
public void forceRecalculate(){
//keep it at 3 times/sec
if(Time.timeSinceMillis(forceRecalcTime) < 1000 / 3) return;
forcedRecalc = true;
forceRecalcTime = Time.millis();
}
void update(long maxUpdateNs){ void update(long maxUpdateNs){
if(curId != lastId){ if(curId != lastId){
clear(true); clear(true);
@@ -519,9 +542,10 @@ public class ControlPathfinder{
lastId = curId; lastId = curId;
//re-do everything when world updates, but keep the old path around //re-do everything when world updates, but keep the old path around
if(Time.timeSinceMillis(lastTime) > 1000 * 3 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f))){ if(forcedRecalc || (Time.timeSinceMillis(lastTime) > 1000 * 3 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f)))){
lastTime = Time.millis(); lastTime = Time.millis();
lastWorldUpdate = worldUpdateId; lastWorldUpdate = worldUpdateId;
forcedRecalc = false;
clear(false); clear(false);
} }

View File

@@ -6,7 +6,6 @@ import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
@@ -153,7 +152,7 @@ public class Pathfinder implements Runnable{
/** Packs a tile into its internal representation. */ /** Packs a tile into its internal representation. */
public int packTile(Tile tile){ public int packTile(Tile tile){
boolean nearLiquid = false, nearSolid = false, nearGround = false, solid = tile.solid(), allDeep = tile.floor().isDeep(); boolean nearLiquid = false, nearSolid = false, nearLegSolid = false, nearGround = false, solid = tile.solid(), allDeep = tile.floor().isDeep();
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
Tile other = tile.nearby(i); Tile other = tile.nearby(i);
@@ -165,6 +164,7 @@ public class Pathfinder implements Runnable{
if(osolid && !other.block().teamPassable) nearSolid = true; if(osolid && !other.block().teamPassable) nearSolid = true;
if(!floor.isLiquid) nearGround = true; if(!floor.isLiquid) nearGround = true;
if(!floor.isDeep()) allDeep = false; if(!floor.isDeep()) allDeep = false;
if(other.legSolid()) nearLegSolid = true;
//other tile is now near solid //other tile is now near solid
if(solid && !tile.block().teamPassable){ if(solid && !tile.block().teamPassable){
@@ -180,10 +180,11 @@ public class Pathfinder implements Runnable{
tid == 0 && tile.build != null && state.rules.coreCapture ? 255 : tid, //use teamid = 255 when core capture is enabled to mark out derelict structures tid == 0 && tile.build != null && state.rules.coreCapture ? 255 : tid, //use teamid = 255 when core capture is enabled to mark out derelict structures
solid, solid,
tile.floor().isLiquid, tile.floor().isLiquid,
tile.staticDarkness() >= 2 || (tile.floor().solid && tile.block() == Blocks.air), tile.legSolid(),
nearLiquid, nearLiquid,
nearGround, nearGround,
nearSolid, nearSolid,
nearLegSolid,
tile.floor().isDeep(), tile.floor().isDeep(),
tile.floor().damageTaken > 0.00001f, tile.floor().damageTaken > 0.00001f,
allDeep, allDeep,
@@ -564,6 +565,8 @@ public class Pathfinder implements Runnable{
boolean nearGround; boolean nearGround;
//whether this block is near a solid object //whether this block is near a solid object
boolean nearSolid; boolean nearSolid;
//whether this block is near a block that is solid for legged units
boolean nearLegSolid;
//whether this block is deep / drownable //whether this block is deep / drownable
boolean deep; boolean deep;
//whether the floor damages //whether the floor damages

View File

@@ -106,7 +106,7 @@ public enum EditorTool{
if(tile == null) return; if(tile == null) return;
if(editor.drawBlock.isMultiblock()){ if(editor.drawBlock.isMultiblock() && (mode == 0 || mode == -1)){
//don't fill multiblocks, thanks //don't fill multiblocks, thanks
pencil.touched(x, y); pencil.touched(x, y);
return; return;

View File

@@ -5,7 +5,6 @@ import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.world.*; import mindustry.world.*;
@@ -129,7 +128,7 @@ public class EntityCollisions{
public static boolean legsSolid(int x, int y){ public static boolean legsSolid(int x, int y){
Tile tile = world.tile(x, y); Tile tile = world.tile(x, y);
return tile == null || tile.staticDarkness() >= 2 || (tile.floor().solid && tile.block() == Blocks.air); return tile == null || tile.legSolid();
} }
public static boolean waterSolid(int x, int y){ public static boolean waterSolid(int x, int y){

View File

@@ -37,7 +37,7 @@ public class BuildPlan implements Position, QuadTreeObject{
public BuildPlan(int x, int y, int rotation, Block block){ public BuildPlan(int x, int y, int rotation, Block block){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.rotation = block.planRotation(rotation); if(block != null) this.rotation = block.planRotation(rotation);
this.block = block; this.block = block;
this.breaking = false; this.breaking = false;
} }
@@ -46,7 +46,7 @@ public class BuildPlan implements Position, QuadTreeObject{
public BuildPlan(int x, int y, int rotation, Block block, Object config){ public BuildPlan(int x, int y, int rotation, Block block, Object config){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.rotation = block.planRotation(rotation); if(block != null) this.rotation = block.planRotation(rotation);
this.block = block; this.block = block;
this.breaking = false; this.breaking = false;
this.config = config; this.config = config;
@@ -138,7 +138,7 @@ public class BuildPlan implements Position, QuadTreeObject{
public BuildPlan set(int x, int y, int rotation, Block block){ public BuildPlan set(int x, int y, int rotation, Block block){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.rotation = block.planRotation(rotation); if(block != null) this.rotation = block.planRotation(rotation);
this.block = block; this.block = block;
this.breaking = false; this.breaking = false;
return this; return this;

View File

@@ -178,7 +178,7 @@ public class DesktopInput extends InputHandler{
} }
linePlans.each(this::drawOverPlan); linePlans.each(this::drawOverPlan);
}else if(isPlacing()){ }else if(isPlacing()){
int rot = block.planRotation(rotation); int rot = block == null ? rotation : block.planRotation(rotation);
if(block.rotate && block.drawArrow){ if(block.rotate && block.drawArrow){
drawArrow(block, cursorX, cursorY, rot); drawArrow(block, cursorX, cursorY, rot);
} }

View File

@@ -415,7 +415,7 @@ public class MobileInput extends InputHandler implements GestureListener{
//draw last placed plan //draw last placed plan
if(!plan.breaking && plan == lastPlaced && plan.block != null){ if(!plan.breaking && plan == lastPlaced && plan.block != null){
int rot = block.planRotation(rotation); int rot = plan.block.planRotation(rotation);
boolean valid = validPlace(tile.x, tile.y, plan.block, rot); boolean valid = validPlace(tile.x, tile.y, plan.block, rot);
Draw.mixcol(); Draw.mixcol();
plan.block.drawPlace(tile.x, tile.y, rot, valid); plan.block.drawPlace(tile.x, tile.y, rot, valid);
@@ -1036,7 +1036,7 @@ public class MobileInput extends InputHandler implements GestureListener{
} }
if(allowHealing && target == null){ if(allowHealing && target == null){
target = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded)); target = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(player.team()));
if(target != null && !unit.within(target, range)){ if(target != null && !unit.within(target, range)){
target = null; target = null;
} }

View File

@@ -195,6 +195,9 @@ public class JsonIO{
@Override @Override
public Planet read(Json json, JsonValue jsonData, Class type){ public Planet read(Json json, JsonValue jsonData, Class type){
if(jsonData.asString() == null){
return null;
}
Planet block = Vars.content.getByName(ContentType.planet, jsonData.asString()); Planet block = Vars.content.getByName(ContentType.planet, jsonData.asString());
return block == null ? Planets.serpulo : block; return block == null ? Planets.serpulo : block;
} }

View File

@@ -422,7 +422,7 @@ public class SchematicsDialog extends BaseDialog{
} }
for(ContentType ctype : defaultContentIcons){ for(ContentType ctype : defaultContentIcons){
var all = content.getBy(ctype).<UnlockableContent>as().filter(u -> !u.isHidden() && u.unlockedNow() && u.hasEmoji()); var all = content.getBy(ctype).<UnlockableContent>as().select(u -> !u.isHidden() && u.unlockedNow() && u.hasEmoji());
t.row(); t.row();
if(all.count(u -> !tags.contains(u.emoji())) > 0) t.image().colspan(cols).growX().width(Float.NEGATIVE_INFINITY).height(3f).color(Pal.accent); if(all.count(u -> !tags.contains(u.emoji())) > 0) t.image().colspan(cols).growX().width(Float.NEGATIVE_INFINITY).height(3f).color(Pal.accent);

View File

@@ -547,6 +547,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
return block.solid && block.fillsTile && !block.synthetic() ? data : 0; return block.solid && block.fillsTile && !block.synthetic() ? data : 0;
} }
/** @return whether this tile is solid for legged units */
public boolean legSolid(){
return staticDarkness() >= 2 || (floor.solid && block == Blocks.air);
}
/** @return true if these tiles are right next to each other. */ /** @return true if these tiles are right next to each other. */
public boolean adjacentTo(Tile tile){ public boolean adjacentTo(Tile tile){
return relativeTo(tile) != -1; return relativeTo(tile) != -1;

View File

@@ -38,6 +38,8 @@ public class Conduit extends LiquidBlock implements Autotiler{
/** indices: [rotation] [fluid type] [frame] */ /** indices: [rotation] [fluid type] [frame] */
public TextureRegion[][][] rotateRegions; public TextureRegion[][][] rotateRegions;
/** If true, the liquid region is padded at corners, so it doesn't stick out. */
public boolean padCorners = true;
public boolean leaks = true; public boolean leaks = true;
public @Nullable Block junctionReplacement, bridgeReplacement, rotBridgeReplacement; public @Nullable Block junctionReplacement, bridgeReplacement, rotBridgeReplacement;
@@ -186,9 +188,9 @@ public class Conduit extends LiquidBlock implements Autotiler{
int gas = liquids.current().gas ? 1 : 0; int gas = liquids.current().gas ? 1 : 0;
float ox = 0f, oy = 0f; float ox = 0f, oy = 0f;
int wrapRot = (rotation + offset) % 4; int wrapRot = (rotation + offset) % 4;
TextureRegion liquidr = bits == 1 ? rotateRegions[wrapRot][gas][frame] : renderer.fluidFrames[gas][frame]; TextureRegion liquidr = bits == 1 && padCorners ? rotateRegions[wrapRot][gas][frame] : renderer.fluidFrames[gas][frame];
if(bits == 1){ if(bits == 1 && padCorners){
ox = rotateOffsets[wrapRot][0]; ox = rotateOffsets[wrapRot][0];
oy = rotateOffsets[wrapRot][1]; oy = rotateOffsets[wrapRot][1];
} }