Added core schematic selection setting

This commit is contained in:
Anuken
2019-12-29 11:40:52 -05:00
parent e04c592f9e
commit 730d30ef98
6 changed files with 18 additions and 17 deletions

View File

@@ -643,6 +643,7 @@ setting.screenshake.name = Screen Shake
setting.effects.name = Display Effects setting.effects.name = Display Effects
setting.destroyedblocks.name = Display Destroyed Blocks setting.destroyedblocks.name = Display Destroyed Blocks
setting.conveyorpathfinding.name = Conveyor Placement Pathfinding setting.conveyorpathfinding.name = Conveyor Placement Pathfinding
setting.coreselect.name = Allow Schematic Cores
setting.sensitivity.name = Controller Sensitivity setting.sensitivity.name = Controller Sensitivity
setting.saveinterval.name = Save Interval setting.saveinterval.name = Save Interval
setting.seconds = {0} seconds setting.seconds = {0} seconds

View File

@@ -1234,7 +1234,7 @@ public class Blocks implements ContentList{
//region storage //region storage
coreShard = new CoreBlock("core-shard"){{ coreShard = new CoreBlock("core-shard"){{
requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with(Items.titanium, 4000)); requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with());
alwaysUnlocked = true; alwaysUnlocked = true;
health = 1100; health = 1100;
@@ -1243,7 +1243,7 @@ public class Blocks implements ContentList{
}}; }};
coreFoundation = new CoreBlock("core-foundation"){{ coreFoundation = new CoreBlock("core-foundation"){{
requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with(Items.titanium, 400, Items.silicon, 3000)); requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with());
health = 2000; health = 2000;
itemCapacity = 9000; itemCapacity = 9000;
@@ -1251,7 +1251,7 @@ public class Blocks implements ContentList{
}}; }};
coreNucleus = new CoreBlock("core-nucleus"){{ coreNucleus = new CoreBlock("core-nucleus"){{
requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with(Items.titanium, 4000, Items.silicon, 2000, Items.surgealloy, 3000)); requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with());
health = 4000; health = 4000;
itemCapacity = 13000; itemCapacity = 13000;

View File

@@ -3,8 +3,6 @@ package mindustry.content;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.*; import mindustry.game.*;
import java.io.*;
public class Loadouts implements ContentList{ public class Loadouts implements ContentList{
public static Schematic public static Schematic
basicShard, basicShard,
@@ -14,13 +12,9 @@ public class Loadouts implements ContentList{
@Override @Override
public void load(){ public void load(){
try{ basicShard = Schematics.readBase64("bXNjaAB4nD2K2wqAIBiD5ymibnoRn6YnEP1BwUMoBL19FuJ2sbFvUFgYZDaJsLeQrkinN9UJHImsNzlYE7WrIUastuSbnlKx2VJJt+8IQGGKdfO/8J5yrGJSMegLg+YUIA==");
basicShard = Schematics.readBase64("bXNjaAB4nD2K2wqAIBiD5ymibnoRn6YnEP1BwUMoBL19FuJ2sbFvUFgYZDaJsLeQrkinN9UJHImsNzlYE7WrIUastuSbnlKx2VJJt+8IQGGKdfO/8J5yrGJSMegLg+YUIA=="); advancedShard = Schematics.readBase64("bXNjaAB4nD2LjQqAIAyET7OMIOhFfJqeYMxBgSkYCL199gu33fFtB4tOwUTaBCP5QpHFzwtl32DahBeKK1NwPq8hoOcUixwpY+CUxe3XIwBbB/pa6tadVCUP02hgHvp5vZq/0b7pBHPYFOQ=");
advancedShard = Schematics.readBase64("bXNjaAB4nD2LjQqAIAyET7OMIOhFfJqeYMxBgSkYCL199gu33fFtB4tOwUTaBCP5QpHFzwtl32DahBeKK1NwPq8hoOcUixwpY+CUxe3XIwBbB/pa6tadVCUP02hgHvp5vZq/0b7pBHPYFOQ="); basicFoundation = Schematics.readBase64("bXNjaAB4nD1OSQ6DMBBzFhVu8BG+0X8MQyoiJTNSukj8nlCi2Adbtg/GA4OBF8oB00rvyE/9ykafqOIw58A7SWRKy1ZiShhZ5RcOLZhYS1hefQ1gRIeptH9jq/qW2lvc1d2tgWsOfVX/tOwE86AYBA==");
basicFoundation = Schematics.readBase64("bXNjaAB4nD1OSQ6DMBBzFhVu8BG+0X8MQyoiJTNSukj8nlCi2Adbtg/GA4OBF8oB00rvyE/9ykafqOIw58A7SWRKy1ZiShhZ5RcOLZhYS1hefQ1gRIeptH9jq/qW2lvc1d2tgWsOfVX/tOwE86AYBA=="); basicNucleus = Schematics.readBase64("bXNjaAB4nD2MUQqAIBBEJy0s6qOLdJXuYNtCgikYBd2+LNmdj308hkGHtkId7M4YFns4mk/yfB4a48602eDI+mlNznu0FMPFd0wYKCaewl8F0EOueqM+yKSLVfJrNKWnSw/FZGzEGXFG9sy/px4gEBW1");
basicNucleus = Schematics.readBase64("bXNjaAB4nD2MUQqAIBBEJy0s6qOLdJXuYNtCgikYBd2+LNmdj308hkGHtkId7M4YFns4mk/yfB4a48602eDI+mlNznu0FMPFd0wYKCaewl8F0EOueqM+yKSLVfJrNKWnSw/FZGzEGXFG9sy/px4gEBW1");
}catch(IOException e){
throw new RuntimeException(e);
}
} }
} }

View File

@@ -339,7 +339,8 @@ public class Schematics implements Loadable{
for(int cy = oy; cy <= oy2; cy++){ for(int cy = oy; cy <= oy2; cy++){
Tile tile = world.ltile(cx, cy); Tile tile = world.ltile(cx, cy);
if(tile != null && tile.entity != null && !counted.contains(tile.pos()) && !(tile.block() instanceof BuildBlock) && tile.entity.block.isVisible()){ if(tile != null && tile.entity != null && !counted.contains(tile.pos()) && !(tile.block() instanceof BuildBlock)
&& (tile.entity.block.isVisible() || (tile.entity.block instanceof CoreBlock && Core.settings.getBool("coreselect")))){
int config = tile.entity.config(); int config = tile.entity.config();
if(tile.block().posConfig){ if(tile.block().posConfig){
config = Pos.get(Pos.x(config) + offsetX, Pos.y(config) + offsetY); config = Pos.get(Pos.x(config) + offsetX, Pos.y(config) + offsetY);
@@ -368,8 +369,12 @@ public class Schematics implements Loadable{
//region IO methods //region IO methods
/** Loads a schematic from base64. May throw an exception. */ /** Loads a schematic from base64. May throw an exception. */
public static Schematic readBase64(String schematic) throws IOException{ public static Schematic readBase64(String schematic){
return read(new ByteArrayInputStream(Base64Coder.decode(schematic))); try{
return read(new ByteArrayInputStream(Base64Coder.decode(schematic)));
}catch(IOException e){
throw new RuntimeException(e);
}
} }
public static Schematic read(Fi file) throws IOException{ public static Schematic read(Fi file) throws IOException{

View File

@@ -163,7 +163,7 @@ public class SchematicsDialog extends FloatingDialog{
setup(); setup();
ui.showInfoFade("$schematic.saved"); ui.showInfoFade("$schematic.saved");
showInfo(s); showInfo(s);
}catch(Exception e){ }catch(Throwable e){
ui.showException(e); ui.showException(e);
} }
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || !Core.app.getClipboardText().startsWith(schematicBaseStart)); }).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || !Core.app.getClipboardText().startsWith(schematicBaseStart));

View File

@@ -229,6 +229,7 @@ public class SettingsMenuDialog extends SettingsDialog{
game.checkPref("savecreate", true); game.checkPref("savecreate", true);
game.checkPref("blockreplace", true); game.checkPref("blockreplace", true);
game.checkPref("conveyorpathfinding", true); game.checkPref("conveyorpathfinding", true);
game.checkPref("coreselect", false);
game.checkPref("hints", true); game.checkPref("hints", true);
if(!mobile){ if(!mobile){
game.checkPref("buildautopause", false); game.checkPref("buildautopause", false);