Skip to content

Commit eed91ea

Browse files
committed
# Conflicts:
# core/src/mindustry/mod/ClassMap.java
1 parent ac11167 commit eed91ea

File tree

72 files changed

+820
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+820
-704
lines changed

.github/workflows/deployment.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
- 'v*'
77

88
jobs:
9-
buildJava14:
9+
deploy:
1010
runs-on: ubuntu-latest
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- name: Set up JDK 14
14+
- name: Set up JDK 16
1515
uses: actions/setup-java@v1
1616
with:
17-
java-version: 14
17+
java-version: 16
1818
- name: Set env
1919
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
2020
- name: Add Arc release

.github/workflows/pr.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ name: Pull Request Tests
33
on: [pull_request, workflow_dispatch]
44

55
jobs:
6-
buildJava14:
6+
testPR:
77
runs-on: ubuntu-latest
88

99
steps:
1010
- uses: actions/checkout@v2
11-
- name: Set up JDK 14
11+
- name: Set up JDK 16
1212
uses: actions/setup-java@v1
1313
with:
14-
java-version: 14
14+
java-version: 16
1515
- name: Run unit tests and build JAR
1616
run: ./gradlew test desktop:dist
1717
- name: Upload desktop JAR for testing

.github/workflows/push.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Tests
33
on: [push, workflow_dispatch]
44

55
jobs:
6-
buildJava14:
6+
runPush:
77
runs-on: ubuntu-latest
88

99
steps:
@@ -17,9 +17,9 @@ jobs:
1717
git tag ${BNUM}
1818
git config --global user.name "Build Uploader"
1919
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds ${BNUM}
20-
- name: Set up JDK 14
20+
- name: Set up JDK 16
2121
uses: actions/setup-java@v1
2222
with:
23-
java-version: 14
23+
java-version: 16
2424
- name: Run unit tests
2525
run: ./gradlew clean cleanTest test

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 14](https://adoptopenjdk.net/archive.html?variant=openjdk14&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 16](https://adoptopenjdk.net/archive.html?variant=openjdk16&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

android/build.gradle

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ buildscript{
77
}
88

99
dependencies{
10-
//IMPORTANT NOTICE: any version of the plugin after 3.4.1 will break builds
11-
//it appears abstract methods don't get desugared properly (if at all)
12-
classpath 'com.android.tools.build:gradle:3.4.1'
10+
classpath 'com.android.tools.build:gradle:7.1.0-alpha02'
1311
}
1412
}
1513

android/src/mindustry/android/AndroidRhinoContext.java

-7
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ public AndroidContextFactory(File cacheDirectory){
6262
initApplicationClassLoader(createClassLoader(AndroidContextFactory.class.getClassLoader()));
6363
}
6464

65-
@Override
66-
protected Context makeContext(){
67-
Context ctx = super.makeContext();
68-
ctx.setClassShutter(Scripts::allowClass);
69-
return ctx;
70-
}
71-
7265
/**
7366
* Create a ClassLoader which is able to deal with bytecode
7467
* @param parent the parent of the create classloader

build.gradle

+6-15
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,7 @@ allprojects{
196196

197197
tasks.withType(JavaCompile){
198198
targetCompatibility = 8
199-
//TODO fix dynamically, this is a hack
200-
if(System.getProperty("user.name") == "anuke"){
201-
sourceCompatibility = JavaVersion.VERSION_15
202-
}else{
203-
sourceCompatibility = JavaVersion.VERSION_14
204-
}
199+
sourceCompatibility = JavaVersion.VERSION_16
205200
options.encoding = "UTF-8"
206201
options.compilerArgs += ["-Xlint:deprecation"]
207202
dependsOn clearCache
@@ -224,18 +219,13 @@ configure(project(":annotations")){
224219
//compile with java 8 compatibility for everything except the annotation project
225220
configure(subprojects - project(":annotations")){
226221
tasks.withType(JavaCompile){
227-
options.compilerArgs.addAll(['--release', '8', '--enable-preview'])
228-
229-
doFirst{
230-
options.compilerArgs = options.compilerArgs.findAll{it != '--enable-preview' }
231-
}
222+
options.compilerArgs.addAll(['--release', '8'])
232223
}
233224

234225
tasks.withType(Javadoc){
235226
options{
236227
addStringOption('Xdoclint:none', '-quiet')
237-
addBooleanOption('-enable-preview', true)
238-
addStringOption('-release', '14')
228+
addStringOption('-release', '16')
239229
}
240230
}
241231
}
@@ -302,9 +292,8 @@ project(":core"){
302292

303293
kapt{
304294
javacOptions{
305-
option("-source", "14")
295+
option("-source", "16")
306296
option("-target", "1.8")
307-
option("--enable-preview")
308297
}
309298
}
310299

@@ -430,6 +419,8 @@ project(":tests"){
430419
}
431420

432421
test{
422+
//fork every test so mods don't interact with each other
423+
forkEvery = 1
433424
useJUnitPlatform()
434425
workingDir = new File("../core/assets")
435426
testLogging{

core/src/mindustry/ClientLauncher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void setup(){
8383
Fonts.loadDefaultFont();
8484

8585
//load fallback atlas if max texture size is below 4096
86-
assets.load(new AssetDescriptor<>(maxTextureSize >= 4096 ? "sprites/sprites.aatls" : "sprites/fallback/sprites.aatls", TextureAtlas.class)).loaded = t -> atlas = (TextureAtlas)t;
86+
assets.load(new AssetDescriptor<>(maxTextureSize >= 4096 ? "sprites/sprites.aatls" : "sprites/fallback/sprites.aatls", TextureAtlas.class)).loaded = t -> atlas = (TextureAtlas)t;
8787
assets.loadRun("maps", Map.class, () -> maps.loadPreviews());
8888

8989
Musics.load();

core/src/mindustry/ai/BaseAI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private void tryWalls(){
289289
}
290290

291291
Tile o = world.tile(tile.x + p.x, tile.y + p.y);
292-
if(o != null && (o.block() instanceof PayloadBlock || o.block() instanceof PayloadConveyor)){
292+
if(o != null && (o.block() instanceof PayloadBlock || o.block() instanceof PayloadConveyor || o.block() instanceof ShockMine)){
293293
continue outer;
294294
}
295295

core/src/mindustry/content/Blocks.java

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import mindustry.world.blocks.defense.turrets.*;
1717
import mindustry.world.blocks.distribution.*;
1818
import mindustry.world.blocks.environment.*;
19-
import mindustry.world.blocks.experimental.*;
2019
import mindustry.world.blocks.legacy.*;
2120
import mindustry.world.blocks.liquid.*;
2221
import mindustry.world.blocks.logic.*;

core/src/mindustry/content/UnitTypes.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,9 @@ public void load(){
612612
bullet = new LiquidBulletType(Liquids.slag){{
613613
damage = 11;
614614
speed = 2.4f;
615-
drag = 0.01f;
615+
drag = 0.009f;
616616
shootEffect = Fx.shootSmall;
617-
lifetime = 56f;
617+
lifetime = 57f;
618618
collidesAir = false;
619619
}};
620620
}});

core/src/mindustry/core/Control.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,14 @@ void playSector(@Nullable Sector origin, Sector sector, WorldReloader reloader){
323323
if(slot != null && !clearSectors){
324324

325325
try{
326+
boolean hadNoCore = !sector.info.hasCore;
326327
reloader.begin();
327328
slot.load();
328329
slot.setAutosave(true);
329330
state.rules.sector = sector;
330331

331332
//if there is no base, simulate a new game and place the right loadout at the spawn position
332-
if(state.rules.defaultTeam.cores().isEmpty()){
333+
if(state.rules.defaultTeam.cores().isEmpty() || hadNoCore){
333334

334335
//no spawn set -> delete the sector save
335336
if(sector.info.spawnPosition == 0){

core/src/mindustry/core/Platform.java

-9
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ default Scripts createScripts(){
7979
}
8080

8181
default Context getScriptContext(){
82-
ContextFactory.getGlobalSetter().setContextFactoryGlobal(new ContextFactory(){
83-
@Override
84-
protected Context makeContext(){
85-
Context ctx = super.makeContext();
86-
ctx.setClassShutter(Scripts::allowClass);
87-
return ctx;
88-
}
89-
});
90-
9182
Context c = Context.enter();
9283
c.setOptimizationLevel(9);
9384
return c;

core/src/mindustry/editor/MapGenerateDialog.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void applyToEditor(Seq<GenerateFilter> filters){
164164
for(int x = 0; x < editor.width(); x++){
165165
for(int y = 0; y < editor.height(); y++){
166166
Tile tile = editor.tile(x, y);
167-
input.apply(x, y, tile.block(), tile.floor(), tile.overlay());
167+
input.set(x, y, tile.block(), tile.floor(), tile.overlay());
168168
filter.apply(input);
169169
writeTiles[x + y*world.width()] = PackTile.get(input.block.id, input.floor.id, input.overlay.id);
170170
}
@@ -340,6 +340,7 @@ void showAdd(){
340340
if(filter.isPost() && applied) continue;
341341

342342
p.button((icon == '\0' ? "" : icon + " ") + filter.name(), Styles.cleart, () -> {
343+
filter.randomize();
343344
filters.add(filter);
344345
rebuildFilters();
345346
update();
@@ -419,7 +420,7 @@ void update(){
419420
pixmap.each((px, py) -> {
420421
int x = px * scaling, y = py * scaling;
421422
long tile = buffer1[px + py * w];
422-
input.apply(x, y, content.block(PackTile.block(tile)), content.block(PackTile.floor(tile)), content.block(PackTile.overlay(tile)));
423+
input.set(x, y, content.block(PackTile.block(tile)), content.block(PackTile.floor(tile)), content.block(PackTile.overlay(tile)));
423424
filter.apply(input);
424425
buffer2[px + py * w] = PackTile.get(input.block.id, input.floor.id, input.overlay.id);
425426
});

core/src/mindustry/editor/MapInfoDialog.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import arc.*;
44
import arc.scene.ui.*;
55
import arc.struct.*;
6+
import arc.util.*;
67
import mindustry.*;
78
import mindustry.game.*;
89
import mindustry.io.*;
@@ -73,8 +74,12 @@ private void setup(){
7374
t.row();
7475
t.add("@editor.generation").padRight(8).left();
7576
t.button("@edit", () -> {
76-
generate.show(Vars.maps.readFilters(editor.tags.get("genfilters", "")),
77-
filters -> editor.tags.put("genfilters", JsonIO.write(filters)));
77+
generate.show(maps.readFilters(editor.tags.get("genfilters", "")),
78+
filters -> {
79+
//reset seed to 0 so it is not written
80+
filters.each(f -> f.seed = 0);
81+
editor.tags.put("genfilters", JsonIO.write(filters));
82+
});
7883
hide();
7984
}).left().width(200f);
8085

core/src/mindustry/entities/effect/ParticleEffect.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ public void render(EffectContainer e){
5959

6060
Angles.randLenVectors(e.id, particles, length * fin + baseLength, e.rotation, cone, (x, y) -> {
6161
Lines.lineAngle(ox + x, oy + y, Mathf.angle(x, y), len);
62-
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity);
62+
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity* Draw.getColor().a);
6363
});
6464
}else{
6565
Angles.randLenVectors(e.id, particles, length * fin + baseLength, e.rotation, cone, (x, y) -> {
6666
Draw.rect(tex, ox + x, oy + y, rad, rad, e.rotation + offset + e.time * spin);
67-
Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity);
67+
Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity * Draw.getColor().a);
6868
});
6969
}
7070
}

core/src/mindustry/graphics/CacheLayer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import arc.*;
44
import arc.graphics.*;
55
import arc.graphics.gl.*;
6+
import arc.util.*;
67

78
import static mindustry.Vars.*;
89

@@ -53,7 +54,7 @@ public void end(){
5354
}
5455

5556
public static class ShaderLayer extends CacheLayer{
56-
public Shader shader;
57+
public @Nullable Shader shader;
5758

5859
public ShaderLayer(Shader shader){
5960
//shader will be null on headless backend, but that's ok

core/src/mindustry/graphics/MenuRenderer.java

+8-10
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ private void generate(){
4444
Seq<Block> ores = content.blocks().select(b -> b instanceof OreBlock && !(b instanceof WallOreBlock));
4545
shadows = new FrameBuffer(width, height);
4646
int offset = Mathf.random(100000);
47-
Simplex s1 = new Simplex(offset);
48-
Simplex s2 = new Simplex(offset + 1);
49-
Simplex s3 = new Simplex(offset + 2);
47+
int s1 = offset, s2 = offset + 1, s3 = offset + 2;
5048
Block[] selected = Structs.select(
5149
new Block[]{Blocks.sand, Blocks.sandWall},
5250
new Block[]{Blocks.shale, Blocks.shaleWall},
@@ -85,27 +83,27 @@ private void generate(){
8583
Block ore = Blocks.air;
8684
Block wall = Blocks.air;
8785

88-
if(s1.octaveNoise2D(3, 0.5, 1/20.0, x, y) > 0.5){
86+
if(Simplex.noise2d(s1, 3, 0.5, 1/20.0, x, y) > 0.5){
8987
wall = walld;
9088
}
9189

92-
if(s3.octaveNoise2D(3, 0.5, 1/20.0, x, y) > 0.5){
90+
if(Simplex.noise2d(s3, 3, 0.5, 1/20.0, x, y) > 0.5){
9391
floor = floord2;
9492
if(wall != Blocks.air){
9593
wall = walld2;
9694
}
9795
}
9896

99-
if(s2.octaveNoise2D(3, 0.3, 1/30.0, x, y) > tr1){
97+
if(Simplex.noise2d(s2, 3, 0.3, 1/30.0, x, y) > tr1){
10098
ore = ore1;
10199
}
102100

103-
if(s2.octaveNoise2D(2, 0.2, 1/15.0, x, y+99999) > tr2){
101+
if(Simplex.noise2d(s2, 2, 0.2, 1/15.0, x, y+99999) > tr2){
104102
ore = ore2;
105103
}
106104

107105
if(doheat){
108-
double heat = s3.octaveNoise2D(4, 0.6, 1 / 50.0, x, y + 9999);
106+
double heat = Simplex.noise2d(s3, 4, 0.6, 1 / 50.0, x, y + 9999);
109107
double base = 0.65;
110108

111109
if(heat > base){
@@ -126,7 +124,7 @@ private void generate(){
126124
if(tech){
127125
int mx = x % secSize, my = y % secSize;
128126
int sclx = x / secSize, scly = y / secSize;
129-
if(s1.octaveNoise2D(2, 1f / 10f, 0.5f, sclx, scly) > 0.4f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
127+
if(Simplex.noise2d(s1, 2, 1f / 10f, 0.5f, sclx, scly) > 0.4f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
130128
floor = Blocks.darkPanel3;
131129
if(Mathf.dst(mx, my, secSize/2, secSize/2) > secSize/2f + 1){
132130
floor = Blocks.darkPanel4;
@@ -140,7 +138,7 @@ private void generate(){
140138
}
141139

142140
if(tendrils){
143-
if(RidgedPerlin.noise2d(1 + offset, x, y, 1f / 17f) > 0f){
141+
if(Ridged.noise2d(1 + offset, x, y, 1f / 17f) > 0f){
144142
floor = Mathf.chance(0.2) ? Blocks.sporeMoss : Blocks.moss;
145143

146144
if(wall != Blocks.air){

core/src/mindustry/graphics/g3d/SunMesh.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class SunMesh extends HexMesh{
1212

1313
public SunMesh(Planet planet, int divisions, double octaves, double persistence, double scl, double pow, double mag, float colorScale, Color... colors){
1414
super(planet, new HexMesher(){
15-
Simplex sim = new Simplex();
1615

1716
@Override
1817
public float getHeight(Vec3 position){
@@ -21,7 +20,7 @@ public float getHeight(Vec3 position){
2120

2221
@Override
2322
public Color getColor(Vec3 position){
24-
double height = Math.pow(sim.octaveNoise3D(octaves, persistence, scl, position.x, position.y, position.z), pow) * mag;
23+
double height = Math.pow(Simplex.noise3d(0, octaves, persistence, scl, position.x, position.y, position.z), pow) * mag;
2524
return Tmp.c1.set(colors[Mathf.clamp((int)(height * colors.length), 0, colors.length - 1)]).mul(colorScale);
2625
}
2726
}, divisions, Shaders.unlit);

core/src/mindustry/logic/LExecutor.java

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
public class LExecutor{
2929
public static final int maxInstructions = 1000;
3030

31-
//for noise operations
32-
public static final Simplex noise = new Simplex();
33-
3431
//special variables
3532
public static final int
3633
varCounter = 0,

0 commit comments

Comments
 (0)