1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Allow binding dig, place actions to keys; remove LMB/RMB hardcoding

Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
This commit is contained in:
ANAND 2020-06-05 18:36:35 +05:30 committed by celeron55
parent fff0393187
commit 291a6b70d6
14 changed files with 284 additions and 310 deletions

View file

@ -1100,8 +1100,8 @@ Methods:
aux1 = boolean,
sneak = boolean,
zoom = boolean,
LMB = boolean,
RMB = boolean,
dig = boolean,
place = boolean,
}
```

View file

@ -6163,15 +6163,23 @@ object you are working with still exists.
* Only affects formspecs shown after this is called.
* `get_formspec_prepend(formspec)`: returns a formspec string.
* `get_player_control()`: returns table with player pressed keys
* The table consists of fields with boolean value representing the pressed
keys, the fields are jump, right, left, LMB, RMB, sneak, aux1, down, up, zoom.
* example: `{jump=false, right=true, left=false, LMB=false, RMB=false,
sneak=true, aux1=false, down=false, up=false, zoom=false}`
* The `zoom` field is available since 5.3
* The table consists of fields with the following boolean values
representing the pressed keys: `up`, `down`, `left`, `right`, `jump`,
`aux1`, `sneak`, `dig`, `place`, `LMB`, `RMB`, and `zoom`.
* The fields `LMB` and `RMB` are equal to `dig` and `place` respectively,
and exist only to preserve backwards compatibility.
* `get_player_control_bits()`: returns integer with bit packed player pressed
keys.
* bit nr/meaning: 0/up, 1/down, 2/left, 3/right, 4/jump, 5/aux1, 6/sneak,
7/LMB, 8/RMB, 9/zoom (zoom available since 5.3)
keys. Bits:
* 0 - up
* 1 - down
* 2 - left
* 3 - right
* 4 - jump
* 5 - aux1
* 6 - sneak
* 7 - dig
* 8 - place
* 9 - zoom
* `set_physics_override(override_table)`
* `override_table` is a table with the following fields:
* `speed`: multiplier to default walking speed value (default: `1`)