mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
RealBadAngel's patch which allows the lua api to read pressed player keys. This should make it possible to change the player's animation based on what he is doing
Correct lua api version number Always update animations and attachments after the entity is added to scene client side. Fixes animations not being applied in client initialization for some reason. Attachments should be re-tested now just to be safe. Fix a segmentation fault caused by reaching materials that didn't exist in a loop for setting texture
This commit is contained in:
parent
756db8174a
commit
3d1c481f0b
9 changed files with 165 additions and 69 deletions
16
src/game.cpp
16
src/game.cpp
|
@ -1881,6 +1881,8 @@ void the_game(
|
|||
bool a_jump,
|
||||
bool a_superspeed,
|
||||
bool a_sneak,
|
||||
bool a_LMB,
|
||||
bool a_RMB,
|
||||
float a_pitch,
|
||||
float a_yaw*/
|
||||
PlayerControl control(
|
||||
|
@ -1891,10 +1893,24 @@ void the_game(
|
|||
input->isKeyDown(getKeySetting("keymap_jump")),
|
||||
input->isKeyDown(getKeySetting("keymap_special1")),
|
||||
input->isKeyDown(getKeySetting("keymap_sneak")),
|
||||
input->getLeftState(),
|
||||
input->getRightState(),
|
||||
camera_pitch,
|
||||
camera_yaw
|
||||
);
|
||||
client.setPlayerControl(control);
|
||||
u32 keyPressed=
|
||||
1*(int)input->isKeyDown(getKeySetting("keymap_forward"))+
|
||||
2*(int)input->isKeyDown(getKeySetting("keymap_backward"))+
|
||||
4*(int)input->isKeyDown(getKeySetting("keymap_left"))+
|
||||
8*(int)input->isKeyDown(getKeySetting("keymap_right"))+
|
||||
16*(int)input->isKeyDown(getKeySetting("keymap_jump"))+
|
||||
32*(int)input->isKeyDown(getKeySetting("keymap_special1"))+
|
||||
64*(int)input->isKeyDown(getKeySetting("keymap_sneak"))+
|
||||
128*(int)input->getLeftState()+
|
||||
256*(int)input->getRightState();
|
||||
LocalPlayer* player = client.getEnv().getLocalPlayer();
|
||||
player->keyPressed=keyPressed;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue