From 94fe92d67d04ab6f41ebb922222d8d8d4f4fab38 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 20 May 2023 10:40:33 -0400 Subject: [PATCH] Pathfinder fixes / Hail resprite by Snake#2132 on Discord --- core/assets-raw/sprites/blocks/turrets/hail.png | Bin 349 -> 463 bytes core/src/mindustry/ai/ControlPathfinder.java | 5 ++++- core/src/mindustry/ai/Pathfinder.java | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/assets-raw/sprites/blocks/turrets/hail.png b/core/assets-raw/sprites/blocks/turrets/hail.png index 10001df6ed56267146c29776bed5c20c99b34b3d..aa7a70ac87693fa0a58ec15fd51d2490d854c744 100644 GIT binary patch delta 437 zcmcc1be?&FN_~x|i(^Q|oVV9DW-&PmusyKdAn;C>>E&8J#e|6=FE3}W-MaCV@RB`I zxy5@|24^~ObWGjX@V;O|-s3qvZ{EH=dv1-PV}XO;_0s?T`Q;lH{@W=Pe!!LKQeF7t z&*z+fThv{bbxUWT@vy8mb>%cAmxhuJ{N|5k1A|zk4gTMG@%6TLy=33i=R5lz&uC3x zRG4F|&+?G9rNvu7?_!8w%Jo+fyHMY7ww&EdGGJ@@7BI5J%@qEevOavh6l^d1SR@H+gC7n zJ#6H#p5xSEmRS6K;l6yill7LDFFKUIyZuDQG9mw%tLBj>KQ~BD?-rGQ$S(14(j%ok z4HF7Do$hobTwL;eAFBY{dv7n6h;!jbbqnWmyXyb| delta 322 zcmX@le3xm0O1+Awi(^Pd+}kOJe1{BpT&w-d)?E%R5IAyW?nd_)H}+1@aC>H2ILXYF z=kF!?16%J43%%WCEPXj%f8XJ?-~VPZ)fCnqURtvz_gLYVs|6etotd+0X1hIbe8Ak# zp`&!c$La9<{^#O0Y6jZ*7sibw5B<%shRim^OLoctQ{)+nyf*L1rMvv*`AxtwdC2Ir+YdN+_S7)&C|I* zQB%QKT~AIokaNScBR2%CJGmN6pa1+M;NbD9TJwGA@teU8hkr;u-I=>lg|FRPr_*C+ e-Lv}7O#kkL)ve#l`-_2rfx*+&&t;ucLK6UEX_hVk diff --git a/core/src/mindustry/ai/ControlPathfinder.java b/core/src/mindustry/ai/ControlPathfinder.java index 7cbfc5eb19..c369f0d986 100644 --- a/core/src/mindustry/ai/ControlPathfinder.java +++ b/core/src/mindustry/ai/ControlPathfinder.java @@ -54,7 +54,10 @@ public class ControlPathfinder{ (PathTile.nearSolid(tile) || PathTile.solid(tile) ? 3 : 0), costNaval = (team, tile) -> - (PathTile.solid(tile) || !PathTile.liquid(tile) ? impassable : 1) + + //impassable same-team neutral block, or non-liquid + ((PathTile.solid(tile) && ((PathTile.team(tile) == team && !PathTile.teamPassable(tile)) || PathTile.team(tile) == 0)) || !PathTile.liquid(tile) ? impassable : 1) + + //impassable synthetic enemy block + ((PathTile.team(tile) != team && PathTile.team(tile) != 0) && PathTile.solid(tile) ? wallImpassableCap : 0) + (PathTile.nearGround(tile) || PathTile.nearSolid(tile) ? 6 : 0); public static boolean showDebug = false; diff --git a/core/src/mindustry/ai/Pathfinder.java b/core/src/mindustry/ai/Pathfinder.java index bffb9031da..ff8bb71534 100644 --- a/core/src/mindustry/ai/Pathfinder.java +++ b/core/src/mindustry/ai/Pathfinder.java @@ -58,7 +58,8 @@ public class Pathfinder implements Runnable{ //water (team, tile) -> - (PathTile.solid(tile) || !PathTile.liquid(tile) ? 6000 : 1) + + (!PathTile.liquid(tile) ? 6000 : 1) + + PathTile.health(tile) * 5 + (PathTile.nearGround(tile) || PathTile.nearSolid(tile) ? 14 : 0) + (PathTile.deep(tile) ? 0 : 1) + (PathTile.damages(tile) ? 35 : 0) @@ -527,7 +528,9 @@ public class Pathfinder implements Runnable{ } protected boolean passable(int pos){ - return cost.getCost(team.id, pathfinder.tiles[pos]) != impassable; + int amount = cost.getCost(team.id, pathfinder.tiles[pos]); + //edge case: naval reports costs of 6000+ for non-liquids, even though they are not technically passable + return amount != impassable && !(cost == costTypes.get(costNaval) && amount >= 6000); } /** Gets targets to pathfind towards. This must run on the main thread. */