Compare commits

...

18 Commits

Author SHA1 Message Date
Anuken
7b1c60c24f Testing tests 2020-12-04 12:23:02 -05:00
Anuken
8b8d990852 Testing tests 2020-12-04 12:16:47 -05:00
Anuken
6583cc0b5d Testing tests 2020-12-04 11:38:43 -05:00
Anuken
5c3ae425ae Display locked sectors / Core incinerate hint 2020-12-04 11:31:27 -05:00
Anuken
744b1b2037 Looking into test failure 2020-12-04 10:56:47 -05:00
Anuken
a313ca8a26 Checking if tests fail 2020-12-04 10:44:39 -05:00
Anuken
87204df3ee Merge remote-tracking branch 'origin/master' 2020-12-04 10:25:51 -05:00
Anuken
bc70c08820 Fixed #3756 2020-12-04 10:25:41 -05:00
Anuken
2c2828617f Create ISSUES.md 2020-12-04 10:03:54 -05:00
Anuken
a451ad895c Slight sei buff 2020-12-03 20:29:58 -05:00
Anuken
d13b69c36f Sort community servers by ping 2020-12-03 16:49:30 -05:00
Anuken
d64f603e08 Merge branch 'master' of https://github.com/Anuken/Mindustry 2020-12-03 12:08:35 -05:00
Anuken
3d2c094056 arc 2020-12-03 12:08:31 -05:00
Anuken
64e99f613e Update bug_report.md 2020-12-03 11:08:00 -05:00
Anuken
51b4078288 Clean tests before running 2020-12-03 11:05:02 -05:00
Anuken
db8d099fcc arc 2020-12-03 10:29:19 -05:00
Anuken
002be46915 Updated miniaudio version 2020-12-03 10:28:57 -05:00
Anuken
9fa2691b02 Fixed campaign idle boss spoofing 2020-12-03 10:05:52 -05:00
24 changed files with 236 additions and 89 deletions

View File

@@ -21,7 +21,7 @@ assignees: ''
If you remove the line above without reading it properly and understanding what it means, I will reap your soul. Even if you're playing on someone's server, you can still save the game to a slot. If you remove the line above without reading it properly and understanding what it means, I will reap your soul. Even if you're playing on someone's server, you can still save the game to a slot.
**Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.* **(Crash) logs**: *Either crash reports from the crash folder, or the file you get when you go into Settings -> Game Data -> Export Crash logs. REQUIRED if you are reporting a crash.*
--- ---

View File

@@ -13,7 +13,7 @@ jobs:
with: with:
java-version: 14 java-version: 14
- name: Run unit tests - name: Run unit tests
run: ./gradlew test run: ./gradlew clean cleanTest test
- name: Trigger BE build - name: Trigger BE build
if: ${{ github.repository == 'Anuken/Mindustry' }} if: ${{ github.repository == 'Anuken/Mindustry' }}
run: | run: |

52
ISSUES.md Normal file
View File

@@ -0,0 +1,52 @@
# Why was my issue closed?
This document goes over some common causes for issue closures.
## You did not fill in the template
I can't debug the problem unless you provide the information the template asks for.
If you cannot put in the effort to fill out a template, then don't expect me to put in the effort to fix it.
## Your issue was already reported
If the problem in your issue has already been encountered before, it will be closed - especially if your report doesn't provide any new information.
Make sure you search the *closed* issues before making an issue.
I do not link the specific issue(s) that report the same problem, because searching takes time - if you're interested in finding them, you should be able to do so without my help.
To be clear: I do **not** expect users to look at *all* previous issues, or do a comprehensive stack trace analysis to see if their crash was already reported.
## Your issue was already fixed
The problem you reported has been addressed. Note that this does **not** mean that the latest stable version of Mindustry has the fix!
It simply means that I have committed (or am about to commit) a patch that fixes it *on the current development branch*.
## Your issue is missing a crash report or log
If the game crashes without a specific cause, and you don't send me a log, I can't fix it. There is no way for me to know what went wrong.
During a normal crash, the game should tell you where the log is saved. If not, you should still be able to look in the game's crash folder on most operating systems, or export the logs in *Settings -> Game Data -> Export Crash Logs*.
## Your issue is missing saves or screenshots
Even if you think your problem happens everywhere and saves/screenshots are redundant, this is frequently not the case.
If I cannot reproduce the problem on my own saves and you have not linked any of your own, then the problem is likely to be save-specific. If you do not send me any, the problem cannot be investigated further.
## Your issue is related to an external program
If Mindustry causes something else to crash or misbehave, I am very unlikely to fix it. Unless the problem is serious, widespread and/or clearly a bug *in Mindustry*, it is not my responsibility.
Similarly, if you use another (invasive) program to change how Mindustry works, and something goes wrong, that is not my problem. Don't do it.
## Your issue is caused by mods
Crashes and bugs related to installed mods should be reported in the relevant mod repository, not here.
*Note that problems with the Mindustry modding API are a separate problem, and do not apply.*
## I cannot reproduce your issue
If I follow your instructions and am repeatedly unable to reproduce the problem you've reported, then it is very unlikely to be fixed.
Either the problem is device-specific, or there is not enough information given for me to be able to reproduce it.
I may attempt to change some code if I think it will make the issue less likely to occur, but without knowing for sure, the issue cannot be considered truly "fixed".
As I cannot make any further progress on the problem, there is no reason to keep it open. If it is a common bug/crash, other people will come along with information that may shed some light on the issue.

View File

@@ -69,7 +69,7 @@ stat.delivered = Resources Launched:
stat.playtime = Time Played:[accent] {0} stat.playtime = Time Played:[accent] {0}
stat.rank = Final Rank: [accent]{0} stat.rank = Final Rank: [accent]{0}
globalitems = [accent]Global Items globalitems = [accent]Total Items
map.delete = Are you sure you want to delete the map "[accent]{0}[]"? map.delete = Are you sure you want to delete the map "[accent]{0}[]"?
level.highscore = High Score: [accent]{0} level.highscore = High Score: [accent]{0}
level.select = Level Select level.select = Level Select
@@ -1282,6 +1282,7 @@ hint.generator = \uf879 [accent]Combustion Generators[] burn coal and transmit p
hint.guardian = [accent]Guardian[] units are armored. Weak ammo such as [accent]Copper[] and [accent]Lead[] is [scarlet]not effective[].\n\nUse higher tier turrets or \uf835 [accent]Graphite[] \uf861Duo/\uf859Salvo ammunition to take Guardians down. hint.guardian = [accent]Guardian[] units are armored. Weak ammo such as [accent]Copper[] and [accent]Lead[] is [scarlet]not effective[].\n\nUse higher tier turrets or \uf835 [accent]Graphite[] \uf861Duo/\uf859Salvo ammunition to take Guardians down.
hint.coreUpgrade = Cores can be upgraded by [accent]placing higher-tier cores over them[].\n\nPlace a  [accent]Foundation[] core over the  [accent]Shard[] core. Make sure it is free from nearby obstructions. hint.coreUpgrade = Cores can be upgraded by [accent]placing higher-tier cores over them[].\n\nPlace a  [accent]Foundation[] core over the  [accent]Shard[] core. Make sure it is free from nearby obstructions.
hint.presetLaunch = Gray [accent]landing zone sectors[], such as [accent]Frozen Forest[], can be launched to from anywhere. They do not require capture of nearby territory.\n\n[accent]Numbered sectors[], such as this one, are [accent]optional[]. hint.presetLaunch = Gray [accent]landing zone sectors[], such as [accent]Frozen Forest[], can be launched to from anywhere. They do not require capture of nearby territory.\n\n[accent]Numbered sectors[], such as this one, are [accent]optional[].
hint.coreIncinerate = After the core is filled to capacity with an item, any extra items of that type it receives will be [accent]incinerated[].
item.copper.description = Used in all types of construction and ammunition. item.copper.description = Used in all types of construction and ammunition.
item.copper.details = Copper. Abnormally abundant metal on Serpulo. Structurally weak unless reinforced. item.copper.details = Copper. Abnormally abundant metal on Serpulo. Structurally weak unless reinforced.

View File

@@ -154,22 +154,22 @@ public class TechTree implements ContentList{
}); });
node(kiln, Seq.with(new SectorComplete(craters)), () -> { node(kiln, Seq.with(new SectorComplete(craters)), () -> {
node(incinerator, () -> { node(pulverizer, () -> {
node(melter, () -> { node(incinerator, () -> {
node(surgeSmelter, () -> { node(melter, () -> {
node(surgeSmelter, () -> {
}); });
node(separator, () -> { node(separator, () -> {
node(pulverizer, () -> {
node(disassembler, () -> { node(disassembler, () -> {
}); });
}); });
});
node(cryofluidMixer, () -> { node(cryofluidMixer, () -> {
});
}); });
}); });
}); });

View File

@@ -1624,7 +1624,7 @@ public class UnitTypes implements ContentList{
xRand = 8f; xRand = 8f;
shotDelay = 1f; shotDelay = 1f;
bullet = new MissileBulletType(4.2f, 40){{ bullet = new MissileBulletType(4.2f, 42){{
homingPower = 0.12f; homingPower = 0.12f;
width = 8f; width = 8f;
height = 8f; height = 8f;
@@ -1634,7 +1634,7 @@ public class UnitTypes implements ContentList{
keepVelocity = false; keepVelocity = false;
splashDamageRadius = 35f; splashDamageRadius = 35f;
splashDamage = 45f; splashDamage = 45f;
lifetime = 56f; lifetime = 62f;
trailColor = Pal.bulletYellowBack; trailColor = Pal.bulletYellowBack;
backColor = Pal.bulletYellowBack; backColor = Pal.bulletYellowBack;
frontColor = Pal.bulletYellow; frontColor = Pal.bulletYellow;
@@ -1662,11 +1662,11 @@ public class UnitTypes implements ContentList{
shots = 3; shots = 3;
shotDelay = 4f; shotDelay = 4f;
inaccuracy = 1f; inaccuracy = 1f;
bullet = new BasicBulletType(7f, 55){{ bullet = new BasicBulletType(7f, 57){{
width = 13f; width = 13f;
height = 19f; height = 19f;
shootEffect = Fx.shootBig; shootEffect = Fx.shootBig;
lifetime = 30f; lifetime = 35f;
}}; }};
}}); }});
}}; }};

View File

@@ -10,21 +10,22 @@ import arc.scene.style.*;
import arc.scene.ui.*; import arc.scene.ui.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.*;
import mindustry.audio.*; import mindustry.audio.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.content.TechTree.*; import mindustry.content.TechTree.*;
import mindustry.core.GameState.*; import mindustry.core.GameState.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.game.Objectives.*; import mindustry.game.Objectives.*;
import mindustry.game.*;
import mindustry.game.Saves.*; import mindustry.game.Saves.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.input.*; import mindustry.input.*;
import mindustry.io.*; import mindustry.io.*;
import mindustry.io.SaveIO.*; import mindustry.io.SaveIO.*;
import mindustry.maps.*;
import mindustry.maps.Map; import mindustry.maps.Map;
import mindustry.maps.*;
import mindustry.net.*; import mindustry.net.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
@@ -506,6 +507,13 @@ public class Control implements ApplicationListener, Loadable{
settings.put("fullscreen", !full); settings.put("fullscreen", !full);
} }
if(Float.isNaN(Vars.player.x) || Float.isNaN(Vars.player.y)){
player.set(0, 0);
if(!player.dead()) player.unit().kill();
}
if(Float.isNaN(camera.position.x)) camera.position.x = world.unitWidth()/2f;
if(Float.isNaN(camera.position.y)) camera.position.y = world.unitHeight()/2f;
if(state.isGame()){ if(state.isGame()){
input.update(); input.update();

View File

@@ -6,6 +6,8 @@ import arc.graphics.g2d.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.util.*; import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
@@ -42,6 +44,11 @@ public abstract class UnlockableContent extends MappableContent{
this.unlocked = Core.settings != null && Core.settings.getBool(this.name + "-unlocked", false); this.unlocked = Core.settings != null && Core.settings.getBool(this.name + "-unlocked", false);
} }
/** @return the tech node for this content. may be null. */
public @Nullable TechNode node(){
return TechTree.get(this);
}
public String displayDescription(){ public String displayDescription(){
return minfo.mod == null ? description : description + "\n" + Core.bundle.format("mod.display", minfo.mod.meta.displayName()); return minfo.mod == null ? description : description + "\n" + Core.bundle.format("mod.display", minfo.mod.meta.displayName());
} }

View File

@@ -49,7 +49,8 @@ public class ContinuousLaserBulletType extends BulletType{
@Override @Override
public float estimateDPS(){ public float estimateDPS(){
//assume firing duration is about 100 by default, may not be accurate there's no way of knowing in this method //assume firing duration is about 100 by default, may not be accurate there's no way of knowing in this method
return damage * 100f / 5f; //assume it pierces 3 blocks/units
return damage * 100f / 5f * 3f;
} }
@Override @Override

View File

@@ -40,9 +40,10 @@ public class LaserBulletType extends BulletType{
this(1f); this(1f);
} }
//assume it pierces at least 3 blocks
@Override @Override
public float estimateDPS(){ public float estimateDPS(){
return super.estimateDPS() * 2f; return super.estimateDPS() * 3f;
} }
@Override @Override

View File

@@ -197,7 +197,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
//region utility methods //region utility methods
public void addPlan(boolean checkPrevious){ public void addPlan(boolean checkPrevious){
if(!block.rebuildable) return; if(!block.rebuildable || (team == state.rules.defaultTeam && state.isCampaign() && !block.isVisible())) return;
if(self() instanceof ConstructBuild entity){ if(self() instanceof ConstructBuild entity){
//update block to reflect the fact that something was being constructed //update block to reflect the fact that something was being constructed
@@ -1099,8 +1099,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void displayBars(Table table){ public void displayBars(Table table){
for(Func<Building, Bar> bar : block.bars.list()){ for(Func<Building, Bar> bar : block.bars.list()){
table.add(bar.get(self())).growX(); //TODO fix conclusively
table.row(); try{
table.add(bar.get(self())).growX();
table.row();
}catch(ClassCastException e){
break;
}
} }
} }

View File

@@ -73,7 +73,7 @@ public class SectorInfo{
public boolean shown = false; public boolean shown = false;
/** Special variables for simulation. */ /** Special variables for simulation. */
public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope, bossHealth, bossDps; public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope, bossHealth, bossDps, curEnemyHealth, curEnemyDps;
/** Wave where first boss shows up. */ /** Wave where first boss shows up. */
public int bossWave = -1; public int bossWave = -1;

View File

@@ -836,7 +836,6 @@ public class MobileInput extends InputHandler implements GestureListener{
if(type == null) return; if(type == null) return;
boolean omni = unit.type.omniMovement; boolean omni = unit.type.omniMovement;
boolean ground = unit.isGrounded();
boolean allowHealing = type.canHeal; boolean allowHealing = type.canHeal;
boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team && boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team &&
((Building)target).damaged() && target.within(unit, type.range); ((Building)target).damaged() && target.within(unit, type.range);

View File

@@ -73,6 +73,11 @@ public class SectorDamage{
enemyHealth += info.bossHealth; enemyHealth += info.bossHealth;
} }
if(i == waveBegin){
enemyDps += info.curEnemyDps;
enemyHealth += info.curEnemyHealth;
}
//happens due to certain regressions //happens due to certain regressions
if(enemyHealth < 0 || enemyDps < 0) continue; if(enemyHealth < 0 || enemyDps < 0) continue;
@@ -293,18 +298,19 @@ public class SectorDamage{
//skip player //skip player
if(unit.isPlayer()) continue; if(unit.isPlayer()) continue;
if(unit.team == state.rules.defaultTeam){ //scale health based on armor - yes, this is inaccurate, but better than nothing
//scale health based on armor - yes, this is inaccurate, but better than nothing float healthMult = 1f + Mathf.clamp(unit.armor / 20f);
float healthMult = 1f + Mathf.clamp(unit.armor / 20f);
if(unit.team == state.rules.defaultTeam){
sumHealth += unit.health*healthMult + unit.shield; sumHealth += unit.health*healthMult + unit.shield;
sumDps += unit.type.dpsEstimate; sumDps += unit.type.dpsEstimate;
if(unit.abilities.find(a -> a instanceof RepairFieldAbility) instanceof RepairFieldAbility h){ if(unit.abilities.find(a -> a instanceof RepairFieldAbility) instanceof RepairFieldAbility h){
sumRps += h.amount / h.reload * 60f; sumRps += h.amount / h.reload * 60f;
} }
}else{ }else{
curEnemyDps += unit.type.dpsEstimate; float bossMult = unit.isBoss() ? 3f : 1f;
curEnemyHealth += unit.health; curEnemyDps += unit.type.dpsEstimate * unit.damageMultiplier() * bossMult;
curEnemyHealth += unit.health * healthMult * unit.healthMultiplier() * bossMult + unit.shield;
} }
} }
@@ -316,12 +322,6 @@ public class SectorDamage{
for(int wave = state.wave; wave < state.wave + 10; wave ++){ for(int wave = state.wave; wave < state.wave + 10; wave ++){
float sumWaveDps = 0f, sumWaveHealth = 0f; float sumWaveDps = 0f, sumWaveHealth = 0f;
//first wave has to take into account current dps
if(wave == state.wave){
sumWaveDps += curEnemyDps;
sumWaveHealth += curEnemyHealth;
}
for(SpawnGroup group : state.rules.spawns){ for(SpawnGroup group : state.rules.spawns){
float healthMult = 1f + Mathf.clamp(group.type.armor / 20f); float healthMult = 1f + Mathf.clamp(group.type.armor / 20f);
StatusEffect effect = (group.effect == null ? StatusEffects.none : group.effect); StatusEffect effect = (group.effect == null ? StatusEffects.none : group.effect);
@@ -369,6 +369,11 @@ public class SectorDamage{
info.sumDps = sumDps * 1.05f; info.sumDps = sumDps * 1.05f;
info.sumRps = sumRps; info.sumRps = sumRps;
float cmult = 1.5f;
info.curEnemyDps = curEnemyDps*cmult;
info.curEnemyHealth = curEnemyHealth*cmult;
info.wavesSurvived = getWavesSurvived(info); info.wavesSurvived = getWavesSurvived(info);
} }

View File

@@ -356,43 +356,45 @@ public class JoinDialog extends BaseDialog{
continue; continue;
} }
Table[] groupTable = {null};
//table containing all groups //table containing all groups
global.table(g -> { for(String address : group.addresses){
for(String address : group.addresses){ String resaddress = address.contains(":") ? address.split(":")[0] : address;
String resaddress = address.contains(":") ? address.split(":")[0] : address; int resport = address.contains(":") ? Strings.parseInt(address.split(":")[1]) : port;
int resport = address.contains(":") ? Strings.parseInt(address.split(":")[1]) : port; net.pingHost(resaddress, resport, res -> {
net.pingHost(resaddress, resport, res -> { if(refreshes != cur) return;
if(refreshes != cur) return; res.port = resport;
res.port = resport;
//add header //add header
if(g.getChildren().isEmpty()){ if(groupTable[0] == null){
g.table(head -> { global.table(t -> groupTable[0] = t).row();
if(!group.name.isEmpty()){
head.add(group.name).color(Color.lightGray).padRight(4);
}
head.image().height(3f).growX().color(Color.lightGray);
//button for showing/hiding servers groupTable[0].table(head -> {
ImageButton[] image = {null}; if(!group.name.isEmpty()){
image[0] = head.button(hidden ? Icon.eyeOffSmall : Icon.eyeSmall, Styles.accenti, () -> { head.add(group.name).color(Color.lightGray).padRight(4);
group.setHidden(!group.hidden()); }
image[0].getStyle().imageUp = group.hidden() ? Icon.eyeOffSmall : Icon.eyeSmall; head.image().height(3f).growX().color(Color.lightGray);
if(group.hidden() && !showHidden){
g.remove();
}
}).size(40f).get();
image[0].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
}).width(targetWidth()).padBottom(-2).row();
}
addGlobalHost(res, g); //button for showing/hiding servers
ImageButton[] image = {null};
image[0] = head.button(hidden ? Icon.eyeOffSmall : Icon.eyeSmall, Styles.accenti, () -> {
group.setHidden(!group.hidden());
image[0].getStyle().imageUp = group.hidden() ? Icon.eyeOffSmall : Icon.eyeSmall;
if(group.hidden() && !showHidden){
groupTable[0].remove();
}
}).size(40f).get();
image[0].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
}).width(targetWidth()).padBottom(-2).row();
}
g.margin(5f); addGlobalHost(res, groupTable[0]);
g.pack();
}, e -> {}); groupTable[0].margin(5f);
} groupTable[0].pack();
}).row(); }, e -> {});
}
} }
} }

View File

@@ -15,8 +15,10 @@ import arc.scene.ui.layout.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.Objectives.*;
import mindustry.game.SectorInfo.*; import mindustry.game.SectorInfo.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -253,7 +255,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
boolean canSelect(Sector sector){ boolean canSelect(Sector sector){
if(mode == select) return sector.hasBase(); if(mode == select) return sector.hasBase();
//preset sectors can only be selected once unlocked //preset sectors can only be selected once unlocked
if(sector.preset != null) return sector.preset.unlocked() || sector.hasBase(); if(sector.preset != null){
TechNode node = sector.preset.node();
return node == null || node.parent == null || node.parent.content.unlocked();
}
return sector.hasBase() || sector.near().contains(Sector::hasBase); //near an occupied sector return sector.hasBase() || sector.near().contains(Sector::hasBase); //near an occupied sector
} }
@@ -291,7 +296,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
Color color = Color color =
sec.hasBase() ? Tmp.c2.set(Team.sharded.color).lerp(Team.crux.color, sec.hasEnemyBase() ? 0.5f : 0f) : sec.hasBase() ? Tmp.c2.set(Team.sharded.color).lerp(Team.crux.color, sec.hasEnemyBase() ? 0.5f : 0f) :
sec.preset != null ? Tmp.c2.set(Team.derelict.color).lerp(Color.white, Mathf.absin(Time.time, 10f, 1f)) : sec.preset != null ?
sec.preset.unlocked() ? Tmp.c2.set(Team.derelict.color).lerp(Color.white, Mathf.absin(Time.time, 10f, 1f)) :
Color.gray :
sec.hasEnemyBase() ? Team.crux.color : sec.hasEnemyBase() ? Team.crux.color :
null; null;
@@ -352,7 +359,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
for(Sector sec : planet.sectors){ for(Sector sec : planet.sectors){
if(sec != hovered){ if(sec != hovered){
var preficon = sec.icon(); var preficon = sec.icon();
var icon = (sec.isAttacked() ? Fonts.getLargeIcon("warning") : !sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ? Fonts.getLargeIcon("terrain") : preficon); var icon =
sec.isAttacked() ? Fonts.getLargeIcon("warning") :
!sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ?
Fonts.getLargeIcon("terrain") :
sec.preset != null && sec.preset.locked() && sec.preset.node() != null && !sec.preset.node().parent.content.locked() ? Fonts.getLargeIcon("lock") :
preficon;
var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color; var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color;
if(icon != null){ if(icon != null){
@@ -690,7 +702,21 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row(); stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();
if(!sector.hasBase()){ boolean locked = sector.preset != null && sector.preset.locked() && sector.preset.node() != null;
if(locked){
stable.table(r -> {
r.add("@complete").colspan(2).left();
r.row();
for(Objective o : sector.preset.node().objectives){
if(o.complete()) continue;
r.add("> " + o.display()).color(Color.lightGray).left();
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
r.row();
}
}).row();
}else if(!sector.hasBase()){
stable.add(Core.bundle.get("sectors.threat") + " [accent]" + sector.displayThreat()).row(); stable.add(Core.bundle.get("sectors.threat") + " [accent]" + sector.displayThreat()).row();
} }
@@ -730,13 +756,23 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
if((sector.hasBase() && mode == look) || canSelect(sector) || (sector.preset != null && sector.preset.alwaysUnlocked) || debugSelect){ if((sector.hasBase() && mode == look) || canSelect(sector) || (sector.preset != null && sector.preset.alwaysUnlocked) || debugSelect){
stable.button(mode == select ? "@sectors.select" : sector.isBeingPlayed() ? "@sectors.resume" : sector.hasBase() ? "@sectors.go" : "@sectors.launch", Icon.play, () -> { stable.button(
mode == select ? "@sectors.select" :
sector.isBeingPlayed() ? "@sectors.resume" :
sector.hasBase() ? "@sectors.go" :
locked ? "@locked" : "@sectors.launch",
locked ? Icon.lock :Icon.play, () -> {
if(sector.isBeingPlayed()){ if(sector.isBeingPlayed()){
//already at this sector //already at this sector
hide(); hide();
return; return;
} }
if(sector.preset != null && sector.preset.locked()){
return;
}
boolean shouldHide = true; boolean shouldHide = true;
//save before launch. //save before launch.
@@ -778,7 +814,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
if(shouldHide) hide(); if(shouldHide) hide();
}).growX().height(54f).minWidth(170f).padTop(4); }).growX().height(54f).minWidth(170f).padTop(4).disabled(locked);
} }
stable.pack(); stable.pack();

View File

@@ -172,6 +172,7 @@ public class HintsFragment extends Fragment{
&& SectorPresets.frozenForest.unlocked() && SectorPresets.frozenForest.unlocked()
&& SectorPresets.frozenForest.sector.save == null, && SectorPresets.frozenForest.sector.save == null,
() -> state.isCampaign() && state.getSector().preset == SectorPresets.frozenForest), () -> state.isCampaign() && state.getSector().preset == SectorPresets.frozenForest),
coreIncinerate(() -> state.isCampaign() && state.rules.defaultTeam.core() != null && state.rules.defaultTeam.core().items.get(Items.copper) >= state.rules.defaultTeam.core().storageCapacity - 10, () -> false),
; ;
@Nullable @Nullable

View File

@@ -255,7 +255,7 @@ public class Conveyor extends Block implements Autotiler{
} }
public boolean pass(Item item){ public boolean pass(Item item){
if(next != null && next.team == team && next.acceptItem(this, item)){ if(item != null && next != null && next.team == team && next.acceptItem(this, item)){
next.handleItem(this, item); next.handleItem(this, item);
return true; return true;
} }

View File

@@ -27,6 +27,8 @@ import java.util.zip.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class LogicBlock extends Block{ public class LogicBlock extends Block{
private static final int maxByteLen = 1024 * 500;
public int maxInstructionScale = 5; public int maxInstructionScale = 5;
public int instructionsPerTick = 1; public int instructionsPerTick = 1;
public float range = 8 * 10; public float range = 8 * 10;
@@ -137,6 +139,9 @@ public class LogicBlock extends Block{
stream.read(); stream.read();
int bytelen = stream.readInt(); int bytelen = stream.readInt();
if(bytelen > maxByteLen) throw new RuntimeException("Malformed logic data! Length: " + bytelen);
byte[] bytes = new byte[bytelen]; byte[] bytes = new byte[bytelen];
stream.readFully(bytes); stream.readFully(bytes);
@@ -197,6 +202,7 @@ public class LogicBlock extends Block{
int version = stream.read(); int version = stream.read();
int bytelen = stream.readInt(); int bytelen = stream.readInt();
if(bytelen > maxByteLen) throw new RuntimeException("Malformed logic data! Length: " + bytelen);
byte[] bytes = new byte[bytelen]; byte[] bytes = new byte[bytelen];
stream.readFully(bytes); stream.readFully(bytes);

View File

@@ -0,0 +1,8 @@
[This is a truncated changelog, see Github for full notes]
- Added disclaimer for community servers
- Added hints concerning core upgrades and numbered sectors
- Decreased spore storm opacity
- Made items stay inside reconstructors when rebuilding (Contributed by @Quezler)
- Made early game procedural sectors slightly easier
- Fixed some blocks having duplicate research dependencies
- Fixed legacy research not being cleared after first import

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=3ed298e35dafc98667875c397c7cb0d0f1fcbc07 archash=d44cbae08716cfe97012c84399a1e61854d6b16c

View File

@@ -58,6 +58,7 @@ public class ApplicationTests{
add(netServer = new NetServer()); add(netServer = new NetServer());
content.init(); content.init();
} }
@Override @Override
@@ -77,9 +78,15 @@ public class ApplicationTests{
} }
Thread.sleep(10); Thread.sleep(10);
} }
Block block = content.getByName(ContentType.block, "build2");
assertEquals("build2", block == null ? null : block.name, "2x2 construct block doesn't exist?");
}catch(Throwable r){ }catch(Throwable r){
fail(r); fail(r);
} }
Log.info("init app");
} }
@BeforeEach @BeforeEach
@@ -496,8 +503,8 @@ public class ApplicationTests{
void buildingOverlap(){ void buildingOverlap(){
initBuilding(); initBuilding();
Builderc d1 = (Builderc)UnitTypes.poly.create(Team.sharded); Unit d1 = UnitTypes.poly.create(Team.sharded);
Builderc d2 = (Builderc)UnitTypes.poly.create(Team.sharded); Unit d2 = UnitTypes.poly.create(Team.sharded);
//infinite build range //infinite build range
state.rules.editor = true; state.rules.editor = true;
@@ -523,8 +530,8 @@ public class ApplicationTests{
void buildingDestruction(){ void buildingDestruction(){
initBuilding(); initBuilding();
Builderc d1 = (Builderc)UnitTypes.poly.create(Team.sharded); Builderc d1 = UnitTypes.poly.create(Team.sharded);
Builderc d2 = (Builderc)UnitTypes.poly.create(Team.sharded); Builderc d2 = UnitTypes.poly.create(Team.sharded);
d1.set(10f, 20f); d1.set(10f, 20f);
d2.set(10f, 20f); d2.set(10f, 20f);

View File

@@ -34,7 +34,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
public void createGenerator(InputType inputType){ public void createGenerator(InputType inputType){
Vars.state = new GameState(); Vars.state = new GameState();
Vars.state.rules = new Rules(); Vars.state.rules = new Rules();
generator = new ItemLiquidGenerator(inputType != InputType.liquids, inputType != InputType.items, "fakegen"){ generator = new ItemLiquidGenerator(inputType != InputType.liquids, inputType != InputType.items, "fakegen" + System.nanoTime()){
{ {
powerProduction = 0.1f; powerProduction = 0.1f;
itemDuration = fakeItemDuration; itemDuration = fakeItemDuration;

View File

@@ -25,38 +25,46 @@ public class PowerTestFixture{
@BeforeAll @BeforeAll
static void initializeDependencies(){ static void initializeDependencies(){
Log.info("init power test fixture");
headless = true; headless = true;
Core.graphics = new FakeGraphics(); Core.graphics = new FakeGraphics();
Core.files = new MockFiles(); Core.files = new MockFiles();
Vars.content = new ContentLoader(){
@Override
public void handleMappableContent(MappableContent content){
} boolean make = content == null;
};
if(make){
Vars.content = new ContentLoader(){
@Override
public void handleMappableContent(MappableContent content){
}
};
}
Vars.state = new GameState(); Vars.state = new GameState();
Vars.tree = new FileTree(); Vars.tree = new FileTree();
content.createBaseContent(); if(make){
content.createBaseContent();
}
Log.useColors = false; Log.useColors = false;
Time.setDeltaProvider(() -> 0.5f); Time.setDeltaProvider(() -> 0.5f);
} }
protected static PowerGenerator createFakeProducerBlock(float producedPower){ protected static PowerGenerator createFakeProducerBlock(float producedPower){
return new PowerGenerator("fakegen"){{ return new PowerGenerator("fakegen" + System.nanoTime()){{
buildType = () -> new GeneratorBuild(); buildType = () -> new GeneratorBuild();
powerProduction = producedPower; powerProduction = producedPower;
}}; }};
} }
protected static Battery createFakeBattery(float capacity){ protected static Battery createFakeBattery(float capacity){
return new Battery("fakebattery"){{ return new Battery("fakebattery" + System.nanoTime()){{
buildType = () -> new BatteryBuild(); buildType = () -> new BatteryBuild();
consumes.powerBuffered(capacity); consumes.powerBuffered(capacity);
}}; }};
} }
protected static Block createFakeDirectConsumer(float powerPerTick){ protected static Block createFakeDirectConsumer(float powerPerTick){
return new PowerBlock("fakedirectconsumer"){{ return new PowerBlock("fakedirectconsumer" + System.nanoTime()){{
buildType = Building::create; buildType = Building::create;
consumes.power(powerPerTick); consumes.power(powerPerTick);
}}; }};