From 95254eef4454bc644df2a9532214deb0afc13360 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 9 May 2022 23:11:52 -0400 Subject: [PATCH] Duct router distribution fixes --- .../blocks/payload/payload-conveyor-top.png | Bin 513 -> 529 bytes .../reinforced-payload-conveyor-top.png | Bin 518 -> 536 bytes .../world/blocks/distribution/DuctRouter.java | 19 ++++++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/assets-raw/sprites/blocks/payload/payload-conveyor-top.png b/core/assets-raw/sprites/blocks/payload/payload-conveyor-top.png index 8ecc636e9e6690c1d7fb2e0a4c3313b23c548009..1ca1586c59e243622d60710dc948be87692a958c 100644 GIT binary patch delta 490 zcmZoQ2Ci(^Q|oVRyQ2elXov_5>%bbM(=i%rv0?$=tOk2wyh)Sf)}KYFLt zgm+RqO#-g1)nnCMVatF3JJxT%*igDU{_Xqo{Z@09PsvQoaF-Lm+N0;EdfDr{-y7Xk zFJtF;EmQsMYPudIc58R|hp9*Jn|>C}dFdR)ZQ5H z<+E@Wt~1_$!V*Xs-R|%@n3mo2k}ZVGELix=;ZQC!Z{e6GAmuE4$7*%ZhBsHnm~dOFML#LjhI2aRS4lpS3jwBdzX%f0Ubnh`0&hu;5NDWbEAQ}eRI)FxLG z#ax;CaaxqlMyU!Q~4N&OE71Z&gC<5 zHnTFO-0W^I<~4HvQ1L6_nMT|Ni4$84wkS?@Ive#TsKPUOz4qmx>ujN1rqv(43*|gl z@tiQeKdn5w!E50r`_KnPJTqP%mfHR&!hP|lOv!#9?Pb>)!@7e`vLGUW;lRSu)!yIi d{)E2{o1UNlO!tNN$?P>Cc~4hAmvv4FO#o63-+2H4 delta 474 zcmV<00VV#C1c3yQF@L*BL_t(|obB8}Zo@DPL{YT|4tj(fp~!`sm4GyLYDXH98sooJ zSL298>d3U+8UO$Q000000000003i1<8*ur${`9|Z-`D9pr%Z*Z5AwLEZgz1lnJU8{ zVrx;|=;B;5mE?=+-d&tarrKvz@R7xzHS--|4QS1$V3kb>Ie!N{JNh+u$yAd6x_E^q zY?JN-_RxgC6H2B*E(ObI zLfJUZrC`xbD1V)Yx)dz3385p&JrO%gm&~rT0Vr;O%YZ#{XwONwAoCGFLz6R~u@Otm z+`^@Zq|8^i7?+UwA1+4+XYOGj6PS4fBgvr5qZrDcaVYOnsOsXk#*JCh%n{t0D9Rkg z&AEci8Qh*enK_FGG$t|?rViv%s8x&K8V~6WWhxCF&{L&Qs~5ku;E|-ufV}c)`LG7K z6sr1F1tI5vm0qlI%9nL?F0Yn}$W)Q;15}H0$pioZ0000000000000(s2g?X3SmeJ@ Q6951J07*qoM6N<$f?7`4QUCw| diff --git a/core/assets-raw/sprites/blocks/payload/reinforced-payload-conveyor-top.png b/core/assets-raw/sprites/blocks/payload/reinforced-payload-conveyor-top.png index 0a4f8fd597e7290613c2c2515c9f48a5bb419af7..5c802b5f1376fe50027decb6f6c091efc87a4ff2 100644 GIT binary patch delta 497 zcmVWds1Un76~-q7ElI`sKZ%{kK@ zc=RoiZgjMqmaeeYzo=BBqviBy2KC+_?>0JGPOsCD(TCI3Mt?`k8F3hJb!0Hw=x8~k zzNIgyHKdD@BYF$k8u{i#%NZf|5Z>dlINmxzWEgtJV{trng1bgX%V|*=Nu=bnI37A- z_#)AYW8DcVKWMf*7RRy^E`K;$ajZH)WnN{E$KqIY!tHxlwBl%Yg39#n8IQ%$>;$p# zY_#HN<*2MO^?&eK9E}|Dxs6E0(a2F*>>lB%I2t+A78@cIMOFji(^Q|oVRzP^O_9=S`)W(yXiElhTJXq)zYHGBqwp6XZio{cM8@N za`owNVPil7Pi8-RYI^o`w~T!JH2b>z7w^v}{rXdX*7B0-XFS3dXf7UTeR6)ou0Dh#H<9^;Sk3%%XIUzq?kyPno*X{pcf? zCp*sP)@z8WE2*b!yuB!>P^qX**Gxl1T`B!V*7?ib!V@3wQ(}|Ob3AEj(=xeOqD}4j z2WK72_LUt^WYiuD6-OmoS?Q)9ZSrwCC+0orpym6BDg0+{9^N)ZJ=Z%>+pFwjbaM8i z4|9xj&dJWW-2C=sb5T{HL$X8P(c|5#M3*LgjF#S@Bod~hiZbJt11;}nV#qC+LN^=s&94XwW^6hA$&-&z##B~-!IZ-9gAq3 P97x#H)z4*}Q$iB}J|Wja diff --git a/core/src/mindustry/world/blocks/distribution/DuctRouter.java b/core/src/mindustry/world/blocks/distribution/DuctRouter.java index 1a52a0db7b..73c5b0f4d0 100644 --- a/core/src/mindustry/world/blocks/distribution/DuctRouter.java +++ b/core/src/mindustry/world/blocks/distribution/DuctRouter.java @@ -1,7 +1,6 @@ package mindustry.world.blocks.distribution; import arc.graphics.g2d.*; -import arc.math.*; import arc.scene.ui.layout.*; import arc.util.*; import arc.util.io.*; @@ -99,8 +98,6 @@ public class DuctRouter extends Block{ var target = target(); if(target != null){ target.handleItem(this, current); - int mod = sortItem != null && current != sortItem ? 2 : 3; - cdump = ((cdump + 1) % mod); items.remove(current, 1); current = null; progress %= (1f - 1f/speed); @@ -124,14 +121,20 @@ public class DuctRouter extends Block{ public Building target(){ if(current == null) return null; - for(int i = -1; i <= 1; i++){ - int dir = Mathf.mod(rotation + (((i + cdump + 1) % 3) - 1), 4); - if(sortItem != null && (current == sortItem) != (dir == rotation)) continue; - Building other = nearby(dir); - if(other != null && other.team == team && other.acceptItem(this, current)){ + int dump = cdump; + + for(int i = 0; i < proximity.size; i++){ + Building other = proximity.get((i + dump) % proximity.size); + int rel = relativeTo(other); + + if(!(sortItem != null && (current == sortItem) != (rel == rotation)) && !(rel == (rotation + 2) % 4) && other.team == team && other.acceptItem(this, current)){ + incrementDump(proximity.size); return other; } + + incrementDump(proximity.size); } + return null; }