-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add vanilla camera movement keybinds based on the continuous keybind feature #349
Open
TaroEld
wants to merge
2
commits into
continuous-keybinds
Choose a base branch
from
vanilla-camera-moves
base: continuous-keybinds
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,29 +260,73 @@ local function isCampfireScreen() | |
} | ||
}, "Toggle Forced Attack", ::MSU.Key.KeyState.Release | ::MSU.Key.KeyState.Press); | ||
|
||
// World Continuous, doesn't work cuz we handle keybinds differently from vanilla ): | ||
|
||
// ::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_left", "left/a/q", ::MSU.Key.State.World, function() | ||
// { | ||
// if (::Settings.getTempGameplaySettings().CameraLocked) | ||
// { | ||
// this.m.WorldScreen.getTopbarOptionsModule().onCameraLockButtonPressed(); | ||
// } | ||
|
||
// ::World.getCamera().move(-1500.0 * ::Time.getDelta() * ::Math.maxf(1.0, ::World.getCamera().Zoom * 0.66), 0); | ||
// return true; | ||
// }, "Move Camera Up", null, ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press); | ||
|
||
// ::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_right", "right/d", ::MSU.Key.State.World, function() | ||
// { | ||
// if (::Settings.getTempGameplaySettings().CameraLocked) | ||
// { | ||
// this.m.WorldScreen.getTopbarOptionsModule().onCameraLockButtonPressed(); | ||
// } | ||
|
||
// ::World.getCamera().move(1500.0 * ::Time.getDelta() * ::Math.maxf(1.0, ::World.getCamera().Zoom * 0.66), 0); | ||
// return true; | ||
// }, "Move Camera Right", null, ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press); | ||
|
||
local function moveCameraWorld(_x, _y) | ||
{ | ||
if (::Settings.getTempGameplaySettings().CameraLocked) | ||
{ | ||
this.m.WorldScreen.getTopbarOptionsModule().onCameraLockButtonPressed(); | ||
} | ||
|
||
::World.getCamera().move(_x * ::Time.getDelta() * ::Math.maxf(1.0, ::World.getCamera().Zoom * 0.66), _y * ::Time.getDelta() * ::Math.maxf(1.0, ::World.getCamera().Zoom * 0.66)); | ||
return true; | ||
} | ||
//Camera Left | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_left", "left/a/q", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(-1500, 0); | ||
}, "Move Camera Up", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Right | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_right", "right/d", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(1500, 0); | ||
}, "Move Camera Right", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Up | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_up", "up/w/z", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(0, 1500); | ||
}, "Move Camera Up", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Down | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_down", "down/s", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(0, -1500); | ||
}, "Move Camera Down", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
// Camera Top Left | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_leftup", "left+up/left+w/left+z/a+up/a+w/a+z/q+up/q+w/q+z", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(-1500.0, 1500.0); | ||
}, "Move Camera Top Left", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Bottom Left | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_leftdown", "left+down/left+s/a+down/a+s/q+down/q+s", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(-1500.0, -1500.0); | ||
}, "Move Camera Bottom Left", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Top Right | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_rightup", "right+up/right+w/right+z/d+up/d+w/d+z", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(1500.0, 1500.0); | ||
}, "Move Camera Top Right", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Bottom Right | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("world_moveCamera_rightdown", "right+down/right+s/d+down/d+s", ::MSU.Key.State.World, function() | ||
{ | ||
return moveCameraWorld(1500.0, -1500.0); | ||
}, "Move Camera Bottom Right", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
|
||
//-------------------------------------------TACTICAL ONLY--------------------------------------------------------------------------------- | ||
|
||
|
@@ -356,7 +400,70 @@ local function isCampfireScreen() | |
return true; | ||
}, "Focus on Active Character"); | ||
|
||
local function moveCameraTactical(_x, _y) | ||
{ | ||
if (this.isInputLocked() || this.isInCharacterScreen() || this.m.IsDeveloperModeEnabled || this.m.MenuStack.hasBacksteps()) | ||
{ | ||
return false; | ||
} | ||
|
||
this.Tactical.getCamera().move(_x * this.Time.getDelta(), _y * this.Time.getDelta()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return true; | ||
} | ||
|
||
//Camera Left | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_left", "left/a/q", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(-1500, 0); | ||
}, "Move Camera Up", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Right | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_right", "right/d", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(1500, 0); | ||
}, "Move Camera Right", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Up | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_up", "up/w/z", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(0, 1500); | ||
}, "Move Camera Up", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Down | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_down", "down/s", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(0, -1500); | ||
}, "Move Camera Down", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
// Camera Top Left | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_leftup", "left+up/left+w/left+z/a+up/a+w/a+z/q+up/q+w/q+z", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(-1500.0, 1500.0); | ||
}, "Move Camera Top Left", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Bottom Left | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_leftdown", "left+down/left+s/a+down/a+s/q+down/q+s", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(-1500.0, -1500.0); | ||
}, "Move Camera Bottom Left", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Top Right | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_rightup", "right+up/right+w/right+z/d+up/d+w/d+z", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(1500.0, 1500.0); | ||
}, "Move Camera Top Right", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
//Camera Bottom Right | ||
|
||
::MSU.Vanilla.Keybinds.addSQKeybind("tactical_moveCamera_rightdown", "right+down/right+s/d+down/d+s", ::MSU.Key.State.Tactical, function() | ||
{ | ||
return moveCameraTactical(1500.0, -1500.0); | ||
}, "Move Camera Bottom Right", ::MSU.Key.KeyState.Continuous | ::MSU.Key.KeyState.Press).setCallContinuously(true); | ||
|
||
// ::MSU.System.Keybinds.registerMod(::MSU.ID) | ||
// local jskeybind = ::MSU.Class.KeybindJS(::MSU.ID, "testkb", "ctrl+s"); | ||
// ::MSU.System.Keybinds.add(jskeybind); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be camelCase in
leftup
in the id i.e.leftUp
? Similarly for the other keybinds you've added.