Merge branch 'master' into pr-readwrite

This commit is contained in:
WayZer
2024-02-21 15:39:33 +08:00
committed by GitHub
17 changed files with 62 additions and 41 deletions

View File

@@ -18,7 +18,7 @@ jobs:
- name: Setup Gradle - name: Setup Gradle
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
- name: Run unit tests - name: Run unit tests
run: ./gradlew clean cleanTest test --stacktrace run: ./gradlew tests:test --stacktrace --rerun
- name: Run unit tests and build JAR - name: Run unit tests and build JAR
run: ./gradlew desktop:dist run: ./gradlew desktop:dist
- name: Upload desktop JAR for testing - name: Upload desktop JAR for testing

View File

@@ -57,4 +57,4 @@ jobs:
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack
cd ../Mindustry cd ../Mindustry
- name: Run unit tests - name: Run unit tests
run: ./gradlew clean cleanTest test --stacktrace run: ./gradlew tests:test --rerun --stacktrace

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

View File

@@ -2372,7 +2372,7 @@ lglobal.@clientLocale = Locale of the client running the code. For example: en_U
lglobal.@clientUnit = Unit of client running the code lglobal.@clientUnit = Unit of client running the code
lglobal.@clientName = Player name of client running the code lglobal.@clientName = Player name of client running the code
lglobal.@clientTeam = Team ID of client running the code lglobal.@clientTeam = Team ID of client running the code
lglobal.@clientMobile = True is the client running the code is on mobile, false otherwise lglobal.@clientMobile = True if the client running the code is on mobile, false otherwise
logic.nounitbuild = [red]Unit building logic is not allowed here. logic.nounitbuild = [red]Unit building logic is not allowed here.
@@ -2532,4 +2532,4 @@ lenum.texturesize = Size of texture in tiles. Zero value scales marker width to
lenum.autoscale = Whether to scale marker corresponding to player's zoom level. 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.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.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. lenum.colori = Indexed color, used for line and quad markers with index zero being the first color.

View File

@@ -26,6 +26,7 @@ public class UnitGroup{
if(lastSpeedUpdate == Vars.state.updateId) return; if(lastSpeedUpdate == Vars.state.updateId) return;
lastSpeedUpdate = Vars.state.updateId; lastSpeedUpdate = Vars.state.updateId;
minSpeed = 999999f;
for(Unit unit : units){ for(Unit unit : units){
//don't factor in the floor speed multiplier //don't factor in the floor speed multiplier

View File

@@ -148,17 +148,20 @@ public class MinimapRenderer{
Tmp.m2.set(Draw.trans()); Tmp.m2.set(Draw.trans());
float scaleFactor;
var trans = Tmp.m1.idt(); var trans = Tmp.m1.idt();
trans.translate(lastX, lastY); trans.translate(lastX, lastY);
if(!worldSpace){ if(!worldSpace){
trans.scl(Tmp.v1.set(lastW / rect.width, lastH / rect.height)); trans.scl(Tmp.v1.set(scaleFactor = lastW / rect.width, lastH / rect.height));
trans.translate(-rect.x, -rect.y); trans.translate(-rect.x, -rect.y);
}else{ }else{
trans.scl(Tmp.v1.set(lastW / world.unitWidth(), lastH / world.unitHeight())); trans.scl(Tmp.v1.set(scaleFactor = lastW / world.unitWidth(), lastH / world.unitHeight()));
} }
trans.translate(tilesize / 2f, tilesize / 2f); trans.translate(tilesize / 2f, tilesize / 2f);
Draw.trans(trans); Draw.trans(trans);
scaleFactor = 1f / scaleFactor;
for(Unit unit : units){ for(Unit unit : units){
if(unit.inFogTo(player.team()) || !unit.type.drawMinimap) continue; if(unit.inFogTo(player.team()) || !unit.type.drawMinimap) continue;
@@ -198,7 +201,7 @@ public class MinimapRenderer{
dynamicTex.setFilter(TextureFilter.nearest); dynamicTex.setFilter(TextureFilter.nearest);
Tmp.tr1.set(dynamicTex); Tmp.tr1.set(dynamicTex);
Tmp.tr1.set(0f, 0f, 1f, 1f); Tmp.tr1.set(0f, 1f, 1f, 0f);
float wf = world.width() * tilesize; float wf = world.width() * tilesize;
float hf = world.height() * tilesize; float hf = world.height() * tilesize;
@@ -226,7 +229,7 @@ public class MinimapRenderer{
if(!mobile){ if(!mobile){
//draw bounds for camera - not drawn on mobile because you can't shift it by tapping anyway //draw bounds for camera - not drawn on mobile because you can't shift it by tapping anyway
Rect r = Core.camera.bounds(Tmp.r1); Rect r = Core.camera.bounds(Tmp.r1);
Lines.stroke(Scl.scl(3f)); Lines.stroke(Scl.scl(3f) * scaleFactor);
Draw.color(Pal.accent); Draw.color(Pal.accent);
Lines.rect(r.x, r.y, r.width, r.height); Lines.rect(r.x, r.y, r.width, r.height);
Draw.reset(); Draw.reset();

View File

@@ -203,17 +203,7 @@ public class PlanetRenderer implements Disposable{
} }
public void setPlane(Sector sector){ public void setPlane(Sector sector){
float rotation = -sector.planet.getRotation(); sector.planet.setPlane(sector, projector);
float length = 0.01f;
projector.setPlane(
//origin on sector position
Tmp.v33.set(sector.tile.v).setLength((outlineRad + length) * sector.planet.radius).rotate(Vec3.Y, rotation).add(sector.planet.position),
//face up
sector.plane.project(Tmp.v32.set(sector.tile.v).add(Vec3.Y)).sub(sector.tile.v, sector.planet.radius).rotate(Vec3.Y, rotation).nor(),
//right vector
Tmp.v31.set(Tmp.v32).rotate(Vec3.Y, -rotation).add(sector.tile.v).rotate(sector.tile.v, 90).sub(sector.tile.v).rotate(Vec3.Y, rotation).nor()
);
} }
public void fill(Sector sector, Color color, float offset){ public void fill(Sector sector, Color color, float offset){

View File

@@ -84,8 +84,6 @@ public class Liquid extends UnlockableContent implements Senseable{
super.init(); super.init();
if(gas){ if(gas){
//gases can't be coolants
coolant = false;
//always "boils", it's a gas //always "boils", it's a gas
boilPoint = -1; boilPoint = -1;
//ensure no accidental global mutation //ensure no accidental global mutation

View File

@@ -536,4 +536,26 @@ public class Planet extends UnlockableContent{
} }
batch.flush(Gl.lineStrip); batch.flush(Gl.lineStrip);
} }
public Vec3 lookAt(Sector sector, Vec3 out){
return out.set(sector.tile.v).rotate(Vec3.Y, -getRotation());
}
public Vec3 project(Sector sector, Camera3D cam, Vec3 out){
return cam.project(out.set(sector.tile.v).setLength(outlineRad * radius).rotate(Vec3.Y, -getRotation()).add(position));
}
public void setPlane(Sector sector, PlaneBatch3D projector){
float rotation = -getRotation();
float length = 0.01f;
projector.setPlane(
//origin on sector position
Tmp.v33.set(sector.tile.v).setLength((outlineRad + length) * radius).rotate(Vec3.Y, rotation).add(position),
//face up
sector.plane.project(Tmp.v32.set(sector.tile.v).add(Vec3.Y)).sub(sector.tile.v, radius).rotate(Vec3.Y, rotation).nor(),
//right vector
Tmp.v31.set(Tmp.v32).rotate(Vec3.Y, -rotation).add(sector.tile.v).rotate(sector.tile.v, 90).sub(sector.tile.v).rotate(Vec3.Y, rotation).nor()
);
}
} }

View File

@@ -236,7 +236,7 @@ public class Sector{
/** Projects this sector onto a 4-corner square for use in map gen. /** Projects this sector onto a 4-corner square for use in map gen.
* Allocates a new object. Do not call in the main loop. */ * Allocates a new object. Do not call in the main loop. */
private SectorRect makeRect(){ protected SectorRect makeRect(){
Vec3[] corners = new Vec3[tile.corners.length]; Vec3[] corners = new Vec3[tile.corners.length];
for(int i = 0; i < corners.length; i++){ for(int i = 0; i < corners.length; i++){
corners[i] = tile.corners[i].v.cpy().setLength(planet.radius); corners[i] = tile.corners[i].v.cpy().setLength(planet.radius);

View File

@@ -167,7 +167,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//show selection of Erekir/Serpulo campaign if the user has no bases, and hasn't selected yet (essentially a "have they played campaign before" check) //show selection of Erekir/Serpulo campaign if the user has no bases, and hasn't selected yet (essentially a "have they played campaign before" check)
shown(() -> { shown(() -> {
if(!settings.getBool("campaignselect") && !content.planets().contains(p -> p.sectors.contains(s -> s.hasBase()))){ if(!settings.getBool("campaignselect") && !content.planets().contains(p -> p.sectors.contains(Sector::hasBase))){
var diag = new BaseDialog("@campaign.select"); var diag = new BaseDialog("@campaign.select");
Planet[] selected = {null}; Planet[] selected = {null};
@@ -214,7 +214,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
//unlock defaults for older campaign saves (TODO move? where to?) //unlock defaults for older campaign saves (TODO move? where to?)
if(content.planets().contains(p -> p.sectors.contains(s -> s.hasBase())) || Blocks.scatter.unlocked() || Blocks.router.unlocked()){ if(content.planets().contains(p -> p.sectors.contains(Sector::hasBase)) || Blocks.scatter.unlocked() || Blocks.router.unlocked()){
Seq.with(Blocks.junction, Blocks.mechanicalDrill, Blocks.conveyor, Blocks.duo, Items.copper, Items.lead).each(UnlockableContent::quietUnlock); Seq.with(Blocks.junction, Blocks.mechanicalDrill, Blocks.conveyor, Blocks.duo, Items.copper, Items.lead).each(UnlockableContent::quietUnlock);
} }
} }
@@ -372,11 +372,17 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
super.show(); super.show();
} }
void lookAt(Sector sector){ public void lookAt(Sector sector){
if(sector.tile == Ptile.empty) return; if(sector.tile == Ptile.empty) return;
//TODO should this even set `state.planet`? the other lookAt() doesn't, so...
state.planet = sector.planet; state.planet = sector.planet;
state.camPos.set(Tmp.v33.set(sector.tile.v).rotate(Vec3.Y, -sector.planet.getRotation())); sector.planet.lookAt(sector, state.camPos);
}
public void lookAt(Sector sector, float alpha){
float len = state.camPos.len();
state.camPos.slerp(sector.planet.lookAt(sector, Tmp.v33).setLength(len), alpha);
} }
boolean canSelect(Sector sector){ boolean canSelect(Sector sector){
@@ -648,10 +654,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
}).visible(() -> mode != select), }).visible(() -> mode != select),
new Table(c -> { new Table(c -> expandTable = c)).grow();
expandTable = c;
})).grow();
rebuildExpand(); rebuildExpand();
} }
@@ -770,11 +773,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
} }
public void lookAt(Sector sector, float alpha){
float len = state.camPos.len();
state.camPos.slerp(Tmp.v31.set(sector.tile.v).rotate(Vec3.Y, -sector.planet.getRotation()).setLength(len), alpha);
}
@Override @Override
public void act(float delta){ public void act(float delta){
super.act(delta); super.act(delta);
@@ -801,7 +799,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
hoverLabel.touchable = Touchable.disabled; hoverLabel.touchable = Touchable.disabled;
hoverLabel.color.a = state.uiAlpha; hoverLabel.color.a = state.uiAlpha;
Vec3 pos = planets.cam.project(Tmp.v31.set(hovered.tile.v).setLength(PlanetRenderer.outlineRad * state.planet.radius).rotate(Vec3.Y, -state.planet.getRotation()).add(state.planet.position)); Vec3 pos = hovered.planet.project(hovered, planets.cam, Tmp.v31);
hoverLabel.setPosition(pos.x - Core.scene.marginLeft, pos.y - Core.scene.marginBottom, Align.center); hoverLabel.setPosition(pos.x - Core.scene.marginLeft, pos.y - Core.scene.marginBottom, Align.center);
hoverLabel.getText().setLength(0); hoverLabel.getText().setLength(0);

View File

@@ -36,8 +36,6 @@ public class TraceDialog extends BaseDialog{
c.add(Core.bundle.format("trace.ip", info.ip)).row(); c.add(Core.bundle.format("trace.ip", info.ip)).row();
c.button(Icon.copySmall, style, () -> copy(info.uuid)).size(s).padRight(4f); c.button(Icon.copySmall, style, () -> copy(info.uuid)).size(s).padRight(4f);
c.add(Core.bundle.format("trace.id", info.uuid)).row(); c.add(Core.bundle.format("trace.id", info.uuid)).row();
c.button(Icon.copySmall, style, () -> copy(player.locale)).size(s).padRight(4f);
c.add(Core.bundle.format("trace.language", player.locale)).row();
}).row(); }).row();
table.add(Core.bundle.format("trace.modclient", info.modded)).row(); table.add(Core.bundle.format("trace.modclient", info.modded)).row();

View File

@@ -50,6 +50,7 @@ public class Build{
if(tile.build != null){ if(tile.build != null){
prevBuild.add(tile.build); prevBuild.add(tile.build);
tile.build.onDeconstructed(unit); tile.build.onDeconstructed(unit);
tile.build.dead = true;
} }
tile.setBlock(sub, team, rotation); tile.setBlock(sub, team, rotation);

View File

@@ -29,6 +29,7 @@ public class StackConveyor extends Block implements Autotiler{
public @Load("@-stack") TextureRegion stackRegion; public @Load("@-stack") TextureRegion stackRegion;
/** requires power to work properly */ /** requires power to work properly */
public @Load(value = "@-glow") TextureRegion glowRegion; public @Load(value = "@-glow") TextureRegion glowRegion;
public @Load(value = "@-edge-glow", fallback = "@-glow") TextureRegion edgeGlowRegion;
public float glowAlpha = 1f; public float glowAlpha = 1f;
public Color glowColor = Pal.redLight; public Color glowColor = Pal.redLight;
@@ -154,7 +155,7 @@ public class StackConveyor extends Block implements Autotiler{
Draw.z(Layer.blockAdditive); Draw.z(Layer.blockAdditive);
Draw.color(glowColor, glowAlpha * power.status); Draw.color(glowColor, glowAlpha * power.status);
Draw.blend(Blending.additive); Draw.blend(Blending.additive);
Draw.rect(glowRegion, x, y, rotation * 90); Draw.rect(state == stateLoad ? edgeGlowRegion : glowRegion, x, y, rotation * 90);
Draw.blend(); Draw.blend();
Draw.color(); Draw.color();
Draw.z(Layer.block - 0.1f); Draw.z(Layer.block - 0.1f);

View File

@@ -43,6 +43,11 @@ public class SwitchBlock extends Block{
super.damage(damage); super.damage(damage);
} }
@Override
public boolean canPickup(){
return !privileged;
}
@Override @Override
public boolean collide(Bullet other){ public boolean collide(Bullet other){
return !privileged; return !privileged;

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -3,6 +3,10 @@
"name": "STP", "name": "STP",
"address": ["23.88.73.88:25617"] "address": ["23.88.73.88:25617"]
}, },
{
"name": "Crimson Star",
"address": ["185.103.101.121:25528"]
},
{ {
"name" : "LesGarsCools", "name" : "LesGarsCools",
"address": ["est1.be"] "address": ["est1.be"]
@@ -230,7 +234,7 @@
}, },
{ {
"name": "ABCXYZ Community", "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", "5.9.8.124:28848"] "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", "srv1.godlike.club:28466"]
}, },
{ {
"name": "CroCraft Network", "name": "CroCraft Network",