Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -5502,7 +5502,7 @@ public class Blocks{
|
||||
}};
|
||||
|
||||
malign = new PowerTurret("malign"){{
|
||||
requirements(Category.turret, with(Items.carbide, 400, Items.beryllium, 2000, Items.silicon, 800, Items.graphite, 800, Items.phaseFabric, 300));
|
||||
requirements(Category.turret, with(Items.carbide, 200, Items.beryllium, 1000, Items.silicon, 500, Items.graphite, 500, Items.phaseFabric, 200));
|
||||
|
||||
var haloProgress = PartProgress.warmup;
|
||||
Color haloColor = Color.valueOf("d370d3"), heatCol = Color.purple;
|
||||
@@ -5810,26 +5810,26 @@ public class Blocks{
|
||||
}};
|
||||
|
||||
velocityRnd = 0.15f;
|
||||
heatRequirement = 90f;
|
||||
heatRequirement = 72f;
|
||||
maxHeatEfficiency = 2f;
|
||||
warmupMaintainTime = 120f;
|
||||
consumePower(10f);
|
||||
|
||||
shoot = new ShootSummon(0f, 0f, circleRad, 48f);
|
||||
consumePower(40f);
|
||||
unitSort = UnitSorts.strongest;
|
||||
shoot = new ShootSummon(0f, 0f, circleRad, 20f);
|
||||
|
||||
minWarmup = 0.96f;
|
||||
shootWarmupSpeed = 0.03f;
|
||||
shootWarmupSpeed = 0.08f;
|
||||
|
||||
shootY = circleY - 5f;
|
||||
|
||||
outlineColor = Pal.darkOutline;
|
||||
envEnabled |= Env.space;
|
||||
reload = 9f;
|
||||
range = 370;
|
||||
reload = 7f;
|
||||
range = 380;
|
||||
trackingRange = range * 1.4f;
|
||||
shootCone = 100f;
|
||||
scaledHealth = 370;
|
||||
rotateSpeed = 2f;
|
||||
rotateSpeed = 2.6f;
|
||||
recoil = 0.5f;
|
||||
recoilTime = 30f;
|
||||
shake = 3f;
|
||||
|
||||
@@ -988,6 +988,29 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
|
||||
public static class PrintCharI implements LInstruction{
|
||||
public LVar value;
|
||||
|
||||
public PrintCharI(LVar value){
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
PrintCharI(){}
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
|
||||
if(exec.textBuffer.length() >= maxTextBuffer) return;
|
||||
if(value.isobj){
|
||||
if(!(value.objval instanceof UnlockableContent cont)) return;
|
||||
exec.textBuffer.append((char)cont.emojiChar());
|
||||
return;
|
||||
}
|
||||
|
||||
exec.textBuffer.append((char)Math.floor(value.numval));
|
||||
}
|
||||
}
|
||||
|
||||
public static class FormatI implements LInstruction{
|
||||
public LVar value;
|
||||
|
||||
|
||||
@@ -312,6 +312,46 @@ public class LStatements{
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterStatement("printchar")
|
||||
public static class PrintCharStatement extends LStatement{
|
||||
public String value = "65";
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
table.add(" char ");
|
||||
TextField field = field(table, value, str -> value = str).get();
|
||||
table.button(b -> {
|
||||
b.image(Icon.pencilSmall);
|
||||
b.clicked(() -> showSelectTable(b, (t, hide) -> {
|
||||
t.row();
|
||||
t.table(i -> {
|
||||
i.left();
|
||||
int c = 0;
|
||||
for(char j = 32; j < 127; j++){
|
||||
final int chr = j;
|
||||
i.button(String.valueOf(j), Styles.flatt, () -> {
|
||||
value = Integer.toString(chr);
|
||||
field.setText(value);
|
||||
hide.run();
|
||||
}).size(32f);
|
||||
if(++c % 8 == 0) i.row();
|
||||
}
|
||||
});
|
||||
}));
|
||||
}, Styles.logict, () -> {}).size(40f).padLeft(-2).color(table.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LInstruction build(LAssembler builder){
|
||||
return new PrintCharI(builder.var(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LCategory category(){
|
||||
return LCategory.io;
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterStatement("format")
|
||||
public static class FormatStatement extends LStatement{
|
||||
public String value = "\"frog\"";
|
||||
|
||||
@@ -28,6 +28,7 @@ public class MenuFragment{
|
||||
private Button currentMenu;
|
||||
private MenuRenderer renderer;
|
||||
private Seq<MenuButton> customButtons = new Seq<>();
|
||||
public Seq<MenuButton> desktopButtons = null;
|
||||
|
||||
public void build(Group parent){
|
||||
renderer = new MenuRenderer();
|
||||
@@ -187,22 +188,26 @@ public class MenuFragment{
|
||||
t.defaults().width(width).height(70f);
|
||||
t.name = "buttons";
|
||||
|
||||
buttons(t,
|
||||
new MenuButton("@play", Icon.play,
|
||||
new MenuButton("@campaign", Icon.play, () -> checkPlay(ui.planet::show)),
|
||||
new MenuButton("@joingame", Icon.add, () -> checkPlay(ui.join::show)),
|
||||
new MenuButton("@customgame", Icon.terrain, () -> checkPlay(ui.custom::show)),
|
||||
new MenuButton("@loadgame", Icon.download, () -> checkPlay(ui.load::show))
|
||||
),
|
||||
new MenuButton("@database.button", Icon.menu,
|
||||
new MenuButton("@schematics", Icon.paste, ui.schematics::show),
|
||||
new MenuButton("@database", Icon.book, ui.database::show),
|
||||
new MenuButton("@about.button", Icon.info, ui.about::show)
|
||||
),
|
||||
new MenuButton("@editor", Icon.terrain, () -> checkPlay(ui.maps::show)), steam ? new MenuButton("@workshop", Icon.steam, platform::openWorkshop) : null,
|
||||
new MenuButton("@mods", Icon.book, ui.mods::show),
|
||||
new MenuButton("@settings", Icon.settings, ui.settings::show)
|
||||
);
|
||||
if(desktopButtons == null){
|
||||
desktopButtons = Seq.with(
|
||||
new MenuButton("@play", Icon.play,
|
||||
new MenuButton("@campaign", Icon.play, () -> checkPlay(ui.planet::show)),
|
||||
new MenuButton("@joingame", Icon.add, () -> checkPlay(ui.join::show)),
|
||||
new MenuButton("@customgame", Icon.terrain, () -> checkPlay(ui.custom::show)),
|
||||
new MenuButton("@loadgame", Icon.download, () -> checkPlay(ui.load::show))
|
||||
),
|
||||
new MenuButton("@database.button", Icon.menu,
|
||||
new MenuButton("@schematics", Icon.paste, ui.schematics::show),
|
||||
new MenuButton("@database", Icon.book, ui.database::show),
|
||||
new MenuButton("@about.button", Icon.info, ui.about::show)
|
||||
),
|
||||
new MenuButton("@editor", Icon.terrain, () -> checkPlay(ui.maps::show)), steam ? new MenuButton("@workshop", Icon.steam, platform::openWorkshop) : null,
|
||||
new MenuButton("@mods", Icon.book, ui.mods::show),
|
||||
new MenuButton("@settings", Icon.settings, ui.settings::show)
|
||||
);
|
||||
}
|
||||
|
||||
buttons(t, desktopButtons.toArray(MenuButton.class));
|
||||
buttons(t, customButtons.toArray(MenuButton.class));
|
||||
buttons(t, new MenuButton("@quit", Icon.exit, Core.app::exit));
|
||||
}).width(width).growY();
|
||||
@@ -250,14 +255,14 @@ public class MenuFragment{
|
||||
currentMenu = null;
|
||||
fadeOutMenu();
|
||||
}else{
|
||||
if(b.submenu != null){
|
||||
if(b.submenu != null && b.submenu.any()){
|
||||
currentMenu = out[0];
|
||||
submenu.clearChildren();
|
||||
fadeInMenu();
|
||||
//correctly offset the button
|
||||
submenu.add().height((Core.graphics.getHeight() - Core.scene.marginTop - Core.scene.marginBottom - out[0].getY(Align.topLeft)) / Scl.scl(1f));
|
||||
submenu.row();
|
||||
buttons(submenu, b.submenu);
|
||||
buttons(submenu, b.submenu.toArray());
|
||||
}else{
|
||||
currentMenu = null;
|
||||
fadeOutMenu();
|
||||
@@ -296,7 +301,7 @@ public class MenuFragment{
|
||||
/** Runnable ran when the button is clicked. Ignored on desktop if {@link #submenu} is not null. */
|
||||
public final Runnable runnable;
|
||||
/** Submenu shown when this button is clicked. Used instead of {@link #runnable} on desktop. */
|
||||
public final @Nullable MenuButton[] submenu;
|
||||
public final @Nullable Seq<MenuButton> submenu;
|
||||
|
||||
/** Constructs a simple menu button, which behaves the same way on desktop and mobile. */
|
||||
public MenuButton(String text, Drawable icon, Runnable runnable){
|
||||
@@ -311,7 +316,7 @@ public class MenuFragment{
|
||||
this.icon = icon;
|
||||
this.text = text;
|
||||
this.runnable = runnable;
|
||||
this.submenu = submenu;
|
||||
this.submenu = submenu != null ? Seq.with(submenu) : null;
|
||||
}
|
||||
|
||||
/** Comstructs a desktop-only button; used internally. */
|
||||
@@ -319,7 +324,7 @@ public class MenuFragment{
|
||||
this.icon = icon;
|
||||
this.text = text;
|
||||
this.runnable = () -> {};
|
||||
this.submenu = submenu;
|
||||
this.submenu = submenu != null ? Seq.with(submenu) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ public class BeamDrill extends Block{
|
||||
|
||||
/** Multipliers of drill speed for each item. Defaults to 1. */
|
||||
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
|
||||
/** Special exemption item that this drill can't mine. */
|
||||
public @Nullable Item blockedItem;
|
||||
/** Special exemption items that this drill can't mine. */
|
||||
public @Nullable Seq<Item> blockedItems;
|
||||
|
||||
public Color sparkColor = Color.valueOf("fd9e81"), glowColor = Color.white;
|
||||
public float glowIntensity = 0.2f, pulseIntensity = 0.07f;
|
||||
@@ -76,6 +80,9 @@ public class BeamDrill extends Block{
|
||||
public void init(){
|
||||
updateClipRadius((range + 2) * tilesize);
|
||||
super.init();
|
||||
if(blockedItems == null && blockedItem != null){
|
||||
blockedItems = Seq.with(blockedItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +118,10 @@ public class BeamDrill extends Block{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.drillTier, StatValues.drillables(drillTime, 0f, size, drillMultipliers, b -> (b instanceof Floor f && f.wallOre && f.itemDrop != null && f.itemDrop.hardness <= tier) || (b instanceof StaticWall w && w.itemDrop != null && w.itemDrop.hardness <= tier)));
|
||||
stats.add(Stat.drillTier, StatValues.drillables(drillTime, 0f, size, drillMultipliers, b ->
|
||||
(b instanceof Floor f && f.wallOre && f.itemDrop != null && f.itemDrop.hardness <= tier && (blockedItems == null || !blockedItems.contains(f.itemDrop))) ||
|
||||
(b instanceof StaticWall w && w.itemDrop != null && w.itemDrop.hardness <= tier && (blockedItems == null || !blockedItems.contains(w.itemDrop)))
|
||||
));
|
||||
|
||||
stats.add(Stat.drillSpeed, 60f / drillTime * size, StatUnit.itemsSecond);
|
||||
|
||||
@@ -142,7 +152,7 @@ public class BeamDrill extends Block{
|
||||
if(other != null && other.solid()){
|
||||
Item drop = other.wallDrop();
|
||||
if(drop != null){
|
||||
if(drop.hardness <= tier){
|
||||
if(drop.hardness <= tier && (blockedItems == null || !blockedItems.contains(drop))){
|
||||
found = drop;
|
||||
count++;
|
||||
}else{
|
||||
@@ -193,7 +203,7 @@ public class BeamDrill extends Block{
|
||||
Tile other = world.tile(Tmp.p1.x + Geometry.d4x(rotation)*j, Tmp.p1.y + Geometry.d4y(rotation)*j);
|
||||
if(other != null && other.solid()){
|
||||
Item drop = other.wallDrop();
|
||||
if(drop != null && drop.hardness <= tier){
|
||||
if(drop != null && drop.hardness <= tier && (blockedItems == null || !blockedItems.contains(drop))){
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -379,7 +389,7 @@ public class BeamDrill extends Block{
|
||||
if(other != null){
|
||||
if(other.solid()){
|
||||
Item drop = other.wallDrop();
|
||||
if(drop != null && drop.hardness <= tier){
|
||||
if(drop != null && drop.hardness <= tier && (blockedItems == null || !blockedItems.contains(drop))){
|
||||
facingAmount ++;
|
||||
if(lastItem != drop && lastItem != null){
|
||||
multiple = true;
|
||||
|
||||
@@ -40,6 +40,8 @@ public class Drill extends Block{
|
||||
public float warmupSpeed = 0.015f;
|
||||
/** Special exemption item that this drill can't mine. */
|
||||
public @Nullable Item blockedItem;
|
||||
/** Special exemption items that this drill can't mine. */
|
||||
public @Nullable Seq<Item> blockedItems;
|
||||
|
||||
//return variables for countOre
|
||||
protected @Nullable Item returnItem;
|
||||
@@ -89,6 +91,9 @@ public class Drill extends Block{
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
if(blockedItems == null && blockedItem != null){
|
||||
blockedItems = Seq.with(blockedItem);
|
||||
}
|
||||
if(drillEffectRnd < 0) drillEffectRnd = size;
|
||||
}
|
||||
|
||||
@@ -155,7 +160,7 @@ public class Drill extends Block{
|
||||
Draw.color();
|
||||
}
|
||||
}else{
|
||||
Tile to = tile.getLinkedTilesAs(this, tempTiles).find(t -> t.drop() != null && (t.drop().hardness > tier || t.drop() == blockedItem));
|
||||
Tile to = tile.getLinkedTilesAs(this, tempTiles).find(t -> t.drop() != null && (t.drop().hardness > tier || (blockedItems != null && blockedItems.contains(t.drop()))));
|
||||
Item item = to == null ? null : to.drop();
|
||||
if(item != null){
|
||||
drawPlaceText(Core.bundle.get("bar.drilltierreq"), x, y, valid);
|
||||
@@ -172,7 +177,7 @@ public class Drill extends Block{
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.drillTier, StatValues.drillables(drillTime, hardnessDrillMultiplier, size * size, drillMultipliers, b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null &&
|
||||
f.itemDrop.hardness <= tier && f.itemDrop != blockedItem && (indexer.isBlockPresent(f) || state.isMenu())));
|
||||
f.itemDrop.hardness <= tier && (blockedItems == null || !blockedItems.contains(f.itemDrop)) && (indexer.isBlockPresent(f) || state.isMenu())));
|
||||
|
||||
stats.add(Stat.drillSpeed, 60f / drillTime * size * size, StatUnit.itemsSecond);
|
||||
|
||||
@@ -227,7 +232,7 @@ public class Drill extends Block{
|
||||
public boolean canMine(Tile tile){
|
||||
if(tile == null || tile.block().isStatic()) return false;
|
||||
Item drops = tile.drop();
|
||||
return drops != null && drops.hardness <= tier && drops != blockedItem;
|
||||
return drops != null && drops.hardness <= tier && (blockedItems == null || !blockedItems.contains(drops));
|
||||
}
|
||||
|
||||
public class DrillBuild extends Building{
|
||||
|
||||
Reference in New Issue
Block a user