Misc fixes

This commit is contained in:
Anuken
2022-04-09 15:33:39 -04:00
parent 95fa62f572
commit 198f05b112
5 changed files with 63 additions and 46 deletions
+4
View File
@@ -102,6 +102,10 @@ public class Planets{
startSector = 10; startSector = 10;
atmosphereRadIn = -0.01f; atmosphereRadIn = -0.01f;
atmosphereRadOut = 0.3f; atmosphereRadOut = 0.3f;
defaultEnv = Env.underwater | Env.terrestrial;
ruleSetter = r -> {
};
}}; }};
//TODO hide beryllium and others on load in rules //TODO hide beryllium and others on load in rules
+2
View File
@@ -140,8 +140,10 @@ public class Weapon implements Cloneable{
t.row(); t.row();
t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)inaccuracy + " " + StatUnit.degrees.localized()); t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)inaccuracy + " " + StatUnit.degrees.localized());
} }
if(reload > 0){
t.row(); t.row();
t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shoot.shots, 2) + " " + StatUnit.perSecond.localized()); t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shoot.shots, 2) + " " + StatUnit.perSecond.localized());
}
StatValues.ammo(ObjectMap.of(u, bullet)).display(t); StatValues.ammo(ObjectMap.of(u, bullet)).display(t);
} }
@@ -1,6 +1,7 @@
package mindustry.type.weapons; package mindustry.type.weapons;
import arc.math.*; import arc.math.*;
import arc.scene.ui.layout.*;
import mindustry.entities.bullet.*; import mindustry.entities.bullet.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -22,6 +23,11 @@ public class BuildWeapon extends Weapon{
bullet = new BulletType(); bullet = new BulletType();
} }
@Override
public void addStats(UnitType u, Table t){
//no.
}
@Override @Override
public void update(Unit unit, WeaponMount mount){ public void update(Unit unit, WeaponMount mount){
//no //no
@@ -66,7 +66,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
public boolean showed = false, sectorsShown; public boolean showed = false, sectorsShown;
public String searchText = ""; public String searchText = "";
public Table sectorTop = new Table(), notifs = new Table(); public Table sectorTop = new Table(), notifs = new Table(), expandTable = new Table();
public Label hoverLabel = new Label(""); public Label hoverLabel = new Label("");
public PlanetDialog(){ public PlanetDialog(){
@@ -281,6 +281,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
selected = destSec; selected = destSec;
updateSelected(); updateSelected();
rebuildExpand();
} }
//TODO pan over to correct planet //TODO pan over to correct planet
@@ -564,7 +565,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
if(state.planet != planet){ if(state.planet != planet){
newPresets.clear(); newPresets.clear();
state.planet = planet; state.planet = planet;
rebuildList(); rebuildExpand();
} }
settings.put("lastplanet", planet.name); settings.put("lastplanet", planet.name);
}).width(200).height(40).growX().update(bb -> bb.setChecked(state.planet == planet)); }).width(200).height(40).growX().update(bb -> bb.setChecked(state.planet == planet));
@@ -576,6 +577,15 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}), }),
new Table(c -> { new Table(c -> {
expandTable = c;
})).grow();
rebuildExpand();
}
void rebuildExpand(){
Table c = expandTable;
c.clear();
c.visible(() -> !(graphics.isPortrait() && mobile)); c.visible(() -> !(graphics.isPortrait() && mobile));
if(state.planet.sectors.contains(Sector::hasBase)){ if(state.planet.sectors.contains(Sector::hasBase)){
int attacked = state.planet.sectors.count(Sector::isAttacked); int attacked = state.planet.sectors.count(Sector::isAttacked);
@@ -600,7 +610,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
rebuildList(); rebuildList();
}, false, () -> sectorsShown).padBottom(64f).row(); }, false, () -> sectorsShown).padBottom(64f).row();
} }
})).grow();
} }
void rebuildList(){ void rebuildList(){
@@ -1108,12 +1117,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//make sure there are no under-attack sectors (other than this one) //make sure there are no under-attack sectors (other than this one)
for(Planet planet : content.planets()){ for(Planet planet : content.planets()){
if(!planet.allowWaveSimulation && !debugSelect){ if(!planet.allowWaveSimulation && !debugSelect){
int attackedCount = planet.sectors.count(s -> s.isAttacked() && s != sector);
//if there are two or more attacked sectors... something went wrong, don't show the dialog to prevent softlock //if there are two or more attacked sectors... something went wrong, don't show the dialog to prevent softlock
if(attackedCount < 2){
Sector attacked = planet.sectors.find(s -> s.isAttacked() && s != sector); Sector attacked = planet.sectors.find(s -> s.isAttacked() && s != sector);
if(attacked != null){ if(attacked != null && planet.sectors.count(s -> s.isAttacked()) < 2){
BaseDialog dialog = new BaseDialog("@sector.noswitch.title"); BaseDialog dialog = new BaseDialog("@sector.noswitch.title");
dialog.cont.add(bundle.format("sector.noswitch", attacked.name(), attacked.planet.localizedName)).maxWidth(400f).labelAlign(Align.center).center().wrap(); dialog.cont.add(bundle.format("sector.noswitch", attacked.name(), attacked.planet.localizedName)).maxWidth(400f).labelAlign(Align.center).center().wrap();
dialog.addCloseButton(); dialog.addCloseButton();
@@ -1129,7 +1135,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
} }
} }
}
boolean shouldHide = true; boolean shouldHide = true;
+1 -1
View File
@@ -184,7 +184,7 @@ public class Build{
if( if(
check == null || //nothing there check == null || //nothing there
(state.rules.staticFog && !fogControl.isDiscovered(team, wx, wy)) || (state.rules.staticFog && state.rules.fog && !fogControl.isDiscovered(team, wx, wy)) ||
(check.floor().isDeep() && !type.floating && !type.requiresWater && !type.placeableLiquid) || //deep water (check.floor().isDeep() && !type.floating && !type.requiresWater && !type.placeableLiquid) || //deep water
(type == check.block() && check.build != null && rotation == check.build.rotation && type.rotate) || //same block, same rotation (type == check.block() && check.build != null && rotation == check.build.rotation && type.rotate) || //same block, same rotation
!check.interactable(team) || //cannot interact !check.interactable(team) || //cannot interact