Skip to content

Commit ee01e36

Browse files
committed
Stained mountains remake submission / WIP wave graph improvements
1 parent ef4d515 commit ee01e36

File tree

9 files changed

+51
-9
lines changed

9 files changed

+51
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ See [CONTRIBUTING](CONTRIBUTING.md).
1818
Bleeding-edge builds are generated automatically for every commit. You can see them [here](https://github.com/Anuken/MindustryBuilds/releases).
1919

2020
If you'd rather compile on your own, follow these instructions.
21-
First, make sure you have [JDK 16-17](https://adoptium.net/archive.html?variant=openjdk17&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands:
21+
First, make sure you have [JDK 17](https://adoptium.net/archive.html?variant=openjdk17&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands:
2222

2323
### Windows
2424

722 Bytes
Binary file not shown.

core/src/mindustry/Vars.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public class Vars implements Loadable{
145145
"modeSurvival", "commandRally", "commandAttack",
146146
};
147147
/** maximum TCP packet size */
148-
public static final int maxTcpSize = 900;
148+
public static final int maxTcpSize = 1100;
149149
/** default server port */
150150
public static final int port = 6567;
151151
/** multicast discovery port.*/

core/src/mindustry/editor/WaveGraph.java

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package mindustry.editor;
22

3+
import arc.*;
34
import arc.graphics.*;
45
import arc.graphics.g2d.*;
56
import arc.math.*;
7+
import arc.math.geom.*;
68
import arc.scene.ui.*;
79
import arc.scene.ui.layout.*;
810
import arc.struct.*;
@@ -26,12 +28,16 @@ public class WaveGraph extends Table{
2628
private float maxHealth;
2729
private Table colors;
2830
private ObjectSet<UnitType> hidden = new ObjectSet<>();
31+
private StringBuilder countStr = new StringBuilder();
2932

3033
public WaveGraph(){
3134
background(Tex.pane);
3235

3336
rect((x, y, width, height) -> {
3437
Lines.stroke(Scl.scl(3f));
38+
countStr.setLength(0);
39+
40+
Vec2 mouse = stageToLocalCoordinates(Core.input.mouse());
3541

3642
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
3743
Font font = Fonts.outline;
@@ -50,6 +56,8 @@ public WaveGraph(){
5056
float graphX = x + offsetX, graphY = y + offsetY, graphW = width - offsetX, graphH = height - offsetY;
5157
float spacing = graphW / (values.length - 1);
5258

59+
int selcol = Rect.contains(x, y, width, height, mouse.x, mouse.y) ? Mathf.round((mouse.x - graphX) / spacing) : -1;
60+
5361
if(mode == Mode.counts){
5462
for(UnitType type : used.orderedItems()){
5563
Draw.color(color(type));
@@ -97,6 +105,23 @@ public WaveGraph(){
97105
Lines.endLine();
98106
}
99107

108+
109+
if(selcol >= 0 && selcol < values.length){
110+
Draw.color(1f, 0f, 0f, 0.2f);
111+
Fill.crect(selcol * spacing + graphX - spacing/2f, graphY, spacing, graphH);
112+
Draw.color();
113+
font.getData().setScale(1.5f);
114+
for(UnitType type : used.orderedItems()){
115+
int amount = values[Mathf.clamp(selcol, 0, values.length - 1)][type.id];
116+
if(amount > 0){
117+
countStr.append(type.emoji()).append(" ").append(amount).append("\n");
118+
}
119+
}
120+
float pad = Scl.scl(5f);
121+
font.draw(countStr, selcol * spacing + graphX - spacing/2f + pad, graphY + graphH - pad);
122+
font.getData().setScale(1f);
123+
}
124+
100125
//how many numbers can fit here
101126
float totalMarks = Mathf.clamp(maxY, 1, 10);
102127

@@ -123,7 +148,7 @@ public WaveGraph(){
123148
float cy = y + fh, cx = graphX + graphW / (values.length - 1) * i;
124149

125150
Lines.line(cx, cy, cx, cy + len);
126-
if(i == values.length / 2){
151+
if(i == selcol){
127152
font.draw("" + (i + from + 1), cx, cy - Scl.scl(2f), Align.center);
128153
}
129154
}

core/src/mindustry/editor/WaveInfoDialog.java

+14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import arc.input.*;
77
import arc.math.*;
88
import arc.math.geom.*;
9+
import arc.scene.*;
910
import arc.scene.event.*;
1011
import arc.scene.style.*;
1112
import arc.scene.ui.*;
@@ -201,6 +202,19 @@ void setup(){
201202

202203
cont.add(graph = new WaveGraph()).grow();
203204

205+
graph.scrolled((scroll) -> {
206+
view(Mathf.sign(scroll));
207+
});
208+
209+
graph.touchable = Touchable.enabled;
210+
graph.addListener(new InputListener(){
211+
212+
@Override
213+
public void enter(InputEvent event, float x, float y, int pointer, Element fromActor){
214+
graph.requestScroll();
215+
}
216+
});
217+
204218
buildGroups();
205219
}
206220

core/src/mindustry/mod/Mods.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ public ClassLoader mainLoader(){
6262
return mainLoader;
6363
}
6464

65-
/** @return the folder where configuration files for this mod should go. The folder may not exist yet; call mkdirs() before writing to it.
66-
* Call this in init(). */
65+
/** @return the folder where configuration files for this mod should go. Call this in init(). */
6766
public Fi getConfigFolder(Mod mod){
6867
ModMeta load = metas.get(mod.getClass());
6968
if(load == null) throw new IllegalArgumentException("Mod is not loaded yet (or missing)!");
70-
return modDirectory.child(load.name);
69+
Fi result = modDirectory.child(load.name);
70+
result.mkdirs();
71+
return result;
7172
}
7273

7374
/** @return a file named 'config.json' in the config folder for the specified mod.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

server/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){
4747
exclude("icons/icon.ico")
4848
exclude("icons/icon_64.png")
4949

50+
duplicatesStrategy = 'exclude'
51+
5052
manifest{
5153
attributes 'Main-Class': project.mainClassName
5254
}

settings.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
if(JavaVersion.current().ordinal() < JavaVersion.VERSION_16.ordinal()){
2-
throw new Exception("!!! YOU MUST USE JAVA 16 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}")
1+
if(JavaVersion.current().ordinal() < JavaVersion.VERSION_17.ordinal()){
2+
throw new Exception("!!! YOU MUST USE JAVA 17 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}")
33
}
44

55
include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests'

0 commit comments

Comments
 (0)