Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ Useful for spinning the camera manually, then aligning to the grid.
When clicking the compass, the camera will snap to face the same direction as your character.

### Snap Then Cycle Mode
When clicking the compass, the camera will snap to the closest **allowed** direction (from cycle order field), and if you're already on an allowed direction, it will cycle through them.
For example, with cycle order "N,S": First click from South-East snaps to South. Next click cycles to North. Next click cycles back to South.
When clicking the compass, the camera will snap to the closest **allowed** direction (from cycle order field).
If you click again within 2 seconds while already on an allowed direction, it will cycle through allowed directions.
If you wait longer than 2 seconds, the next click re-snaps instead of cycling.
For example, with cycle order "N,S": First click from South-East snaps to South. A quick second click cycles to North. If you wait a few seconds, a click re-centers instead of cycling.

### Shift-Click Option
You can configure how the plugin responds to clicks on the compass:
Expand All @@ -37,7 +39,7 @@ You can set up shortcuts for quick camera control. To prevent shortcuts from app
- **Snap to Facing**: Snap camera to your character's facing direction when pressed
- **Snap to Closest**: Snap camera to the closest cardinal direction when pressed
- **Cycle Cardinal**: Cycle through your custom cycle order of directions when pressed
- **Snap Then Cycle**: Snap to closest allowed direction; if snapped, cycle when pressed
- **Snap Then Cycle**: Snap to closest allowed direction; quick re-press (within 2 seconds) cycles
- **Look North Key**: Face camera North when pressed
- **Look South Key**: Face camera South when pressed
- **Look East Key**: Face camera East when pressed
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
}

group = 'com.compassCameraControl'
version = '1.2.3'
version = '1.2.4'

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
Expand Down
2 changes: 1 addition & 1 deletion runelite-plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ author=Raaz
description=Expands compass functionality
tags=camera, compass, control, navigation, usability, convenience
plugins=com.compassCameraControl.CompassCameraControlPlugin
version=1.2.3
version=1.2.4
build=standard
support=https://github.com/RaazKH/CompassCameraControl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface CompassCameraControlConfig extends Config
description = "Cycle: North -> South -> East -> West (default)<br/>" +
"Snap to Closest: Snaps the camera to the nearest cardinal direction<br/>" +
"Snap to Facing: Snaps the camera to the player's facing direction<br/>" +
"Snap then Cycle: Snaps to cardinal within cycle order, then cycle"
"Snap then Cycle: Snaps to cardinal; re-click within 2 seconds to cycle"
)
default ControlMode controlMode()
{
Expand Down Expand Up @@ -99,7 +99,7 @@ default Keybind cycleCardinalKey() {
position = 8,
section = cardinalKeybindingSnap,
description = "Snap to the closest allowed direction (within cycle order)<br/>" +
"Cycle if already on an allowed direction"
"Quick re-press within 2 seconds cycles if already on an allowed direction"
)
default Keybind snapThenCycleKey() {
return new Keybind(KeyEvent.VK_UNDEFINED, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class CompassCameraControlPlugin extends Plugin
private static final String SNAP_CARDINAL = "Snap Cardinal";
private static final String CYCLE_CARDINAL = "Cycle Cardinal";
private static final String SNAP_THEN_CYCLE = "Snap Then Cycle";
private static final long HYBRID_CYCLE_TIMEOUT_MS = 2000L;

private long lastHybridClickTimeMs;

@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
Expand Down Expand Up @@ -199,6 +202,7 @@ private void alignYaw(int[] yaws)

private void hybridSnapThenCycle()
{
long nowMs = System.currentTimeMillis();
int currentYaw = client.getCameraYaw();
int[] allowedYaws = cycleOrderToYaws();

Expand All @@ -213,14 +217,16 @@ private void hybridSnapThenCycle()
}
}

if (isOnAllowedCardinal)
if (isOnAllowedCardinal && (nowMs - lastHybridClickTimeMs) <= HYBRID_CYCLE_TIMEOUT_MS)
Comment thread
RaazKH marked this conversation as resolved.
{
cycleYaw(allowedYaws);
}
else
{
alignYaw(allowedYaws);
}

lastHybridClickTimeMs = nowMs;
}

private void facingYaw()
Expand Down