mirror of
https://github.com/tacigar/maidroid.git
synced 2024-11-14 14:20:22 +01:00
Update main_to_wield
This commit is contained in:
parent
472ba9b43a
commit
1093fae792
|
@ -140,13 +140,13 @@ end
|
||||||
|
|
||||||
-- maidroid.maidroid.move_main_to_wield moves itemstack from main to wield.
|
-- maidroid.maidroid.move_main_to_wield moves itemstack from main to wield.
|
||||||
-- if this function fails then returns false, else returns true.
|
-- if this function fails then returns false, else returns true.
|
||||||
function maidroid.maidroid.move_main_to_wield(self, itemname)
|
function maidroid.maidroid.move_main_to_wield(self, pred)
|
||||||
local inv = self:get_inventory()
|
local inv = self:get_inventory()
|
||||||
local main_size = inv:get_size("main")
|
local main_size = inv:get_size("main")
|
||||||
|
|
||||||
for i = 1, main_size do
|
for i = 1, main_size do
|
||||||
local stack = inv:get_stack("main", i)
|
local stack = inv:get_stack("main", i)
|
||||||
if stack:get_name() == itemname then
|
if pred(stack:get_name()) then
|
||||||
local wield_stack = inv:get_stack("wield_item", 1)
|
local wield_stack = inv:get_stack("wield_item", 1)
|
||||||
inv:set_stack("wield_item", 1, stack)
|
inv:set_stack("wield_item", 1, stack)
|
||||||
inv:set_stack("main", i, wield_stack)
|
inv:set_stack("main", i, wield_stack)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user