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

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

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());
} }
t.row(); if(reload > 0){
t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shoot.shots, 2) + " " + StatUnit.perSecond.localized()); t.row();
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);
} }

View File

@@ -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

View File

@@ -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,31 +577,39 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}), }),
new Table(c -> { new Table(c -> {
c.visible(() -> !(graphics.isPortrait() && mobile)); expandTable = c;
if(state.planet.sectors.contains(Sector::hasBase)){
int attacked = state.planet.sectors.count(Sector::isAttacked);
//sector notifications & search
c.top().right();
c.defaults().width(290f);
c.button(bundle.get("sectorlist") +
(attacked == 0 ? "" : "\n[red]⚠[lightgray] " + bundle.format("sectorlist.attacked", "[red]" + attacked + "[]")),
Icon.downOpen, Styles.squareTogglet, () -> sectorsShown = !sectorsShown)
.height(60f).checked(b -> {
Image image = (Image)b.getCells().first().get();
image.setDrawable(sectorsShown ? Icon.upOpen : Icon.downOpen);
return sectorsShown;
}).with(t -> t.left().margin(7f)).with(t -> t.getLabelCell().grow().left()).row();
c.collapser(t -> {
t.background(Styles.black8);
notifs = t;
rebuildList();
}, false, () -> sectorsShown).padBottom(64f).row();
}
})).grow(); })).grow();
rebuildExpand();
}
void rebuildExpand(){
Table c = expandTable;
c.clear();
c.visible(() -> !(graphics.isPortrait() && mobile));
if(state.planet.sectors.contains(Sector::hasBase)){
int attacked = state.planet.sectors.count(Sector::isAttacked);
//sector notifications & search
c.top().right();
c.defaults().width(290f);
c.button(bundle.get("sectorlist") +
(attacked == 0 ? "" : "\n[red]⚠[lightgray] " + bundle.format("sectorlist.attacked", "[red]" + attacked + "[]")),
Icon.downOpen, Styles.squareTogglet, () -> sectorsShown = !sectorsShown)
.height(60f).checked(b -> {
Image image = (Image)b.getCells().first().get();
image.setDrawable(sectorsShown ? Icon.upOpen : Icon.downOpen);
return sectorsShown;
}).with(t -> t.left().margin(7f)).with(t -> t.getLabelCell().grow().left()).row();
c.collapser(t -> {
t.background(Styles.black8);
notifs = t;
rebuildList();
}, false, () -> sectorsShown).padBottom(64f).row();
}
} }
void rebuildList(){ void rebuildList(){
@@ -1108,25 +1117,21 @@ 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 && planet.sectors.count(s -> s.isAttacked()) < 2){
if(attacked != null){ 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(); dialog.buttons.button("@sector.view", Icon.eyeSmall, () -> {
dialog.buttons.button("@sector.view", Icon.eyeSmall, () -> { dialog.hide();
dialog.hide(); lookAt(attacked);
lookAt(attacked); selected = attacked;
selected = attacked; updateSelected();
updateSelected(); });
}); dialog.show();
dialog.show();
return; return;
}
} }
} }
} }

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