From 414d07a8436cd64460a51d4d82497cd373e41de3 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 10 Feb 2022 11:49:55 -0500 Subject: [PATCH] WIP map notification instruction --- .../blocks/turrets/afflict/afflict.png | Bin 2076 -> 2172 bytes core/assets/bundles/bundle.properties | 1 + core/src/mindustry/content/UnitTypes.java | 2 +- core/src/mindustry/core/UI.java | 1 + .../mindustry/entities/part/ShapePart.java | 4 +-- core/src/mindustry/logic/LExecutor.java | 15 ++++++++++++ core/src/mindustry/logic/LStatements.java | 23 ++++++++++++++++++ .../mindustry/ui/fragments/HudFragment.java | 4 +++ 8 files changed, 47 insertions(+), 3 deletions(-) diff --git a/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png b/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png index 8b2c7fd1f81095a4cfd5781b637141ae821dedf9..1ca290067596c0849a7999bac71276d85fdee212 100644 GIT binary patch delta 2147 zcmbOu@JC>RK|P0=r;B4q#hkaXy9;G31z1DV4H%?&8nQQ`@P2- z?!W!Ee&7A4qbGGx~hGe^^`X8Pkj>(;o^-2Q&J7y1k)q;!Fm$p9K-ePPs5l zuCZB@v`nwT(@s`wW3cD}mHGT{C021JOwwmR8?nou)&EBl*MlP$@9=Mk+3+G$xB8Lo zhMG`ghrF$;+C|rN+Gx~FEMqz9ly3Hdd5+h~SIiNq%q!yzmdKn=_pEO??P$ongl~%9 zZ5L)8qed0OrNOpB=Qqgw+jgRV`HXjEw-=pXz$3uDNa~Vwk;>ZKdrV$++z-?qWNlt6 zwku7r$EB`&x$1>l27bXSvlRH=mHiIa{j@bFZ(={|N@0s2wFu!QC;1mDFnFw;p|pW@ z`X8a?YZ4VgOGWm`%#X|zP1ZhMufJ|?M1f_*-Kd7tf{ib3ZWFq5p3RLlxoLXcH6!k) z4yt!=zw5Y~+Q1pP!KfkRl=Yn!fxK-GkK6xWw6DCd_TT5{cNcePCdlOd``?(jz2&U_ z@$@h=Nj2s_Dk&S%GY`iyWExzSI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X-b zg$Z-O`>jij7_SCg&Y7^w`r(llCr#l!|BS?>j8`waQ&s49*yf#l1h?*1w+AVc>brl} z8rlV^w`6VMI%dHzIVs3dDjLGMcQsc2!^hZ}w}p zHNLVd4Il0^DfYU?aOG*}D$b%MRea{cPhQoZ;LTcWk!RR9qT8R36Jznr7Yc6{)A=1jR_~G24*|tM6b-3TYppNKSRLw z={cq<^$9bCor=u!*6F-`v-sv~#(&r6luB!4GQHch{As~~y<%xkg}J{g@Knn>++vYY zW=S;p_Q-kWoy)emo%{-01YArT)69N+dcC2_#z*kf;~c%jmhEEl2}um^J|?~V+H`BW zRmS2#{odcdWrEk<@6g-$HT&)ip*x%z*tr|B%glu zUG(lf*R-@e*UxJwSUj_2mY+3%|YB++$!Ub^4}Y=WviAdj@+wi$>Er z&p(seVpAF%XRYIDczHAX)nAESMh70)x-w^+V_x(9fMM>&dEYaRF?W7)U!=Q3)%RcAl-X(wY=!J1?F zSv)$t4!w=9Z*V9G%dBVB&XHNe6Clj~b$xY@=0xsucP_5|vFqOIsWW~(@l&n#FNr*O zxo%F4Zu<8vybr!z-FRah=xG&iQ6y*UlSp4O=*`8U15EvE9|^ z+Pm%k#gh-1cG{=r8ClF_DVyz?Eq^b@$aY)h1%>}i&W5}KH&PE?Wnf@n@O1TaS?83{ F1OU6D#|Hoa diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 113927a31b..06321bf5e5 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1709,6 +1709,7 @@ lst.setblock = Set tile data at any location. lst.spawnunit = Spawn unit at a location. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.setrule = Set a game rule. +lst.flushnotification = Display a notification at the top of the screen from the text buffer.\nWill wait until the previous message finishes. logic.nounitbuild = [red]Unit building logic is not allowed here. diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 861c4f530e..66bb760fcb 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -2988,7 +2988,7 @@ public class UnitTypes{ abilities.add(new SuppressionFieldAbility(){{ orbRadius = orbRad; particleSize = partRad; - y = -33f / 4f; + y = -32f / 4f; x = 43f * i / 4f; particles = parts; //visual only, the middle one does the actual suppressing diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 48de1685e0..c349be8982 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -325,6 +325,7 @@ public class UI implements ApplicationListener, Loadable{ Core.scene.add(table); } + /** Shows a label at some position on the screen. Does not fade. */ public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){ Table table = new Table(); diff --git a/core/src/mindustry/entities/part/ShapePart.java b/core/src/mindustry/entities/part/ShapePart.java index 0024f43bcd..c2b2427037 100644 --- a/core/src/mindustry/entities/part/ShapePart.java +++ b/core/src/mindustry/entities/part/ShapePart.java @@ -10,7 +10,7 @@ public class ShapePart extends DrawPart{ public int sides = 3; public float radius = 3f, radiusTo = -1f; public float x, y, rotation; - public float moveX, moveY, rotMove; + public float moveX, moveY, moveRot; public Color color = Color.white; public @Nullable Color colorTo; public boolean mirror = false; @@ -47,7 +47,7 @@ public class ShapePart extends DrawPart{ } if(!circle){ - Fill.poly(rx, ry, sides, rad, rotMove * prog * sign + params.rotation - 90); + Fill.poly(rx, ry, sides, rad, moveRot * prog * sign + params.rotation - 90); }else{ Fill.circle(rx, ry, rad); } diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 5fea84b467..b93cc388ff 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1252,5 +1252,20 @@ public class LExecutor{ } } + public static class FlushNotificationI implements LInstruction{ + + @Override + public void run(LExecutor exec){ + //skip back to self until possible + if(ui.hudfrag.hasToast()){ + exec.var(varCounter).numval --; + return; + } + + ui.hudfrag.showToast(Icon.info, exec.textBuffer.toString()); + exec.textBuffer.setLength(0); + } + } + //endregion } diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index d515aaf2f4..8f5d5b894b 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -1271,4 +1271,27 @@ public class LStatements{ return new SetRuleI(rule, builder.var(value)); } } + + @RegisterStatement("notification") + public static class FlushNotificationStatement extends LStatement{ + + @Override + public void build(Table table){ + } + + @Override + public boolean privileged(){ + return true; + } + + @Override + public Color color(){ + return Pal.logicWorld; + } + + @Override + public LInstruction build(LAssembler builder){ + return new FlushNotificationI(); + } + } } diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index d37d5b1c07..d4fde989e5 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -419,6 +419,10 @@ public class HudFragment extends Fragment{ } } + public boolean hasToast(){ + return Time.timeSinceMillis(lastToast) < 3.5f * 1000f; + } + public void showToast(String text){ showToast(Icon.ok, text); }