Bugfixes
This commit is contained in:
@@ -401,6 +401,19 @@ public class TechTree implements ContentList{
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//TODO research sectors
|
||||
/*
|
||||
node(SectorPresets.groundZero, () -> {
|
||||
node(SectorPresets.nuclearComplex, () -> {
|
||||
node(SectorPresets.craters, () -> {
|
||||
node(SectorPresets.saltFlats, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
@@ -458,7 +471,7 @@ public class TechTree implements ContentList{
|
||||
/** Extra objectives needed to research this. TODO implement */
|
||||
public Seq<Objective> objectives = new Seq<>();
|
||||
/** Time required to research this content, in seconds. */
|
||||
public float time = 60;
|
||||
public float time;
|
||||
/** Nodes that depend on this node. */
|
||||
public final Seq<TechNode> children = new Seq<>();
|
||||
/** Research progress, in seconds. */
|
||||
@@ -474,6 +487,7 @@ public class TechTree implements ContentList{
|
||||
this.requirements = requirements;
|
||||
this.depth = parent == null ? 0 : parent.depth + 1;
|
||||
this.progress = Core.settings == null ? 0 : Core.settings.getFloat("research-" + content.name, 0f);
|
||||
this.time = Seq.with(requirements).mapFloat(i -> i.item.cost * i.amount).sum() * 10;
|
||||
|
||||
//add dependencies as objectives.
|
||||
content.getDependencies(d -> objectives.add(new Research(d)));
|
||||
|
||||
@@ -36,10 +36,10 @@ public class ContentLoader{
|
||||
new UnitTypes(),
|
||||
new Blocks(),
|
||||
new Loadouts(),
|
||||
new TechTree(),
|
||||
new Weathers(),
|
||||
new Planets(),
|
||||
new SectorPresets()
|
||||
new SectorPresets(),
|
||||
new TechTree(),
|
||||
};
|
||||
|
||||
public ContentLoader(){
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Scripts implements Disposable{
|
||||
.setModuleScriptProvider(new SoftCachingModuleScriptProvider(new ScriptModuleProvider()))
|
||||
.setSandboxed(true).createRequire(context, scope).install(scope);
|
||||
|
||||
if(!run(Core.files.internal("scripts/global.js").readString(), "global.js")){
|
||||
if(!run(Core.files.internal("scripts/global.js").readString(), "global.js", false)){
|
||||
errored = true;
|
||||
}
|
||||
Log.debug("Time to load script engine: @", Time.elapsed());
|
||||
@@ -82,18 +82,18 @@ public class Scripts implements Disposable{
|
||||
|
||||
public void run(LoadedMod mod, Fi file){
|
||||
currentMod = mod;
|
||||
run(file.readString(), file.name());
|
||||
run(file.readString(), file.name(), true);
|
||||
currentMod = null;
|
||||
}
|
||||
|
||||
private boolean run(String script, String file){
|
||||
private boolean run(String script, String file, boolean wrap){
|
||||
try{
|
||||
if(currentMod != null){
|
||||
//inject script info into file (TODO maybe rhino handles this?)
|
||||
//inject script info into file
|
||||
context.evaluateString(scope, "modName = \"" + currentMod.name + "\"\nscriptName = \"" + file + "\"", "initscript.js", 1, null);
|
||||
}
|
||||
context.evaluateString(scope,
|
||||
"(function(){\n" + script + "\n})();",
|
||||
wrap ? "(function(){\n" + script + "\n})();" : script,
|
||||
file, 0, null);
|
||||
return true;
|
||||
}catch(Throwable t){
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.type;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
@@ -9,7 +10,9 @@ import mindustry.ctype.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.generators.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -82,6 +85,11 @@ public class SectorPreset extends UnlockableContent{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion icon(Cicon c){
|
||||
return Icon.terrain.getRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden(){
|
||||
return true;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Links{
|
||||
new LinkEntry("changelog", "https://github.com/Anuken/Mindustry/releases", Icon.list, Pal.accent.cpy()),
|
||||
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Icon.trello, Color.valueOf("026aa7")),
|
||||
new LinkEntry("wiki", "https://mindustrygame.github.io/wiki/", Icon.book, Color.valueOf("0f142f")),
|
||||
new LinkEntry("feathub", "https://github.com/Anuken/Mindustry-Suggestions/issues/new/choose/", Icon.add, Color.valueOf("ebebeb")),
|
||||
new LinkEntry("suggestions", "https://github.com/Anuken/Mindustry-Suggestions/issues/new/choose/", Icon.add, Color.valueOf("ebebeb")),
|
||||
new LinkEntry("reddit", "https://www.reddit.com/r/Mindustry/", Icon.redditAlien, Color.valueOf("ee593b")),
|
||||
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Icon.itchio, Color.valueOf("fa5c5c")),
|
||||
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Icon.googleplay, Color.valueOf("689f38")),
|
||||
|
||||
Reference in New Issue
Block a user