Skip to content

Commit aa08d98

Browse files
author
PriestOfFern
committed
duct ponder
1 parent a182d0c commit aa08d98

File tree

6 files changed

+103
-39
lines changed

6 files changed

+103
-39
lines changed

common/src/main/kotlin/org/valkyrienskies/clockwork/content/logistics/gas/duct/DuctBlock.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ class DuctBlock(properties: Properties) : Block(properties), INodeBlock, IDuct,
445445

446446
// Handle hissing sound
447447
val maxPressure = 16375049.0
448-
if (pressure > 0.7 * maxPressure) {
448+
if (pressure > 0.7 * maxPressure ) {
449449
val pitch = 2 * pressure / maxPressure
450450
val scape = ClockworkSoundScapes.AmbienceGroup.GAS_HISS
451451
ClockworkSoundScapes.play(scape, pos, pitch.toFloat())

common/src/main/kotlin/org/valkyrienskies/clockwork/content/logistics/gas/duct/DuctRenderer.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ class DuctRenderer(context: BlockEntityRendererProvider.Context) : SmartBlockEnt
4141

4242
for (dir in Direction.values()) {
4343

44-
if (!blockEntity.blockState.getValue(DIR_TO_CONNECTION[dir]!!).isConnected) continue
4544

46-
val dirConnection = CachedBuffers.partialFacing(connection, blockEntity.blockState, dir.opposite)
47-
dirConnection.light<SuperByteBuffer>(light).overlay<SuperByteBuffer>(overlay).renderInto(ms, vertexConsumer)
4845
if (blockEntity.blockState.getValue(DIR_TO_CONNECTION[dir]!!) == DuctConnectionType.LEAK) {
4946
val dirLeak = CachedBuffers.partialFacing(leak, blockEntity.blockState, dir.opposite)
5047
dirLeak.light<SuperByteBuffer>(light).overlay<SuperByteBuffer>(overlay).renderInto(ms, vertexConsumer)
5148
}
5249

50+
if (!blockEntity.blockState.getValue(DIR_TO_CONNECTION[dir]!!).isConnected) continue
51+
52+
val dirConnection = CachedBuffers.partialFacing(connection, blockEntity.blockState, dir.opposite)
53+
dirConnection.light<SuperByteBuffer>(light).overlay<SuperByteBuffer>(overlay).renderInto(ms, vertexConsumer)
54+
5355
val dirBe = blockEntity.level?.getBlockEntity(blockEntity.blockPos.relative(dir))
5456

5557
val edge = blockEntity.DIR_TO_CONNECTION_TYPE[dir] ?: continue

common/src/main/kotlin/org/valkyrienskies/clockwork/content/ponders/KelvinPonders.kt

Lines changed: 87 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import net.createmod.ponder.api.scene.SceneBuildingUtil
88
import net.createmod.ponder.foundation.PonderSceneBuilder
99
import net.createmod.ponder.foundation.element.InputWindowElement
1010
import net.minecraft.core.Direction
11+
import net.minecraft.world.level.block.state.BlockState
1112
import org.valkyrienskies.clockwork.ClockworkItems
13+
import org.valkyrienskies.clockwork.content.logistics.gas.duct.DuctBlock
14+
import org.valkyrienskies.clockwork.content.logistics.gas.duct.DuctBlockEntity
15+
import org.valkyrienskies.clockwork.content.logistics.gas.duct.DuctConnectionType
16+
import org.valkyrienskies.clockwork.content.logistics.gas.duct.DuctEdgeType
1217

1318
object KelvinPonders {
1419
fun duct(sceneBuilder: SceneBuilder, util: SceneBuildingUtil) {
@@ -18,11 +23,16 @@ object KelvinPonders {
1823
scene.showBasePlate()
1924
scene.idle(10)
2025

26+
27+
2128
// Select the ducts in the schematic (Assuming a 3-long line of ducts in the center, from z=2 to z=4)
2229
val duct1 = util.grid().at(2, 1, 2)
2330
val duct2 = util.grid().at(2, 1, 3)
2431
val duct3 = util.grid().at(2, 1, 4)
25-
val ductGroup = util.select().fromTo(2, 1, 2, 2, 1, 4)
32+
val ductGroup = util.select().fromTo(1, 1, 2, 3, 1, 4)
33+
val edgeVec = util.vector().centerOf(duct1).add(0.0, 0.0, 0.5)
34+
35+
2636

2737
// Drop the ducts into the scene
2838
scene.world().showSection(ductGroup, Direction.DOWN)
@@ -37,63 +47,107 @@ object KelvinPonders {
3747
scene.idle(70)
3848

3949
scene.overlay().showText(80)
40-
.text("Gas flows automatically between connected ducts, moving from high to low pressure.")
50+
.text("Gas blocks can only be connected to each other with ducts.")
4151
.pointAt(util.vector().topOf(duct2))
4252
.placeNearTarget()
53+
4354
scene.idle(90)
4455

56+
57+
58+
59+
4560
// Wrench mechanics
4661
scene.overlay().showControls(
47-
util.vector().topOf(duct2), Pointing.DOWN, 60
62+
edgeVec, Pointing.DOWN, 6
4863
).rightClick().withItem(AllItems.WRENCH.asStack())
4964

5065
scene.idle(10)
5166

5267
scene.overlay().showText(70)
5368
.text("Using a Wrench on a connection toggles it on or off.")
5469
.attachKeyFrame()
55-
.pointAt(util.vector().centerOf(duct2))
70+
.pointAt(edgeVec)
5671
.placeNearTarget()
57-
scene.idle(80)
72+
73+
// Visual toggle to forced off
74+
scene.world().modifyBlock(duct1, { s: BlockState -> s.setValue(DuctBlock.DIR_TO_CONNECTION[Direction.SOUTH]!!, DuctConnectionType.FORCED_OFF) }, true)
75+
scene.world().modifyBlock(duct2, { s: BlockState -> s.setValue(DuctBlock.DIR_TO_CONNECTION[Direction.NORTH]!!, DuctConnectionType.FORCED_OFF) }, true)
76+
//scene.world().modifyBlock(duct3, { s: BlockState -> s.setValue(DuctBlock.NORTH_CONNECTION, DuctConnectionType.FORCED_OFF) }, true)
77+
scene.idle(40)
78+
79+
// Visual toggle back to side
80+
scene.world().modifyBlock(duct1, { s: BlockState -> s.setValue(DuctBlock.DIR_TO_CONNECTION[Direction.SOUTH]!!, DuctConnectionType.SIDE) }, true)
81+
scene.world().modifyBlock(duct2, { s: BlockState -> s.setValue(DuctBlock.DIR_TO_CONNECTION[Direction.NORTH]!!, DuctConnectionType.SIDE) }, true)
82+
//scene.world().modifyBlock(duct3, { s: BlockState -> s.setValue(DuctBlock.NORTH_CONNECTION, DuctConnectionType.SIDE) }, true)
83+
scene.idle(40)
5884

5985
// Screwdriver configuration
6086
scene.overlay().showControls(
61-
util.vector().topOf(duct2), Pointing.DOWN, 60
62-
).rightClick().withItem(ClockworkItems.SCREWDRIVER.asStack())
87+
edgeVec, Pointing.DOWN, 15
88+
).whileSneaking().rightClick().withItem(ClockworkItems.SCREWDRIVER.asStack())
6389

6490
scene.idle(10)
6591

66-
scene.overlay().showControls(
67-
util.vector().topOf(duct2), Pointing.DOWN, 60
68-
).rightClick().whileSneaking().withItem(ClockworkItems.SCREWDRIVER.asStack())
92+
scene.overlay().showText( 50)
93+
.text("Shift right clicking an edge with a Screwdriver cycles its type. The types are:")
94+
.attachKeyFrame()
95+
.pointAt(edgeVec)
96+
97+
scene.idle(55)
6998

70-
scene.overlay().showOutlineWithText(util.select().position(duct2), 80)
71-
.text("Sneak right-clicking with a Screwdriver cycles edge types: Pipe, One-Way, Filtered, and Smart.")
99+
// One-Way
100+
scene.overlay().showText( 30)
101+
.text("One-way")
72102
.attachKeyFrame()
73-
.pointAt(util.vector().centerOf(duct2))
74-
.placeNearTarget()
75-
scene.idle(90)
103+
.pointAt(edgeVec)
76104

77-
// Sneak-screwdriving
105+
scene.world().modifyBlockEntity(duct1, DuctBlockEntity::class.java) { be: DuctBlockEntity -> be.DIR_TO_CONNECTION_TYPE[Direction.SOUTH] = DuctEdgeType.ONEWAY_FORWARD }
106+
scene.world().modifyBlockEntity(duct2, DuctBlockEntity::class.java) { be: DuctBlockEntity -> be.DIR_TO_CONNECTION_TYPE[Direction.NORTH] = DuctEdgeType.ONEWAY_BACKWARD }
107+
scene.idle(40)
78108

109+
scene.overlay().showText( 30)
110+
.text("Filtered")
111+
.attachKeyFrame()
112+
.pointAt(edgeVec)
79113

80-
scene.idle(10)
114+
// Filtered
115+
scene.world().modifyBlockEntity(duct1, DuctBlockEntity::class.java) { be: DuctBlockEntity -> be.DIR_TO_CONNECTION_TYPE[Direction.SOUTH] = DuctEdgeType.FILTERED }
116+
scene.world().modifyBlockEntity(duct2, DuctBlockEntity::class.java) { be: DuctBlockEntity -> be.DIR_TO_CONNECTION_TYPE[Direction.NORTH] = DuctEdgeType.FILTERED }
117+
scene.idle(40)
118+
119+
// Smart
120+
121+
scene.overlay().showText( 50)
122+
.text("Smart")
123+
.attachKeyFrame()
124+
.pointAt(edgeVec)
125+
scene.world().modifyBlockEntity(duct1, DuctBlockEntity::class.java) { be: DuctBlockEntity -> be.DIR_TO_CONNECTION_TYPE[Direction.SOUTH] = DuctEdgeType.SMART }
126+
scene.world().modifyBlockEntity(duct2, DuctBlockEntity::class.java) { be: DuctBlockEntity -> be.DIR_TO_CONNECTION_TYPE[Direction.NORTH] = DuctEdgeType.SMART }
127+
scene.idle(60)
128+
129+
// Screwdriving
130+
131+
scene.overlay().showText( 50)
132+
.text("Right clicking a Smart or Filtered edge with a Screwdriver lets you edit it")
133+
.attachKeyFrame()
134+
.pointAt(edgeVec)
81135

82136
scene.overlay().showControls(
83-
util.vector().topOf(duct2), Pointing.DOWN, 60
137+
edgeVec, Pointing.DOWN, 20
84138
).rightClick().withItem(ClockworkItems.SCREWDRIVER.asStack())
85-
scene.overlay().showText(80)
86-
.text("Right clicking an edge with a screwdriver allows you to edit it (For Filtered and Smart edges).")
87-
.pointAt(util.vector().centerOf(duct2))
88-
.placeNearTarget()
89-
scene.idle(90)
139+
140+
scene.idle(80)
90141

91142
// Leaks
143+
// Visually create a leak!
144+
scene.world().modifyBlock(duct3, { s: BlockState -> s.setValue(DuctBlock.DIR_TO_CONNECTION[Direction.UP]!!, DuctConnectionType.LEAK) }, true)
145+
92146
scene.overlay().showText(70)
93147
.text("If a duct is caught in an explosion, it will become a leak and gas will violently escape!")
94148
.attachKeyFrame()
95-
.pointAt(util.vector().topOf(duct3))
96-
.placeNearTarget()
149+
// .pointAt(util.vector().topOf(duct3))
150+
// .placeNearTarget()
97151
scene.idle(80)
98152

99153
scene.overlay().showControls(
@@ -102,10 +156,16 @@ object KelvinPonders {
102156

103157
scene.idle(10)
104158

105-
scene.overlay().showText(70)
159+
scene.overlay().showText(60)
106160
.text("Right-Clicking a leak with a Wrench will seal it back up.")
107161
.pointAt(util.vector().topOf(duct3))
108162
.placeNearTarget()
109-
scene.idle(80)
163+
164+
scene.idle(40)
165+
166+
// Seal the leak
167+
scene.world().modifyBlock(duct3, { s: BlockState -> s.setValue(DuctBlock.DIR_TO_CONNECTION[Direction.UP]!!, DuctConnectionType.NONE) }, true)
168+
169+
scene.idle(70)
110170
}
111171
}

common/src/main/resources/assets/vs_clockwork/lang/en_us.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,15 @@
563563

564564
"vs_clockwork.ponder.duct.header": "Gas Ducts",
565565
"vs_clockwork.ponder.duct.text_1": "Ducts form the core of Clockwork's gas networks.",
566-
"vs_clockwork.ponder.duct.text_2": "Gas flows automatically between connected ducts, moving from high to low pressure.",
567-
"vs_clockwork.ponder.duct.text_3": "Using a Wrench on a connection toggles it on, off, or forces it.",
568-
"vs_clockwork.ponder.duct.text_4": "A Screwdriver cycles edge types: Pipe, One-Way, Filtered, and Smart.",
569-
"vs_clockwork.ponder.duct.text_5": "Sneak-clicking with a Screwdriver cycles the pipe connection entirely, allowing purely structural links.",
570-
"vs_clockwork.ponder.duct.text_6": "If a duct is caught in an explosion, it will become a leak and gas will violently escape!",
571-
"vs_clockwork.ponder.duct.text_7": "Right-Clicking a leak with a Wrench will seal it back up.",
572-
566+
"vs_clockwork.ponder.duct.text_2": "Gas blocks can only be connected to each other with ducts.",
567+
"vs_clockwork.ponder.duct.text_3": "Using a Wrench on a connection toggles it on or off.",
568+
"vs_clockwork.ponder.duct.text_4": "Shift right clicking an edge with a Screwdriver cycles its type. The types are:",
569+
"vs_clockwork.ponder.duct.text_5": "One-way",
570+
"vs_clockwork.ponder.duct.text_6": "Filtered",
571+
"vs_clockwork.ponder.duct.text_7": "Smart",
572+
"vs_clockwork.ponder.duct.text_8": "Right clicking a Smart or Filtered edge with a Screwdriver lets you edit it",
573+
"vs_clockwork.ponder.duct.text_9": "If a duct is caught in an explosion, it will become a leak and gas will violently escape!",
574+
"vs_clockwork.ponder.duct.text_10": "Right-Clicking a leak with a Wrench will seal it back up.",
573575

574576
"death.attack.gas_burn": "%s was singed to a crisp",
575577
"death.attack.gas_explosion": "%s couldn't handle the pressure"
189 Bytes
Binary file not shown.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.daemon=false
55
# Identity
66
mod_name=clockwork
77
mod_id=vs_clockwork
8-
mod_version=0.5.5.1
8+
mod_version=0.5.5.2
99
archives_base_name=clockwork
1010
maven_group=org.valkyrienskies
1111

0 commit comments

Comments
 (0)