diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-10-21 18:51:57 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-10-21 18:51:57 +0200 |
commit | ea88dde4be225d19c12bea4a581aa21f17237070 (patch) | |
tree | 3787863e03a7222b1c3fde0c37c2d85ae8821326 /builtin/client/util.lua | |
parent | f1ff05bf5932a7825509dbe896e60183a96a6d36 (diff) | |
download | dragonfireclient-ea88dde4be225d19c12bea4a581aa21f17237070.tar.xz |
Added Strip, AutoRefill, indexing for InventoryActions and Wield Index starts at 1 now
Diffstat (limited to 'builtin/client/util.lua')
-rw-r--r-- | builtin/client/util.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/client/util.lua b/builtin/client/util.lua index d61b547c6..20e0e1d1b 100644 --- a/builtin/client/util.lua +++ b/builtin/client/util.lua @@ -21,9 +21,9 @@ function core.parse_relative_pos(param) return success, pos end -function core.find_item(item) +function core.find_item(item, mini, maxi) for index, stack in ipairs(core.get_inventory("current_player").main) do - if stack:get_name() == item then + if (not mini or index >= mini) and (not maxi or index <= maxi) and stack:get_name() == item then return index end end @@ -32,7 +32,7 @@ end function core.switch_to_item(item) local i = core.find_item(item) if i then - core.localplayer:set_wield_index(i - 1) + core.localplayer:set_wield_index(i) return true else return false |