@@ -8,7 +8,12 @@ import net.createmod.ponder.api.scene.SceneBuildingUtil
88import net.createmod.ponder.foundation.PonderSceneBuilder
99import net.createmod.ponder.foundation.element.InputWindowElement
1010import net.minecraft.core.Direction
11+ import net.minecraft.world.level.block.state.BlockState
1112import 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
1318object 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}
0 commit comments