mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
fix middle click on access panel
This commit is contained in:
parent
1040a3a183
commit
047f050364
4 changed files with 34 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "InventoryView.hpp"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
#include "assets/Assets.hpp"
|
||||
|
|
@ -501,10 +502,14 @@ void SlotView::performRightClick(ItemStack& stack, ItemStack& grabbed) {
|
|||
}
|
||||
|
||||
void SlotView::performMiddleClick(ItemStack& stack, ItemStack& grabbed) {
|
||||
scripting::on_slot_middle_click(
|
||||
inventoryId,
|
||||
layout.index
|
||||
);
|
||||
if (layout.itemSource) {
|
||||
scripting::on_access_panel_slot_middle_click(stack.getItemId());
|
||||
} else {
|
||||
scripting::on_slot_middle_click(
|
||||
inventoryId,
|
||||
layout.index
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void SlotView::clicked(Mousecode button) {
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ namespace scripting {
|
|||
void on_inventory_interact(int invid, int slot, int action, int mode);
|
||||
|
||||
void on_slot_middle_click(int invid, int slot);
|
||||
void on_access_panel_slot_middle_click(const itemid_t itemid);
|
||||
|
||||
void on_player_tick(Player* player, int tps);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "lua/libs/api_lua.hpp"
|
||||
#include "lua/lua_engine.hpp"
|
||||
#include "scripting.hpp"
|
||||
#include "typedefs.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
|
||||
|
|
@ -123,6 +124,18 @@ void scripting::on_slot_middle_click(int invid, int slot) {
|
|||
);
|
||||
}
|
||||
|
||||
void scripting::on_access_panel_slot_middle_click(const itemid_t itemid) {
|
||||
auto L = lua::get_main_state();
|
||||
lua::emit_event(
|
||||
L,
|
||||
"core:access_panel_slot_middle_click",
|
||||
[&](lua::State* L) {
|
||||
lua::pushinteger(L, itemid);
|
||||
return 1;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void scripting::load_hud_script(
|
||||
const scriptenv& senv,
|
||||
const std::string& packid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue