mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
move hud.get_player() out from util.lua & add error returning
This commit is contained in:
parent
73541e4ef6
commit
ebcbc017ac
2 changed files with 28 additions and 20 deletions
|
|
@ -2,8 +2,9 @@ local base_util = require "util"
|
|||
|
||||
function on_hud_open()
|
||||
events.on("core:drop_outside_inventory", function(mode)
|
||||
local pid = hud.get_player()
|
||||
local invid = hud.get_exchange_inventory()
|
||||
base_util.drop_from_slot(invid, 0, mode)
|
||||
base_util.drop_from_slot(pid, invid, 0, mode)
|
||||
end)
|
||||
input.add_callback("player.drop", function()
|
||||
if hud.is_paused() or hud.is_inventory_open() then
|
||||
|
|
@ -13,9 +14,9 @@ function on_hud_open()
|
|||
local invid, slot = player.get_inventory(pid)
|
||||
local mode = 1
|
||||
if input.is_pressed("key:left-ctrl") or input.is_pressed("key:right-ctrl") then
|
||||
mode = 0
|
||||
mode = 0
|
||||
end
|
||||
base_util.drop_from_slot(invid, slot, mode)
|
||||
base_util.drop_from_slot(pid, invid, slot, mode)
|
||||
end)
|
||||
rules.create("do-loot-non-player", true)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue