Skip to content

Commit c65136d

Browse files
committed
fix omitted interactions
1 parent 295ff4e commit c65136d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/main/kotlin/com/lambda/interaction/construction/simulation/SimInfo.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ interface SimInfo : Automated {
6868
pov,
6969
Stack(),
7070
concurrentResults
71-
).takeIf { it.hasBasicRequirements() }?.sim()
71+
).takeIf { it?.hasBasicRequirements() == true }?.sim()
7272

7373
/**
7474
* Creates a new [SimInfo] using the current [SimInfo]'s [dependencyStack] and [concurrentResults],
@@ -89,7 +89,7 @@ interface SimInfo : Automated {
8989
pov,
9090
Stack<Sim<*>>().apply { addAll(dependencyStack) },
9191
concurrentResults
92-
).takeIf { it.hasBasicRequirements() }?.sim()
92+
).takeIf { it?.hasBasicRequirements() == true }?.sim()
9393

9494
@SimDsl
9595
private fun AutomatedSafeContext.getTypedInfo(
@@ -99,10 +99,11 @@ interface SimInfo : Automated {
9999
pov: Vec3d,
100100
dependencyStack: Stack<Sim<*>>,
101101
concurrentResults: MutableSet<BuildResult>
102-
): SimInfo {
102+
): SimInfo? {
103103
if (!targetState.isEmpty()) {
104104
getProcessingInfo(state, targetState, pos)?.let { preProcessing ->
105-
return object : InteractSimInfo, Automated by this {
105+
return if (preProcessing.info.omitInteraction) null
106+
else object : InteractSimInfo, Automated by this {
106107
override val pos = pos
107108
override val state = state
108109
override val targetState = targetState

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ interface PreProcessingInfo {
3535
val placing: Boolean
3636
val sneak: Boolean?
3737
val noCaching: Boolean
38+
val omitInteraction: Boolean
3839

3940
companion object {
4041
context(_: AutomatedSafeContext)
@@ -47,6 +48,7 @@ interface PreProcessingInfo {
4748
override val placing = true
4849
override val sneak = null
4950
override val noCaching = true
51+
override val omitInteraction = false
5052
}
5153
}
5254
}
@@ -60,7 +62,7 @@ class PreProcessingInfoAccumulator(
6062
override var placing: Boolean = true,
6163
override var sneak: Boolean? = null,
6264
override var noCaching: Boolean = false,
63-
var omitInteraction: Boolean = false
65+
override var omitInteraction: Boolean = false
6466
) : PreProcessingInfo {
6567
@InfoAccumulator
6668
fun offerSurfaceScan(scan: SurfaceScan) {

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ object ProcessorRegistry : Loadable {
139139
preProcess(pos, state, targetBlockState, targetState.getStack(pos)).also { info ->
140140
if (info?.noCaching != true) processorCache[processorCacheKey] = info
141141
}
142-
}
142+
} ?: return null
143143

144-
return PreProcessingData(preProcessingInfo ?: return null, pos)
144+
return PreProcessingData(preProcessingInfo, pos)
145145
}
146146

147147
context(safeContext: SafeContext)
@@ -153,7 +153,7 @@ object ProcessorRegistry : Loadable {
153153
with(processor) { preProcess(state, targetState, pos) }
154154
}
155155
}
156-
if (!stateProcessing) {
156+
if (!stateProcessing && !omitInteraction) {
157157
if (state.block != expectedState.block) {
158158
if (!state.isReplaceable) return@run null
159159
propertyPreProcessors.forEach { processor ->
@@ -169,7 +169,6 @@ object ProcessorRegistry : Loadable {
169169
if (!state.matches(targetState, ignore)) return@run null
170170
}
171171
}
172-
if (omitInteraction) return@run null
173172
complete()
174173
}
175174
}

0 commit comments

Comments
 (0)