Research tweaks
This commit is contained in:
Binary file not shown.
@@ -1864,7 +1864,7 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
dataProcessor = new ResearchBlock("data-processor"){{
|
dataProcessor = new ResearchBlock("data-processor"){{
|
||||||
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 200, Items.lead, 100));
|
//requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 200, Items.lead, 100));
|
||||||
|
|
||||||
size = 3;
|
size = 3;
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
|
|||||||
@@ -171,6 +171,15 @@ public class Logic implements ApplicationListener{
|
|||||||
Core.settings.manualSave();
|
Core.settings.manualSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void skipWave(){
|
||||||
|
if(state.isCampaign()){
|
||||||
|
//warp time spent forward because the wave was just skipped.
|
||||||
|
state.secinfo.internalTimeSpent += state.wavetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
state.wavetime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void runWave(){
|
public void runWave(){
|
||||||
spawner.spawnEnemies();
|
spawner.spawnEnemies();
|
||||||
state.wave++;
|
state.wave++;
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
if(action == AdminAction.wave){
|
if(action == AdminAction.wave){
|
||||||
//no verification is done, so admins can hypothetically spam waves
|
//no verification is done, so admins can hypothetically spam waves
|
||||||
//not a real issue, because server owners may want to do just that
|
//not a real issue, because server owners may want to do just that
|
||||||
state.wavetime = 0f;
|
logic.skipWave();
|
||||||
}else if(action == AdminAction.ban){
|
}else if(action == AdminAction.ban){
|
||||||
netServer.admins.banPlayerIP(other.con.address);
|
netServer.admins.banPlayerIP(other.con.address);
|
||||||
other.kick(KickReason.banned);
|
other.kick(KickReason.banned);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public DatabaseDialog database;
|
public DatabaseDialog database;
|
||||||
public ContentInfoDialog content;
|
public ContentInfoDialog content;
|
||||||
public PlanetDialog planet;
|
public PlanetDialog planet;
|
||||||
public TechTreeDialog tech;
|
public ResearchDialog research;
|
||||||
public SchematicsDialog schematics;
|
public SchematicsDialog schematics;
|
||||||
public ModsDialog mods;
|
public ModsDialog mods;
|
||||||
public ColorPicker picker;
|
public ColorPicker picker;
|
||||||
@@ -175,7 +175,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
maps = new MapsDialog();
|
maps = new MapsDialog();
|
||||||
content = new ContentInfoDialog();
|
content = new ContentInfoDialog();
|
||||||
planet = new PlanetDialog();
|
planet = new PlanetDialog();
|
||||||
tech = new TechTreeDialog();
|
research = new ResearchDialog();
|
||||||
mods = new ModsDialog();
|
mods = new ModsDialog();
|
||||||
schematics = new SchematicsDialog();
|
schematics = new SchematicsDialog();
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import mindustry.game.Rules.*;
|
|||||||
import mindustry.game.Teams.*;
|
import mindustry.game.Teams.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||||
|
import mindustry.world.modules.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -71,6 +72,12 @@ public class Team implements Comparable<Team>{
|
|||||||
hasPalette = true;
|
hasPalette = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return the core items for this team, or an empty item module.
|
||||||
|
* Never add to the resulting item module, as it is mutable. */
|
||||||
|
public @NonNull ItemModule items(){
|
||||||
|
return core() == null ? ItemModule.empty : core().items;
|
||||||
|
}
|
||||||
|
|
||||||
/** @return the team-specific rules. */
|
/** @return the team-specific rules. */
|
||||||
public TeamRule rules(){
|
public TeamRule rules(){
|
||||||
return state.rules.teams.get(this);
|
return state.rules.teams.get(this);
|
||||||
|
|||||||
@@ -333,6 +333,19 @@ public class DesktopInput extends InputHandler{
|
|||||||
table.button(Icon.paste, Styles.clearPartiali, () -> {
|
table.button(Icon.paste, Styles.clearPartiali, () -> {
|
||||||
ui.schematics.show();
|
ui.schematics.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
table.button(Icon.tree, Styles.clearPartiali, () -> {
|
||||||
|
ui.research.show();
|
||||||
|
}).visible(() -> state.isCampaign());
|
||||||
|
|
||||||
|
table.button(Icon.map, Styles.clearPartiali, () -> {
|
||||||
|
ui.planet.show();
|
||||||
|
}).visible(() -> state.isCampaign());
|
||||||
|
|
||||||
|
table.button(Icon.up, Styles.clearPartiali, () -> {
|
||||||
|
ui.planet.show(state.getSector(), player.team().core());
|
||||||
|
}).visible(() -> state.isCampaign())
|
||||||
|
.disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements));
|
||||||
}
|
}
|
||||||
|
|
||||||
void pollInput(){
|
void pollInput(){
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ public class PausedDialog extends BaseDialog{
|
|||||||
// cont.button("$database", Icon.book, ui.database::show);
|
// cont.button("$database", Icon.book, ui.database::show);
|
||||||
//}
|
//}
|
||||||
//TODO remove
|
//TODO remove
|
||||||
cont.button("launch core", Icon.warning, () -> ui.planet.show(state.getSector(), player.team().core()))
|
cont.button("nothing", Icon.warning, () -> ui.showInfo("no"));
|
||||||
.disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements))
|
|
||||||
.visible(() -> state.isCampaign());
|
|
||||||
cont.button("$settings", Icon.settings, ui.settings::show);
|
cont.button("$settings", Icon.settings, ui.settings::show);
|
||||||
|
|
||||||
if(!state.rules.tutorial){
|
if(!state.rules.tutorial){
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
//draw all sector stuff
|
//draw all sector stuff
|
||||||
for(Sector sec : planet.sectors){
|
for(Sector sec : planet.sectors){
|
||||||
if(selectAlpha > 0.01f){
|
if(selectAlpha > 0.01f){
|
||||||
if(/*canLaunch(sec) || sec.unlocked()*/true){
|
if(canLaunch(sec) || sec.unlocked()){
|
||||||
if(sec.baseCoverage > 0){
|
if(sec.baseCoverage > 0){
|
||||||
planets.fill(sec, Tmp.c1.set(Team.crux.color).a(0.1f * sec.baseCoverage * selectAlpha), -0.002f);
|
planets.fill(sec, Tmp.c1.set(Team.crux.color).a(0.1f * sec.baseCoverage * selectAlpha), -0.002f);
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
new Table(t -> {
|
new Table(t -> {
|
||||||
//TODO localize
|
//TODO localize
|
||||||
t.top();
|
t.top();
|
||||||
t.label(() -> "Turn " + universe.turn()).style(Styles.outlineLabel).color(Pal.accent);
|
t.label(() -> mode == launch ? "Select Launch Sector" : "Turn " + universe.turn()).style(Styles.outlineLabel).color(Pal.accent);
|
||||||
})).grow();
|
})).grow();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
if(doBuffer){
|
if(doBuffer){
|
||||||
buffer.end();
|
buffer.end();
|
||||||
|
|
||||||
buffer.blit(Shaders.screenspace);
|
Draw.color(color);
|
||||||
|
Draw.rect(Draw.wrap(buffer.getTexture()), width/2f, height/2f, width, -height);
|
||||||
|
Draw.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +304,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
if(sector.hasBase() && sector.hasWaves()){
|
if(sector.hasBase() && sector.hasWaves()){
|
||||||
stable.add("[scarlet]Under attack!");
|
stable.add("[scarlet]Under attack!");
|
||||||
stable.row();
|
stable.row();
|
||||||
stable.add("[accent]" + Mathf.ceil(sectorDestructionTurns - (sector.getSecondsPassed() * 60) / turnDuration) + " turn(s) until destruction");
|
stable.add("[accent]" + Mathf.ceil(sectorDestructionTurns - (sector.getSecondsPassed() * 60) / turnDuration) + " turn(s)\nuntil destruction");
|
||||||
stable.row();
|
stable.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package mindustry.ui.dialogs;
|
package mindustry.ui.dialogs;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.func.*;
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.input.*;
|
import arc.input.*;
|
||||||
@@ -12,12 +11,12 @@ import arc.scene.actions.*;
|
|||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.Stack;
|
|
||||||
import arc.scene.ui.layout.*;
|
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.content.TechTree.*;
|
||||||
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.Objectives.*;
|
import mindustry.game.Objectives.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -25,25 +24,25 @@ import mindustry.type.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.layout.*;
|
import mindustry.ui.layout.*;
|
||||||
import mindustry.ui.layout.TreeLayout.*;
|
import mindustry.ui.layout.TreeLayout.*;
|
||||||
|
import mindustry.world.modules.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class TechTreeDialog extends BaseDialog{
|
public class ResearchDialog extends BaseDialog{
|
||||||
private final float nodeSize = Scl.scl(60f);
|
private final float nodeSize = Scl.scl(60f);
|
||||||
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
||||||
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
||||||
private Rect bounds = new Rect();
|
private Rect bounds = new Rect();
|
||||||
private View view;
|
private View view;
|
||||||
private Cons<TechNode> selector = c -> {};
|
|
||||||
|
|
||||||
public TechTreeDialog(){
|
public ResearchDialog(){
|
||||||
super("");
|
super("");
|
||||||
|
|
||||||
titleTable.remove();
|
titleTable.remove();
|
||||||
margin(0f).marginBottom(8);
|
margin(0f).marginBottom(8);
|
||||||
Stack stack = cont.stack(view = new View()/*, items = new ItemsDisplay()*/).grow().get();
|
cont.add(view = new View()).grow().get();
|
||||||
|
|
||||||
shouldPause = true;
|
shouldPause = true;
|
||||||
|
|
||||||
@@ -105,13 +104,8 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dialog show(Cons<TechNode> selector){
|
ItemModule items(){
|
||||||
this.selector = selector;
|
return state.rules.defaultTeam.items();
|
||||||
return super.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dialog show(){
|
|
||||||
return show(c -> {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void treeLayout(){
|
void treeLayout(){
|
||||||
@@ -262,13 +256,9 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if(locked(node.node)){
|
}else if(items().has(node.node.requirements) && locked(node.node)){
|
||||||
selector.get(node.node);
|
unlock(node.node);
|
||||||
}
|
}
|
||||||
//TODO select it
|
|
||||||
//else if(data.hasItems(node.node.requirements) && locked(node.node)){
|
|
||||||
// unlock(node.node);
|
|
||||||
//}
|
|
||||||
});
|
});
|
||||||
button.hovered(() -> {
|
button.hovered(() -> {
|
||||||
if(!mobile && hoverNode != button && node.visible){
|
if(!mobile && hoverNode != button && node.visible){
|
||||||
@@ -288,7 +278,7 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
button.update(() -> {
|
button.update(() -> {
|
||||||
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
||||||
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
||||||
button.getStyle().up = !locked(node.node) ? Tex.buttonOver : Tex.button;
|
button.getStyle().up = !locked(node.node) ? Tex.buttonOver : !items().has(node.node.requirements) ? Tex.buttonRed : Tex.button;
|
||||||
((TextureRegionDrawable)button.getStyle().imageUp)
|
((TextureRegionDrawable)button.getStyle().imageUp)
|
||||||
.setRegion(node.visible ? node.node.content.icon(Cicon.medium) : Icon.lock.getRegion());
|
.setRegion(node.visible ? node.node.content.icon(Cicon.medium) : Icon.lock.getRegion());
|
||||||
button.getImage().setColor(!locked(node.node) ? Color.white : Color.gray);
|
button.getImage().setColor(!locked(node.node) ? Color.white : Color.gray);
|
||||||
@@ -323,11 +313,9 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
panY = ry - bounds.y - oy;
|
panY = ry - bounds.y - oy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void unlock(TechNode node){
|
void unlock(TechNode node){
|
||||||
data.unlockContent(node.content);
|
node.content.unlock();
|
||||||
//TODO this should not happen
|
items().remove(node.requirements);
|
||||||
//data.removeItems(node.requirements);
|
|
||||||
showToast(Core.bundle.format("researched", node.content.localizedName));
|
showToast(Core.bundle.format("researched", node.content.localizedName));
|
||||||
checkNodes(root);
|
checkNodes(root);
|
||||||
hoverNode = null;
|
hoverNode = null;
|
||||||
@@ -336,7 +324,7 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
Core.scene.act();
|
Core.scene.act();
|
||||||
Sounds.unlock.play();
|
Sounds.unlock.play();
|
||||||
Events.fire(new ResearchEvent(node.content));
|
Events.fire(new ResearchEvent(node.content));
|
||||||
}*/
|
}
|
||||||
|
|
||||||
void rebuild(){
|
void rebuild(){
|
||||||
ImageButton button = hoverNode;
|
ImageButton button = hoverNode;
|
||||||
@@ -379,7 +367,7 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
list.image(req.item.icon(Cicon.small)).size(8 * 3).padRight(3);
|
list.image(req.item.icon(Cicon.small)).size(8 * 3).padRight(3);
|
||||||
list.add(req.item.localizedName).color(Color.lightGray);
|
list.add(req.item.localizedName).color(Color.lightGray);
|
||||||
list.label(() -> " " + (player.team().core() != null ? Math.min(player.team().core().items.get(req.item), req.amount) + " / " : "") + req.amount)
|
list.label(() -> " " + (player.team().core() != null ? Math.min(player.team().core().items.get(req.item), req.amount) + " / " : "") + req.amount)
|
||||||
.update(l -> {}/*l.setColor(data.has(req.item, req.amount) ? Color.lightGray : Color.scarlet)*/);//TODO
|
.update(l -> l.setColor(items().has(req.item, req.amount) ? Color.lightGray : Color.scarlet));//TODO
|
||||||
}).fillX().left();
|
}).fillX().left();
|
||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
@@ -404,13 +392,11 @@ public class TechTreeDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
}).pad(9);
|
}).pad(9);
|
||||||
|
|
||||||
//TODO research select button
|
|
||||||
/*
|
|
||||||
if(mobile && locked(node)){
|
if(mobile && locked(node)){
|
||||||
b.row();
|
b.row();
|
||||||
b.button("$research", Icon.ok, Styles.nodet, () -> unlock(node))
|
b.button("$research", Icon.ok, Styles.nodet, () -> unlock(node))
|
||||||
.disabled(i -> !data.hasItems(node.requirements)).growX().height(44f).colspan(3);
|
.disabled(i -> !items().has(node.requirements)).growX().height(44f).colspan(3);
|
||||||
}*/
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
infoTable.row();
|
infoTable.row();
|
||||||
@@ -114,7 +114,7 @@ public class HudFragment extends Fragment{
|
|||||||
ui.chatfrag.toggle();
|
ui.chatfrag.toggle();
|
||||||
}
|
}
|
||||||
}else if(state.isCampaign()){
|
}else if(state.isCampaign()){
|
||||||
ui.tech.show();
|
ui.research.show();
|
||||||
}else{
|
}else{
|
||||||
ui.database.show();
|
ui.database.show();
|
||||||
}
|
}
|
||||||
@@ -134,13 +134,6 @@ public class HudFragment extends Fragment{
|
|||||||
cont.row();
|
cont.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO BUTTONS FOR VIEWING EXPORTS/IMPORTS/RESEARCH/MAP/ETC
|
|
||||||
/*
|
|
||||||
cont.table(t -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
cont.row();*/
|
|
||||||
|
|
||||||
cont.update(() -> {
|
cont.update(() -> {
|
||||||
if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){
|
if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){
|
||||||
toggleMenus();
|
toggleMenus();
|
||||||
@@ -683,9 +676,9 @@ public class HudFragment extends Fragment{
|
|||||||
if(net.client() && player.admin){
|
if(net.client() && player.admin){
|
||||||
Call.adminRequest(player, AdminAction.wave);
|
Call.adminRequest(player, AdminAction.wave);
|
||||||
}else if(inLaunchWave()){
|
}else if(inLaunchWave()){
|
||||||
ui.showConfirm("$confirm", "$launch.skip.confirm", () -> !canSkipWave(), () -> state.wavetime = 0f);
|
ui.showConfirm("$confirm", "$launch.skip.confirm", () -> !canSkipWave(), () -> logic.skipWave());
|
||||||
}else{
|
}else{
|
||||||
state.wavetime = 0f;
|
logic.skipWave();
|
||||||
}
|
}
|
||||||
}).growY().fillX().right().width(40f)
|
}).growY().fillX().right().width(40f)
|
||||||
.visible(this::canSkipWave);
|
.visible(this::canSkipWave);
|
||||||
|
|||||||
@@ -178,10 +178,11 @@ public class ResearchBlock extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean configTapped(){
|
public boolean configTapped(){
|
||||||
//configure with tech node
|
//configure with tech node
|
||||||
ui.tech.show(node -> {
|
ui.showInfo("this does nothing");
|
||||||
configure(node);
|
//ui.research.show(node -> {
|
||||||
ui.tech.hide();
|
// configure(node);
|
||||||
});
|
// ui.research.hide();
|
||||||
|
//});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import java.util.*;
|
|||||||
import static mindustry.Vars.content;
|
import static mindustry.Vars.content;
|
||||||
|
|
||||||
public class ItemModule extends BlockModule{
|
public class ItemModule extends BlockModule{
|
||||||
|
public static final ItemModule empty = new ItemModule();
|
||||||
|
|
||||||
private static final int windowSize = 60 * 4;
|
private static final int windowSize = 60 * 4;
|
||||||
private static WindowedMean[] cacheFlow;
|
private static WindowedMean[] cacheFlow;
|
||||||
private static float[] cacheSums;
|
private static float[] cacheSums;
|
||||||
|
|||||||
Reference in New Issue
Block a user