Skip to content
Permalink
Browse files

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

Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
  • Loading branch information
2 people authored and celeron55 committed Aug 15, 2020
1 parent fff0393 commit 291a6b70d674d9003f522b5875a60f7e2753e32b
@@ -110,9 +110,9 @@ doubletap_jump (Double tap jump for fly) bool false
# enabled.
always_fly_fast (Always fly and fast) bool true

# The time in seconds it takes between repeated right clicks when holding the right
# mouse button.
repeat_rightclick_time (Rightclick repetition interval) float 0.25 0.001
# The time in seconds it takes between repeated node placements when holding
# the place button.
repeat_place_time (Place repetition interval) float 0.25 0.001

# Automatically jump up single-node obstacles.
autojump (Automatic jumping) bool false
@@ -182,6 +182,14 @@ keymap_jump (Jump key) key KEY_SPACE
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_sneak (Sneak key) key KEY_LSHIFT

# Key for digging.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_dig (Dig key) key KEY_LBUTTON

# Key for placing.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_place (Place key) key KEY_RBUTTON

# Key for opening the inventory.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_inventory (Inventory key) key KEY_KEY_I
@@ -1100,8 +1100,8 @@ Methods:
aux1 = boolean,
sneak = boolean,
zoom = boolean,
LMB = boolean,
RMB = boolean,
dig = boolean,
place = boolean,
}
```

@@ -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`)
@@ -1307,7 +1307,7 @@ void Client::sendPlayerPos()
player->last_pitch == player->getPitch() &&
player->last_yaw == player->getYaw() &&
player->last_keyPressed == player->keyPressed &&
player->last_camera_fov == camera_fov &&
player->last_camera_fov == camera_fov &&
player->last_wanted_range == wanted_range)
return;

@@ -975,13 +975,13 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
if (controls.sneak && walking)
new_speed /= 2;

if (walking && (controls.LMB || controls.RMB)) {
if (walking && (controls.dig || controls.place)) {
new_anim = player->local_animations[3];
player->last_animation = WD_ANIM;
} else if(walking) {
} else if (walking) {
new_anim = player->local_animations[1];
player->last_animation = WALK_ANIM;
} else if(controls.LMB || controls.RMB) {
} else if (controls.dig || controls.place) {
new_anim = player->local_animations[2];
player->last_animation = DIG_ANIM;
}
@@ -1004,9 +1004,9 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)

// Update local player animations
if ((player->last_animation != old_anim ||
m_animation_speed != old_anim_speed) &&
player->last_animation != NO_ANIM && allow_update)
updateAnimation();
m_animation_speed != old_anim_speed) &&
player->last_animation != NO_ANIM && allow_update)
updateAnimation();

}
}

0 comments on commit 291a6b7

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