diff --git a/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png b/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png index 8b2c7fd1f8..1ca2900675 100644 Binary files a/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png and b/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png differ 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); }