mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: input.add_callback and blocks placing when shift pressed
This commit is contained in:
parent
9dadae6e34
commit
9211e835db
2 changed files with 11 additions and 6 deletions
|
|
@ -31,16 +31,17 @@ static int l_mousecode(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int l_add_callback(lua_State* L) {
|
||||
static int l_add_callback(lua_State*) {
|
||||
auto bindname = state->requireString(1);
|
||||
const auto& bind = Events::bindings.find(bindname);
|
||||
if (bind == Events::bindings.end()) {
|
||||
throw std::runtime_error("unknown binding "+util::quote(bindname));
|
||||
}
|
||||
state->pushvalue(2);
|
||||
runnable actual_callback = state->createRunnable();
|
||||
runnable callback = [=]() {
|
||||
if (!scripting::engine->getGUI()->isFocusCaught()) {
|
||||
state->createRunnable();
|
||||
actual_callback();
|
||||
}
|
||||
};
|
||||
if (hud) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue