Skip to content

Commit 9a5f83c

Browse files
committed
build sim processing improvements
1 parent 3af24f1 commit 9a5f83c

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/main/kotlin/com/lambda/interaction/construction/simulation/processing/PreProcessingInfo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class PreProcessingInfoAccumulator(
5757
override val sides: MutableSet<Direction> = Direction.entries.toMutableSet(),
5858
override var placing: Boolean = true,
5959
override var noCaching: Boolean = false,
60-
var omitPlacement: Boolean = false
60+
var omitInteraction: Boolean = false
6161
) : PreProcessingInfo {
6262
@InfoAccumulator
6363
fun offerSurfaceScan(scan: SurfaceScan) {
@@ -106,7 +106,7 @@ class PreProcessingInfoAccumulator(
106106

107107
@InfoAccumulator
108108
fun omitPlacement() {
109-
omitPlacement = true
109+
omitInteraction = true
110110
}
111111

112112
@InfoAccumulator

src/main/kotlin/com/lambda/interaction/construction/simulation/processing/ProcessorRegistry.kt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,21 @@ object ProcessorRegistry : Loadable {
153153
with(processor) { preProcess(state, targetState, pos) }
154154
}
155155
}
156-
if (omitPlacement) return@run complete()
156+
if (omitInteraction) return@run complete()
157157
if (!stateProcessing) {
158-
if (!state.isReplaceable && state.block != expectedState.block) return@run null
159-
if (state.block != expectedState.block) propertyPreProcessors.forEach { processor ->
160-
if (processor.acceptsState(targetState))
161-
with(processor) { preProcess(state, expectedState) }
162-
} else propertyPostProcessors.forEach { processor ->
163-
if (processor.acceptsState(state, expectedState))
164-
with(processor) { preProcess(state, expectedState) }
158+
if (state.block != expectedState.block) {
159+
if (!state.isReplaceable) return@run null
160+
propertyPreProcessors.forEach { processor ->
161+
if (processor.acceptsState(targetState))
162+
with(processor) { preProcess(state, expectedState) }
163+
}
164+
} else {
165+
val postProcessable = propertyPostProcessors.any { processor ->
166+
processor.acceptsState(state, expectedState).also {
167+
with(processor) { preProcess(state, expectedState) }
168+
}
169+
}
170+
if (!postProcessable) return@run null
165171
}
166172
}
167173
complete()

0 commit comments

Comments
 (0)