Skip to content

Commit c59b824

Browse files
committed
fix small BreakManager oversight
1 parent d7cd202 commit c59b824

File tree

1 file changed

+24
-21
lines changed
  • common/src/main/kotlin/com/lambda/interaction/request/breaking

1 file changed

+24
-21
lines changed

common/src/main/kotlin/com/lambda/interaction/request/breaking/BreakManager.kt

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,10 @@ object BreakManager : RequestHandler<BreakRequest>(
158158
* @see processRequest
159159
*/
160160
override fun SafeContext.handleRequest(request: BreakRequest) {
161-
if (activeRequest != null || PlaceManager.activeThisTick) return
161+
if (activeRequest != null || PlaceManager.activeThisTick || request.contexts.isEmpty()) return
162162

163163
activeRequest = request
164164
processRequest(request)
165-
if (instantBreaks.isNotEmpty() || breaks.isNotEmpty()) {
166-
activeRequest = null
167-
}
168-
if (breaksThisTick > 0 || breakInfos.any { it != null && !it.isRedundant }) {
169-
activeThisTick = true
170-
}
171165
}
172166

173167
/**
@@ -192,21 +186,30 @@ object BreakManager : RequestHandler<BreakRequest>(
192186

193187
// Reversed so that the breaking order feels natural to the user as the primary break is always the
194188
// last break to be started
195-
breakInfos
196-
.filterNotNull()
197-
.filter { !it.isRedundant }
198-
.also { infos ->
199-
infos.firstOrNull { it.breakConfig.rotateForBreak }?.let { info ->
200-
info.request.rotation.request(info.context.rotation)
189+
run breakInfos@ {
190+
breakInfos
191+
.filterNotNull()
192+
.filter { !it.isRedundant }
193+
.also { infos ->
194+
infos.firstOrNull { it.breakConfig.rotateForBreak }?.let { info ->
195+
info.request.rotation.request(info.context.rotation)
196+
}
201197
}
202-
}
203-
.reversed()
204-
.forEach { info ->
205-
if (info.updatedProgressThisTick) return@forEach
206-
if (!info.context.requestDependencies(request)) return
207-
if (!rotated || tickStage !in info.breakConfig.breakStageMask) return
208-
updateBreakProgress(info)
209-
}
198+
.reversed()
199+
.forEach { info ->
200+
if (info.updatedProgressThisTick) return@forEach
201+
if (!info.context.requestDependencies(request)) return@breakInfos
202+
if (!rotated || tickStage !in info.breakConfig.breakStageMask) return@breakInfos
203+
updateBreakProgress(info)
204+
}
205+
}
206+
207+
if (instantBreaks.isEmpty() && breaks.isEmpty()) {
208+
activeRequest = null
209+
}
210+
if (breaksThisTick > 0 || breakInfos.any { it != null && !it.isRedundant }) {
211+
activeThisTick = true
212+
}
210213
}
211214

212215
/**

0 commit comments

Comments
 (0)