Skip to content
Permalink
Browse files

Shift support and improved README

  • Loading branch information...
Silverfeelin committed Sep 3, 2017
1 parent 3fd54e0 commit f28c36f419c935d3f970823b7441707835256ebe
Showing with 30 additions and 49 deletions.
  1. +1 −1 .metadata
  2. +23 −45 README.md
  3. +6 −3 scripts/keybinds.lua
@@ -2,7 +2,7 @@
"name" : "Keybinds",
"friendlyName" : "Keybinds Library",
"priority" : 999,
"version" : "1.3.0",
"version" : "1.3.2",
"author" : "Silverfeelin",
"description" : "Allows tech mods to easily bind input options to code.

@@ -73,51 +73,29 @@ Note that a keybind will reset once one or more input options of it no longer ma
## Syntax Options
For every input option, please refer to the documentation of it's value type. The descriptions are based on the default keyboard configuration of the game.

1. `Up` ([boolean](#boolean))
True while holding W.
2. `Left` ([boolean](#boolean))
True while holding A.
3. `Down` ([boolean](#boolean))
True while holding S.
4. `Right` ([boolean](#boolean))
True while holding D.
5. `primaryFire` ([boolean](#boolean))
True while holding down the left mouse button.
6. `altFire` ([boolean](#boolean))
True while holding down the right mouse button.
7. `onGround` ([boolean](#boolean))
True while standing on the ground.
8. `running` ([boolean](#boolean))
True while actively running.
9. `walking` ([boolean](#boolean))
True while actively walking (running while holding shift).
10. `jumping` ([boolean](#boolean))
True while holding space.
11. `facingDirection` ([float](#float))
`-1` while facing left. `1` while facing right.
12. `liquidPercentage` ([float](#float))
Value between `0` and `1`, indicating what percentage of your hitbox is submerged.
13. `position` ([vec2](#vec2))
Position of your character on the world, in blocks.
14. `aimPosition` ([vec2](#vec2))
Position of your cursor on the world, in blocks.
15. `aimRelative` ([vec2](#vec2))
`aimPosition` relative to `position`.
16. `f` ([boolean](#boolean))
True while holding F.
* 'PlayerTechAction1' defaults to F.
17. `g` ([boolean](#boolean))
True while holding G.
* 'PlayerTechAction2' is not bound by default anymore. You can bind it by adding an option to the keybindingsmenu.config.
18. `h` ([boolean](#boolean))
True while holding H.
* 'PlayerTechAction3' is not bound by default anymore. You can bind it by adding an option to the keybindingsmenu.config.
19. `aimOffset` ([vec2](#vec2))
Value indicating how far `position`, `aimPosition` and `aimRelative` may be off. With no value set, the default value `2,2` is used.
An example: `"aimRelative=20,25 aimOffset=2,10"`
If your relative aim is `(21, 17)`, the result would be true. The horizontal position `21` falls in the range of `20±2` and the vertical position `17` falls in the range of `25±10`.
20. `time` ([float](#float))
Value indicating how long the other input options should match before running the function. Note that this time is **not** used as an interval when repeatable is set to true; the function will still be called every tick.
| Key | Type | Description |
| --- | ---- | ----------- |
| `up` | [boolean](#boolean) | True while holding <kbd>w</kbd>. |
| `left` | [boolean](#boolean) | True while holding <kbd>a</kbd>. |
| `down` | [boolean](#boolean) | True while holding <kbd>s</kbd>. |
| `right` | [boolean](#boolean) | True while holding <kbd>d</kbd>. |
| `primaryFire` | [boolean](#boolean) | True while holding down the left mouse button. |
| `altFire` | [boolean](#boolean) | True while holding down the right mouse button. |
| `shift` | [boolean](#boolean) | True while holding down <kbd>shift</kbd>. |
| `onGround` | [boolean](#boolean) | True while standing on the ground. |
| `running` | [boolean](#boolean) | True while actively running. |
| `walking` | [boolean](#boolean) | True while actively walking (running while holding shift). |
| `jumping` | [boolean](#boolean) | True while holding space. |
| `facingDirection` | [float](#float) | `-1` while facing left. `1` while facing right. |
| `liquidPercentage` | [float](#float) | Value between `0` and `1`, indicating what percentage of your hitbox is submerged. |
| `position` | [vec2](#vec2) | World position of your character in blocks. |
| `aimPosition` | [vec2](#vec2) | Position of your cursor on the world, in blocks.
| `aimRelative` | [vec2](#vec2) | `aimPosition` relative to `position`. |
| `specialOne` | [boolean](#boolean) | True while holding F (`PlayerTechAction1`). |
| `specialTwo` | [boolean](#boolean) | True while holding G (`PlayerTechAction2`). |
| `specialThree` | [boolean](#boolean) | True while holding H (`PlayerTechAction3`). |
| aimOffset | [vec2](#vec2) | Value indicating how far `position`, `aimPosition` and `aimRelative` may be off. With no value set, the default value `2,2` is used.<br>An example: `"aimRelative=20,25 aimOffset=2,10"`<br>If your relative aim is `(21, 17)`, the result would be true. |
| time | [float](#float) | Value indicating how long the other input options should match before running the function. Note that this time is **not** used as an interval when repeatable is set to true; the function will still be called every tick. |

[Back to Top](#starbound-keybinds)

@@ -6,7 +6,7 @@ https://github.com/Silverfeelin/Starbound-Keybinds
keybinds = {
binds = {},
initialized = false,
version = "1.3.0"
version = "1.3.2"
}

-- For every type of input, set whether it can be bound.
@@ -18,6 +18,7 @@ keybinds.availableInputs = {
right = true,
primaryFire = true,
altFire = true,
shift = true,
onGround = true,
running = true,
walking = true,
@@ -46,6 +47,7 @@ keybinds.inputStrings = {
right = "right",
primaryfire = "primaryFire",
altfire = "altFire",
shift = "shift",
onground = "onGround",
running = "running",
walking = "walking",
@@ -68,7 +70,7 @@ keybinds.inputStrings = {
-- Default values, do not touch.
keybinds.input = {
up = false, left = false, down = false, right = false,
primaryFire = false, altFire = false,
primaryFire = false, altFire = false, shift = false,
onGround = true, running = false, walking = false, jumping = false,
facingDirection = 1, liquidPercentage = 0,
position = {0, 0}, aimPosition = {0, 0}, aimOffset = {2, 2}, aimRelative = {0, 0},
@@ -137,6 +139,8 @@ function keybinds.updateInput(args)
input.primaryFire = args.moves.primaryFire
input.altFire = args.moves.altFire

input.shift = not args.moves.run

input.onGround = mcontroller.onGround()
input.running = mcontroller.running()
input.walking = mcontroller.walking()
@@ -213,7 +217,6 @@ function string:split(sep)
return fields
end


Bind = {}
Bind.__index = Bind

0 comments on commit f28c36f

Please sign in to comment.
You can’t perform that action at this time.