Merge branch 'master' into crater
This commit is contained in:
@@ -39,6 +39,8 @@ be.check = Check for updates
|
||||
schematic = Schematic
|
||||
schematic.add = Save Schematic...
|
||||
schematics = Schematics
|
||||
schematic.replace = A schematic by that name already exists. Replace it?
|
||||
schematic.exists = A schematic by that name already exists.
|
||||
schematic.import = Import Schematic...
|
||||
schematic.exportfile = Export File
|
||||
schematic.importfile = Import File
|
||||
@@ -775,6 +777,7 @@ rules.respawntime = Respawn Time:[lightgray] (sec)
|
||||
rules.wavespacing = Wave Spacing:[lightgray] (sec)
|
||||
rules.buildcostmultiplier = Build Cost Multiplier
|
||||
rules.buildspeedmultiplier = Build Speed Multiplier
|
||||
rules.deconstructrefundmultiplier = Deconstruct Refund Multiplier
|
||||
rules.waitForWaveToEnd = Waves Wait for Enemies
|
||||
rules.dropzoneradius = Drop Zone Radius:[lightgray] (tiles)
|
||||
rules.respawns = Max respawns per wave
|
||||
|
||||
@@ -5,7 +5,7 @@ const log = function(context, obj){
|
||||
var scriptName = "base.js"
|
||||
var modName = "none"
|
||||
|
||||
const print = text => log(scriptName, text);
|
||||
const print = text => log(modName + "/" + scriptName, text);
|
||||
|
||||
const extendContent = function(classType, name, params){
|
||||
return new JavaAdapter(classType, params, name)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.core;
|
||||
|
||||
import arc.files.*;
|
||||
import arc.struct.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
@@ -182,6 +183,9 @@ public class ContentLoader{
|
||||
}
|
||||
if(currentMod != null){
|
||||
content.minfo.mod = currentMod;
|
||||
if(content.minfo.sourceFile == null){
|
||||
content.minfo.sourceFile = new Fi(content.name);
|
||||
}
|
||||
}
|
||||
contentNameMap[content.getContentType().ordinal()].put(content.name, content);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ public class Rules{
|
||||
public float buildCostMultiplier = 1f;
|
||||
/** Multiplier for building speed. */
|
||||
public float buildSpeedMultiplier = 1f;
|
||||
/** Multiplier for percentage of materials refunded when deconstructing */
|
||||
public float deconstructRefundMultiplier = 0.5f;
|
||||
/** No-build zone around enemy core radius. */
|
||||
public float enemyCoreBuildRadius = 400f;
|
||||
/** Radius around enemy wave drop zones.*/
|
||||
|
||||
@@ -60,16 +60,13 @@ public class IndexedRenderer implements Disposable{
|
||||
|
||||
updateMatrix();
|
||||
|
||||
program.begin();
|
||||
|
||||
program.bind();
|
||||
texture.bind();
|
||||
|
||||
program.setUniformMatrix4("u_projTrans", BatchShader.copyTransform(combined));
|
||||
program.setUniformi("u_texture", 0);
|
||||
|
||||
mesh.render(program, Gl.triangles, 0, vertices.length / vsize);
|
||||
|
||||
program.end();
|
||||
}
|
||||
|
||||
public void setColor(Color color){
|
||||
|
||||
@@ -255,10 +255,19 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(lastSchematic == null) return;
|
||||
|
||||
ui.showTextInput("$schematic.add", "$name", "", text -> {
|
||||
lastSchematic.tags.put("name", text);
|
||||
schematics.add(lastSchematic);
|
||||
ui.showInfoFade("$schematic.saved");
|
||||
ui.schematics.showInfo(lastSchematic);
|
||||
Schematic replacement = schematics.all().find(s -> s.name().equals(text));
|
||||
if(replacement != null){
|
||||
ui.showConfirm("$confirm", "$schematic.replace", () -> {
|
||||
schematics.overwrite(replacement, lastSchematic);
|
||||
ui.showInfoFade("$schematic.saved");
|
||||
ui.schematics.showInfo(replacement);
|
||||
});
|
||||
}else{
|
||||
lastSchematic.tags.put("name", text);
|
||||
schematics.add(lastSchematic);
|
||||
ui.showInfoFade("$schematic.saved");
|
||||
ui.schematics.showInfo(lastSchematic);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,9 @@ public class Scripts implements Disposable{
|
||||
context.evaluateString(scope, script, file, 1, null);
|
||||
return true;
|
||||
}catch(Throwable t){
|
||||
if(currentMod != null){
|
||||
file = currentMod.name + "/" + file;
|
||||
}
|
||||
log(LogLevel.err, file, "" + getError(t));
|
||||
return false;
|
||||
}
|
||||
@@ -124,6 +127,8 @@ public class Scripts implements Disposable{
|
||||
if(!dir.exists()) return null; // Mod and folder not found
|
||||
return loadSource(script, dir, validator);
|
||||
}
|
||||
|
||||
currentMod = required;
|
||||
return loadSource(script, required.root.child("scripts"), validator);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
check("$rules.reactorexplosions", b -> rules.reactorExplosions = b, () -> rules.reactorExplosions);
|
||||
number("$rules.buildcostmultiplier", false, f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier, () -> !rules.infiniteResources);
|
||||
number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
|
||||
number("$rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources);
|
||||
number("$rules.blockhealthmultiplier", f -> rules.blockHealthMultiplier = f, () -> rules.blockHealthMultiplier);
|
||||
|
||||
main.addButton("$configure",
|
||||
|
||||
@@ -90,6 +90,13 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
buttons.addImageButton(Icon.pencil, style, () -> {
|
||||
ui.showTextInput("$schematic.rename", "$name", s.name(), res -> {
|
||||
Schematic replacement = schematics.all().find(other -> other.name().equals(res) && other != s);
|
||||
if(replacement != null){
|
||||
//renaming to an existing schematic is not allowed, as it is not clear how the tags would be merged, and which one should be removed
|
||||
ui.showErrorMessage("$schematic.exists");
|
||||
return;
|
||||
}
|
||||
|
||||
s.tags.put("name", res);
|
||||
s.save();
|
||||
rebuildPane[0].run();
|
||||
|
||||
@@ -252,7 +252,7 @@ public class BuildBlock extends Block{
|
||||
}
|
||||
|
||||
public void deconstruct(Unit builder, @Nullable TileEntity core, float amount){
|
||||
float deconstructMultiplier = 0.5f;
|
||||
float deconstructMultiplier = state.rules.deconstructRefundMultiplier;
|
||||
|
||||
if(cblock != null){
|
||||
ItemStack[] requirements = cblock.requirements;
|
||||
|
||||
Reference in New Issue
Block a user