Skip to content

Commit 44c49ad

Browse files
committed
interaction tick stage checks
1 parent 1983957 commit 44c49ad

File tree

6 files changed

+8
-4
lines changed

6 files changed

+8
-4
lines changed

src/main/kotlin/com/lambda/config/groups/InteractSettings.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
21+
import com.lambda.event.events.TickEvent
2122
import com.lambda.interaction.request.interacting.InteractConfig
2223
import com.lambda.util.NamedEnum
2324

@@ -28,6 +29,7 @@ class InteractSettings(
2829
) : InteractConfig {
2930
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(groupPath)
3031
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(groupPath)
32+
override val interactStageMask by c.setting("Interact Stage Mask", setOf(TickEvent.Input.Post, TickEvent.Player.Post), description = "The sub-tick timing at which interact actions are performed", visibility = vis).group(groupPath)
3133
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }.group(groupPath)
3234
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractionConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions", visibility = vis).group(groupPath)
3335
}

src/main/kotlin/com/lambda/config/groups/PlaceSettings.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class PlaceSettings(
3232
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis).group(groupPath)
3333
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis).group(groupPath)
3434
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled }.group(groupPath)
35-
override val placeStageMask by c.setting("Place Sequence Mode", setOf(TickEvent.Input.Post, TickEvent.Player.Post), description = "The sub-tick timing at which break actions are performed", visibility = vis).group(groupPath)
35+
override val placeStageMask by c.setting("Place Stage mask", setOf(TickEvent.Input.Post, TickEvent.Player.Post), description = "The sub-tick timing at which place actions are performed", visibility = vis).group(groupPath)
3636
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation", visibility = vis).group(groupPath)
3737
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements", visibility = vis).group(groupPath)
3838
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick", visibility = vis).group(groupPath)
3939
override val swing by c.setting("Swing On Place", true, "Swings the players hand when placing", visibility = vis).group(groupPath)
4040
override val swingType by c.setting("Place Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing }.group(groupPath)
4141
override val sounds by c.setting("Place Sounds", true, "Plays the placing sounds", visibility = vis).group(groupPath)
42-
}
42+
}

src/main/kotlin/com/lambda/interaction/request/interacting/InteractConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ package com.lambda.interaction.request.interacting
1919

2020
import com.lambda.config.groups.BuildConfig
2121
import com.lambda.config.groups.InteractionConfig
22+
import com.lambda.event.Event
2223
import com.lambda.interaction.request.RequestConfig
2324

2425
interface InteractConfig : RequestConfig {
2526
val rotate: Boolean
2627
val swingHand: Boolean
28+
val interactStageMask: Set<Event>
2729
val interactSwingType: BuildConfig.SwingType
2830
val interactConfirmationMode: InteractionConfig.InteractConfirmationMode
2931
}

src/main/kotlin/com/lambda/interaction/request/interacting/InteractionManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ object InteractionManager : RequestHandler<InteractRequest>(
113113
logger.warning("Dependencies failed for interaction", ctx, request)
114114
return
115115
}
116+
if (tickStage !in request.interactStageMask) return
116117

117118
if (request.interactConfirmationMode != InteractionConfig.InteractConfirmationMode.None) {
118119
InteractionInfo(ctx, request.pendingInteractionsList, request).startPending()

src/main/kotlin/com/lambda/interaction/request/placing/PlaceConfig.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,4 @@ interface PlaceConfig : RequestConfig {
5757
PlaceThenAwait("Place now, confirm later", "Show placement right away, then wait for server confirmation to verify."),
5858
AwaitThenPlace("Confirm first, then place", "Wait for server response before showing placement; most accurate, adds a short delay.")
5959
}
60-
6160
}

src/main/kotlin/com/lambda/interaction/request/placing/PlaceManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ object PlaceManager : RequestHandler<PlaceRequest>(
157157
return
158158
}
159159
if (!validSneak(player)) return
160-
if (tickStage !in request.build.placing.placeStageMask) return
160+
if (tickStage !in request.placeStageMask) return
161161

162162
val actionResult = placeBlock(ctx, request, Hand.MAIN_HAND)
163163
if (!actionResult.isAccepted) {

0 commit comments

Comments
 (0)