Smarter payload routers / 2x display / Campaign tweaks

This commit is contained in:
Anuken
2020-09-14 14:09:15 -04:00
parent d6447cb31a
commit 50816deb9e
25 changed files with 5163 additions and 5021 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -4,5 +4,6 @@
flattenPaths: true, flattenPaths: true,
maxWidth: 4096, maxWidth: 4096,
maxHeight: 4096, maxHeight: 4096,
minHeight: 2048,
fast: true fast: true
} }

View File

@@ -584,6 +584,7 @@ blocks.itemsmoved = Move Speed
blocks.launchtime = Time Between Launches blocks.launchtime = Time Between Launches
blocks.shootrange = Range blocks.shootrange = Range
blocks.size = Size blocks.size = Size
blocks.displaysize = Display Size
blocks.liquidcapacity = Liquid Capacity blocks.liquidcapacity = Liquid Capacity
blocks.powerrange = Power Range blocks.powerrange = Power Range
blocks.linkrange = Link Range blocks.linkrange = Link Range
@@ -1117,6 +1118,7 @@ block.micro-processor.name = Micro Processor
block.logic-processor.name = Logic Processor block.logic-processor.name = Logic Processor
block.hyper-processor.name = Hyper Processor block.hyper-processor.name = Hyper Processor
block.logic-display.name = Logic Display block.logic-display.name = Logic Display
block.large-logic-display.name = Large Logic Display
block.memory-cell.name = Memory Cell block.memory-cell.name = Memory Cell
team.blue.name = blue team.blue.name = blue

View File

@@ -310,3 +310,4 @@
63434=snow-boulder|block-snow-boulder-medium 63434=snow-boulder|block-snow-boulder-medium
63433=dacite-wall|block-dacite-wall-medium 63433=dacite-wall|block-dacite-wall-medium
63432=dacite-boulder|block-dacite-boulder-medium 63432=dacite-boulder|block-dacite-boulder-medium
63431=large-logic-display|block-large-logic-display-medium

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

After

Width:  |  Height:  |  Size: 811 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 973 KiB

After

Width:  |  Height:  |  Size: 958 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 KiB

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 KiB

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -83,7 +83,7 @@ public class Blocks implements ContentList{
repairPoint, resupplyPoint, repairPoint, resupplyPoint,
//logic //logic
message, switchBlock, microProcessor, logicProcessor, hyperProcessor, logicDisplay, memoryCell, message, switchBlock, microProcessor, logicProcessor, hyperProcessor, largeLogicDisplay, logicDisplay, memoryCell,
//campaign //campaign
launchPad, launchPadLarge, launchPad, launchPadLarge,
@@ -1136,7 +1136,7 @@ public class Blocks implements ContentList{
requirements(Category.power, with(Items.copper, 35, Items.graphite, 25, Items.lead, 40, Items.silicon, 30)); requirements(Category.power, with(Items.copper, 35, Items.graphite, 25, Items.lead, 40, Items.silicon, 30));
powerProduction = 5.5f; powerProduction = 5.5f;
itemDuration = 90f; itemDuration = 90f;
consumes.liquid(Liquids.water, 0.05f); consumes.liquid(Liquids.water, 0.06f);
hasLiquids = true; hasLiquids = true;
size = 2; size = 2;
}}; }};
@@ -1943,18 +1943,26 @@ public class Blocks implements ContentList{
size = 3; size = 3;
}}; }};
memoryCell = new MemoryBlock("memory-cell"){{
requirements(Category.logic, with(Items.graphite, 40, Items.silicon, 40));
memoryCapacity = 64;
}};
logicDisplay = new LogicDisplay("logic-display"){{ logicDisplay = new LogicDisplay("logic-display"){{
requirements(Category.logic, with(Items.copper, 200, Items.lead, 120, Items.silicon, 100, Items.metaglass, 50)); requirements(Category.logic, with(Items.lead, 100, Items.silicon, 50, Items.metaglass, 50));
displaySize = 80; displaySize = 80;
size = 3; size = 3;
}}; }};
memoryCell = new MemoryBlock("memory-cell"){{ largeLogicDisplay = new LogicDisplay("large-logic-display"){{
requirements(Category.logic, with(Items.graphite, 40, Items.silicon, 40)); requirements(Category.logic, with(Items.lead, 200, Items.silicon, 150, Items.metaglass, 100, Items.phasefabric, 75));
memoryCapacity = 64; displaySize = 176;
size = 6;
}}; }};
//endregion //endregion

View File

@@ -208,7 +208,9 @@ public class TechTree implements ContentList{
node(switchBlock, () -> { node(switchBlock, () -> {
node(message, () -> { node(message, () -> {
node(logicDisplay, () -> { node(logicDisplay, () -> {
node(largeLogicDisplay, () -> {
});
}); });
node(memoryCell, () -> { node(memoryCell, () -> {

View File

@@ -491,7 +491,7 @@ public class UI implements ApplicationListener, Loadable{
Table t = new Table(); Table t = new Table();
t.touchable = Touchable.disabled; t.touchable = Touchable.disabled;
t.background(Styles.black3).margin(8f) t.background(Styles.black3).margin(8f)
.add(text).style(Styles.outlineLabel); .add(text).style(Styles.outlineLabel).labelAlign(Align.center);
t.update(() -> t.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f, Align.center)); t.update(() -> t.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f, Align.center));
t.actions(Actions.fadeOut(3, Interp.pow4In), Actions.remove()); t.actions(Actions.fadeOut(3, Interp.pow4In), Actions.remove());
Core.scene.add(t); Core.scene.add(t);

View File

@@ -28,7 +28,7 @@ public class LExecutor{
public static final int public static final int
maxGraphicsBuffer = 256, maxGraphicsBuffer = 256,
maxDisplayBuffer = 512, maxDisplayBuffer = 1024,
maxTextBuffer = 256; maxTextBuffer = 256;
public LInstruction[] instructions = {}; public LInstruction[] instructions = {};

View File

@@ -70,10 +70,6 @@ public class HudFragment extends Fragment{
coreItems.clear(); coreItems.clear();
}); });
Events.on(TurnEvent.class, e -> {
ui.announce("[accent][[ Turn " + universe.turn() + " ]");
});
//paused table //paused table
parent.fill(t -> { parent.fill(t -> {
t.top().visible(() -> state.isPaused() && !state.isOutOfTime()).touchable = Touchable.disabled; t.top().visible(() -> state.isPaused() && !state.isOutOfTime()).touchable = Touchable.disabled;
@@ -293,16 +289,19 @@ public class HudFragment extends Fragment{
top.defaults().pad(2).size(150f, 54f); top.defaults().pad(2).size(150f, 54f);
//TODO localize //TODO localize
top.button("Ignore", () -> { top.button("Skip", () -> {
universe.runTurn(); universe.runTurn();
state.set(State.playing); state.set(State.playing);
//announce turn info only when something is skipped.
ui.announce("[accent][[ Turn " + universe.turn() + " ]\n[scarlet]" + attackedSectors.size + "[lightgray] sector(s) attacked.");
}); });
//TODO localize //TODO localize
top.button("Switch Sectors", () -> { top.button("Switch Sectors", () -> {
ui.paused.runExitSave(); ui.paused.runExitSave();
//switch to first attacked sector
control.playSector(attackedSectors.first()); control.playSector(attackedSectors.first());
}).disabled(b -> attackedSectors.isEmpty()); }).disabled(b -> attackedSectors.isEmpty());
}).margin(8).growX(); }).margin(8).growX();

View File

@@ -108,6 +108,7 @@ public class PayloadConveyor extends Block{
if(curStep > step){ if(curStep > step){
boolean valid = step != -1; boolean valid = step != -1;
step = curStep; step = curStep;
boolean had = item != null;
if(valid && stepAccepted != curStep && item != null){ if(valid && stepAccepted != curStep && item != null){
if(next != null){ if(next != null){
@@ -129,9 +130,17 @@ public class PayloadConveyor extends Block{
} }
} }
} }
if(had && item != null){
moveFailed();
}
} }
} }
public void moveFailed(){
}
public void moved(){ public void moved(){
} }

View File

@@ -5,7 +5,9 @@ import arc.math.*;
import arc.util.*; import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.world.blocks.payloads.*;
public class PayloadRouter extends PayloadConveyor{ public class PayloadRouter extends PayloadConveyor{
public @Load("@-over") TextureRegion overRegion; public @Load("@-over") TextureRegion overRegion;
@@ -33,13 +35,25 @@ public class PayloadRouter extends PayloadConveyor{
smoothRot = rotdeg(); smoothRot = rotdeg();
} }
public void pickNext(){
if(item != null){
int rotations = 0;
do{
rotation = (rotation + 1) % 4;
onProximityUpdate();
}while((blocked || next == null || !next.acceptPayload(next, item)) && ++rotations < 4);
}
}
@Override @Override
public void moved(){ public void handlePayload(Building source, Payload payload){
int rotations = 0; super.handlePayload(source, payload);
do{ pickNext();
rotation = (rotation + 1) % 4; }
onProximityUpdate();
}while((blocked || next == null) && ++rotations < 4); @Override
public void moveFailed(){
pickNext();
} }
@Override @Override

View File

@@ -9,8 +9,8 @@ import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.meta.*;
public class LogicDisplay extends Block{ public class LogicDisplay extends Block{
public static final byte public static final byte
@@ -34,11 +34,18 @@ public class LogicDisplay extends Block{
solid = true; solid = true;
} }
@Override
public void setStats(){
super.setStats();
stats.add(BlockStat.displaySize, "@x@", displaySize, displaySize);
}
public class LogicDisplayBuild extends Building{ public class LogicDisplayBuild extends Building{
public FrameBuffer buffer; public FrameBuffer buffer;
public float color = Color.whiteFloatBits; public float color = Color.whiteFloatBits;
public float stroke = 1f; public float stroke = 1f;
public LongQueue commands = new LongQueue(LExecutor.maxDisplayBuffer); public LongQueue commands = new LongQueue(256);
@Override @Override
public void draw(){ public void draw(){

View File

@@ -8,6 +8,7 @@ import java.util.Locale;
public enum BlockStat{ public enum BlockStat{
health(StatCategory.general), health(StatCategory.general),
size(StatCategory.general), size(StatCategory.general),
displaySize(StatCategory.general),
buildTime(StatCategory.general), buildTime(StatCategory.general),
buildCost(StatCategory.general), buildCost(StatCategory.general),