File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,13 +34,14 @@ local equipment = {}
3434equipment .equip = function (_ , slot_items )
3535 local count = 0
3636 local items = {}
37- for slot , item in pairs (slot_items ) do
38- if slot >= 0 and slot <= 15 then
39- local bag = item and item .bag or 0
40- local index = item and item .index or 0
37+ for i = 0 , 15 do
38+ local item = slot_items [i ]
39+ if item then
40+ local bag = item .bag
41+ local index = item .index
4142 assert (equippable [bag ], ' Cannot equip from this bag (bag = ' .. bag .. ' )' )
42- assert (not item or item .id ~= 0 , ' Cannot equip from an empty bag slot (bag = ' .. bag .. ' , index = ' .. index .. ' )' )
43- items [count ] = {bag_index = index , slot_id = slot , bag_id = bag }
43+ assert (bag == 0 and index == 0 or item .id ~= 0 , ' Cannot equip from an empty bag slot (bag = ' .. bag .. ' , index = ' .. index .. ' )' )
44+ items [count ] = {bag_index = index , slot_id = i , bag_id = bag }
4445 count = count + 1
4546 end
4647 end
You can’t perform that action at this time.
0 commit comments