From a6f2aa6c4325931395f255c4813f3d1acbeaf740 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 29 Jan 2024 15:17:49 -0500 Subject: [PATCH 001/114] Marker control cleanup --- core/src/mindustry/game/MapObjectives.java | 33 +++++++++------------- gradle.properties | 2 +- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/core/src/mindustry/game/MapObjectives.java b/core/src/mindustry/game/MapObjectives.java index dd64aa9106..f88607419a 100644 --- a/core/src/mindustry/game/MapObjectives.java +++ b/core/src/mindustry/game/MapObjectives.java @@ -703,19 +703,17 @@ public class MapObjectives implements Iterable, Eachable, Eachable fontSize = (float)p1; @@ -801,7 +801,6 @@ public class MapObjectives implements Iterable, Eachable rotation = (float)p1; case color -> color.set(Tmp.c1.fromDouble(p1)); case shape -> sides = (int)p1; - default -> super.control(type, p1, p2, p3); } } @@ -814,7 +813,6 @@ public class MapObjectives implements Iterable, Eachable super.control(type, p1, p2, p3); } } } @@ -881,6 +879,8 @@ public class MapObjectives implements Iterable, Eachable pos.x = (int)p1; @@ -888,15 +888,12 @@ public class MapObjectives implements Iterable, Eachable stroke = (float)p1; case color -> color.set(Tmp.c1.fromDouble(p1)); case minimap -> minimap = true; - default -> super.control(type, p1, p2, p3); } } if(!Double.isNaN(p2)){ if(type == LMarkerControl.pos){ pos.y = (int)p2; - }else{ - super.control(type, p1, p2, p3); } } } @@ -945,6 +942,8 @@ public class MapObjectives implements Iterable, Eachable radius = (float)p1; @@ -952,22 +951,18 @@ public class MapObjectives implements Iterable, Eachable rotation = (float)p1; case color -> color.set(Tmp.c1.fromDouble(p1)); case shape -> sides = (int)p1; - default -> super.control(type, p1, p2, p3); } } if(!Double.isNaN(p2)){ switch(type){ case shape -> fill = !Mathf.equal((float)p2, 0f); - default -> super.control(type, p1, p2, p3); } } if(!Double.isNaN(p3)){ if(type == LMarkerControl.shape){ outline = !Mathf.equal((float)p3, 0f); - }else{ - super.control(type, p1, p2, p3); } } } @@ -1009,6 +1004,8 @@ public class MapObjectives implements Iterable, Eachable fontSize = (float)p1; @@ -1019,7 +1016,6 @@ public class MapObjectives implements Iterable, Eachable super.control(type, p1, p2, p3); } } @@ -1032,7 +1028,6 @@ public class MapObjectives implements Iterable, Eachable super.control(type, p1, p2, p3); } } } @@ -1093,19 +1088,19 @@ public class MapObjectives implements Iterable, Eachable endPos.x = (float)p1 * tilesize; case stroke -> stroke = (float)p1; case color -> color.set(Tmp.c1.fromDouble(p1)); - default -> super.control(type, p1, p2, p3); } } if(!Double.isNaN(p2)){ switch(type){ case endPos -> endPos.y = (float)p2 * tilesize; - default -> super.control(type, p1, p2, p3); } } } @@ -1135,19 +1130,19 @@ public class MapObjectives implements Iterable, Eachable rotation = (float)p1; case textureSize -> width = (float)p1 * tilesize; case color -> color.set(Tmp.c1.fromDouble(p1)); - default -> super.control(type, p1, p2, p3); } } if(!Double.isNaN(p2)){ switch(type){ case textureSize -> height = (float)p2 * tilesize; - default -> super.control(type, p1, p2, p3); } } } diff --git a/gradle.properties b/gradle.properties index 3d72e86dff..00ed2b3ae2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=008e73aa33 +archash=7a2f8eada1 From b7485b5bc4e444438001b17f658a7ba8b698bb76 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 29 Jan 2024 22:45:22 -0500 Subject: [PATCH 002/114] Join dialog performance improvement --- core/src/mindustry/ui/dialogs/JoinDialog.java | 11 +++++++++++ gradle.properties | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ui/dialogs/JoinDialog.java b/core/src/mindustry/ui/dialogs/JoinDialog.java index 3b826c3c79..115cdd32c8 100644 --- a/core/src/mindustry/ui/dialogs/JoinDialog.java +++ b/core/src/mindustry/ui/dialogs/JoinDialog.java @@ -1,6 +1,7 @@ package mindustry.ui.dialogs; import arc.*; +import arc.freetype.FreeTypeFontGenerator.*; import arc.graphics.*; import arc.input.*; import arc.math.*; @@ -35,6 +36,7 @@ public class JoinDialog extends BaseDialog{ int refreshes; boolean showHidden; TextButtonStyle style; + Task fontIgnoreDirtyTask; String lastIp; int lastPort, lastColumns = -1; @@ -413,6 +415,15 @@ public class JoinDialog extends BaseDialog{ net.pingHost(resaddress, resport, res -> { if(refreshes != cur) return; + //don't recache the texture for a while + if(fontIgnoreDirtyTask == null){ + FreeTypeFontData.ignoreDirty = true; + fontIgnoreDirtyTask = Time.runTask(60f, () -> { + FreeTypeFontData.ignoreDirty = false; + fontIgnoreDirtyTask = null; + }); + } + if(!serverSearch.isEmpty() && !(group.name.toLowerCase().contains(serverSearch) || res.name.toLowerCase().contains(serverSearch) || res.description.toLowerCase().contains(serverSearch) diff --git a/gradle.properties b/gradle.properties index 00ed2b3ae2..bacb7e3213 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=7a2f8eada1 +archash=5bbfaf2ad9 From 4e35ae2dec4388183984e4e919e5592409d5cc57 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 29 Jan 2024 23:04:12 -0500 Subject: [PATCH 003/114] Minor font cache delay tweak --- core/src/mindustry/ui/dialogs/JoinDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/ui/dialogs/JoinDialog.java b/core/src/mindustry/ui/dialogs/JoinDialog.java index 115cdd32c8..3c3fd58ba4 100644 --- a/core/src/mindustry/ui/dialogs/JoinDialog.java +++ b/core/src/mindustry/ui/dialogs/JoinDialog.java @@ -418,7 +418,7 @@ public class JoinDialog extends BaseDialog{ //don't recache the texture for a while if(fontIgnoreDirtyTask == null){ FreeTypeFontData.ignoreDirty = true; - fontIgnoreDirtyTask = Time.runTask(60f, () -> { + fontIgnoreDirtyTask = Time.runTask(0.6f * 60f, () -> { FreeTypeFontData.ignoreDirty = false; fontIgnoreDirtyTask = null; }); From cc0ac1523beba2b525392aff64144c38d18b0fa1 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 30 Jan 2024 07:45:38 -0800 Subject: [PATCH 004/114] SoundEffect's sound should be delayed by its startDelay (#9502) * SoundEffect's sound should be delayed by its startDelay * h --- .../mindustry/entities/effect/SoundEffect.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/effect/SoundEffect.java b/core/src/mindustry/entities/effect/SoundEffect.java index 8ed0f74a20..c3d320d527 100644 --- a/core/src/mindustry/entities/effect/SoundEffect.java +++ b/core/src/mindustry/entities/effect/SoundEffect.java @@ -21,18 +21,32 @@ public class SoundEffect extends Effect{ public Effect effect; public SoundEffect(){ + startDelay = -1; } public SoundEffect(Sound sound, Effect effect){ + this(); this.sound = sound; this.effect = effect; } + @Override + public void init(){ + if(startDelay < 0){ + startDelay = effect.startDelay; + } + } + @Override public void create(float x, float y, float rotation, Color color, Object data){ if(!shouldCreate()) return; - sound.at(x, y, Mathf.random(minPitch, maxPitch), Mathf.random(minVolume, maxVolume)); + if(startDelay > 0){ + Time.run(startDelay, () -> sound.at(x, y, Mathf.random(minPitch, maxPitch), Mathf.random(minVolume, maxVolume))); + }else{ + sound.at(x, y, Mathf.random(minPitch, maxPitch), Mathf.random(minVolume, maxVolume)); + } + effect.create(x, y, rotation, color, data); } } From 994ed5a87200b663bf3f4dd6c0226eb1854abaae Mon Sep 17 00:00:00 2001 From: abcxyzDustry <138785336+abcxyzDustry@users.noreply.github.com> Date: Wed, 31 Jan 2024 01:05:50 +0700 Subject: [PATCH 005/114] I want to delete some unused IPs and IPs that overlap with the eradication server (#9504) --- servers_v7.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers_v7.json b/servers_v7.json index 4e5c27d47b..f7da7e20f1 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -230,7 +230,7 @@ }, { "name": "ABCXYZ Community", - "address": ["23.88.73.88:23591", "23.88.73.88:23539", "144.76.57.59:14996", "144.76.57.59:16881", "144.76.57.59:13885", "23.88.73.88:32113", "144.76.57.59:9269", "144.76.57.59:24235", "144.76.57.59:24133", "140.238.246.78:7000", "5.9.8.124:28848", "free2.titaniumhost.tech:25669"] + "address": ["23.88.73.88:23591", "23.88.73.88:23539", "144.76.57.59:14996", "144.76.57.59:16881", "144.76.57.59:13885", "23.88.73.88:32113", "144.76.57.59:9269", "144.76.57.59:24235", "144.76.57.59:24133", "5.9.8.124:28848"] }, { "name": "CroCraft Network", From 6a429184aafa2097d8aaa8b5f2e777752f365acd Mon Sep 17 00:00:00 2001 From: Redstonneur1256 <29004178+Redstonneur1256@users.noreply.github.com> Date: Wed, 31 Jan 2024 01:35:39 +0100 Subject: [PATCH 006/114] update markers (#9506) * update markers * update markers & minimap rendering --- core/assets/bundles/bundle.properties | 6 +- core/src/mindustry/core/Renderer.java | 10 +- .../mindustry/editor/MapObjectivesDialog.java | 46 ++- core/src/mindustry/game/MapObjectives.java | 290 +++++++++++------- .../mindustry/graphics/MinimapRenderer.java | 92 +++--- core/src/mindustry/logic/LMarkerControl.java | 7 +- core/src/mindustry/logic/LStatements.java | 19 +- 7 files changed, 290 insertions(+), 180 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a0aea04348..b8a1089fe3 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -682,10 +682,11 @@ objective.commandmode.name = Command Mode objective.flag.name = Flag marker.shapetext.name = Shape Text -marker.minimap.name = Minimap +marker.point.name = Point marker.shape.name = Shape marker.text.name = Text marker.line.name = Line +marker.quad.name = Quad marker.background = Background marker.outline = Outline @@ -2485,3 +2486,6 @@ lenum.flushtext = Flush print buffer's content to marker, if applicable.\nIf fet lenum.texture = Texture name straight from game's texture atlas (using kebab-case naming style).\nIf printFlush is set to true, consumes text buffer content as text argument. lenum.texturesize = Size of texture in tiles. Zero value scales marker width to original texture's size. lenum.autoscale = Whether to scale marker corresponding to player's zoom level. +lenum.posi = Indexed position, used for line and quad markers with index zero being the first position. +lenum.uvi = Texture's position ranging from zero to one, used for quad markers. +lenum.colori = Indexed position, used for line and quad markers with index zero being the first color. diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 13b1ead08f..7b7d1dc155 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -372,18 +372,20 @@ public class Renderer implements ApplicationListener{ }); } + float scaleFactor = 4f / renderer.getDisplayScale(); + //draw objective markers state.rules.objectives.eachRunning(obj -> { for(var marker : obj.markers){ - if(!marker.minimap){ - marker.drawWorld(); + if(marker.world){ + marker.draw(marker.autoscale ? scaleFactor : 1); } } }); for(var marker : state.markers){ - if(!marker.isHidden() && !marker.minimap){ - marker.drawWorld(); + if(marker.world){ + marker.draw(marker.autoscale ? scaleFactor : 1); } } diff --git a/core/src/mindustry/editor/MapObjectivesDialog.java b/core/src/mindustry/editor/MapObjectivesDialog.java index 5e354a84ae..ecdc53e01e 100644 --- a/core/src/mindustry/editor/MapObjectivesDialog.java +++ b/core/src/mindustry/editor/MapObjectivesDialog.java @@ -246,6 +246,38 @@ public class MapObjectivesDialog extends BaseDialog{ show(); }}); + setInterpreter(Vertices.class, float[].class, (cont, name, type, field, remover, indexer, get, set) -> cont.table(main -> { + float[] data = get.get(); + + name(cont, name, remover, indexer); + cont.table(t -> { + t.left().defaults().left(); + + String[] names = {"x", "y", "color", "u", "v"}; + int stride = 6; + int vertices = data.length / stride; + + for(int i = 0; i < vertices; i++){ + int offset = i * stride; + + t.table(row -> { + for(int j = 0; j < names.length; j++){ + int index = offset + j; + + if("color".equals(names[j])) { + getInterpreter(Color.class).build(row, names[j], new TypeInfo(Color.class), null, null, null, () -> new Color().abgr8888(data[index]), value -> data[index] = value.toFloatBits()); + }else{ + float scale = j <= 1 ? tilesize : 1; + getInterpreter(float.class).build(row, names[j], new TypeInfo(float.class), null, null, null, () -> data[index] / scale, value -> data[index] = value * scale); + } + + row.add().pad(4); + } + }).row(); + } + }); + })); + // Types that use the default interpreter. It would be nice if all types could use it, but I don't know how to reliably prevent classes like [? extends Content] from using it. for(var obj : MapObjectives.allObjectiveTypes) setInterpreter(obj.get().getClass(), defaultInterpreter()); for(var mark : MapObjectives.allMarkerTypes) setInterpreter(mark.get().getClass(), defaultInterpreter()); @@ -290,10 +322,12 @@ public class MapObjectivesDialog extends BaseDialog{ t.button(Icon.downOpen, Styles.emptyi, () -> indexer.get(false)).fill().padRight(4f); } - t.button(Icon.add, Styles.emptyi, () -> getProvider(type.element.raw).get(type.element, res -> { - arr.add(res); - rebuild[0].run(); - })).fill(); + if(!field.isAnnotationPresent(Immutable.class)) { + t.button(Icon.add, Styles.emptyi, () -> getProvider(type.element.raw).get(type.element, res -> { + arr.add(res); + rebuild[0].run(); + })).fill(); + } }).growX().height(46f).pad(0f, -10f, 0f, -10f).get(); main.row().table(Tex.button, t -> rebuild[0] = () -> { @@ -312,10 +346,10 @@ public class MapObjectivesDialog extends BaseDialog{ getInterpreter((Class)arr.get(index).getClass()).build( t, "", new TypeInfo(arr.get(index).getClass()), - field, () -> { + field, field == null || !field.isAnnotationPresent(Immutable.class) ? () -> { arr.remove(index); rebuild[0].run(); - }, field == null || !field.isAnnotationPresent(Unordered.class) ? in -> { + } : null, field == null || !field.isAnnotationPresent(Unordered.class) ? in -> { if(in && index > 0){ arr.swap(index, index - 1); rebuild[0].run(); diff --git a/core/src/mindustry/game/MapObjectives.java b/core/src/mindustry/game/MapObjectives.java index f88607419a..466068c4eb 100644 --- a/core/src/mindustry/game/MapObjectives.java +++ b/core/src/mindustry/game/MapObjectives.java @@ -61,12 +61,15 @@ public class MapObjectives implements Iterable, Eachable, Eachable prov) { + Class type = prov.get().getClass(); + + markerNameToType.put(name, prov); + markerNameToType.put(Strings.camelize(name), prov); + JsonIO.classTag(Strings.camelize(name), type); + JsonIO.classTag(name, type); + } + /** Adds all given objectives to the executor as root objectives. */ public void add(MapObjective... objectives){ for(var objective : objectives) flatten(objective); @@ -617,38 +629,26 @@ public class MapObjectives implements Iterable, Eachable