cleaner loader
This commit is contained in:
parent
ee3924e713
commit
7eff40a34f
@ -102,6 +102,7 @@ minetest.register_on_player_receive_fields(function(player, bot_key, fields)
|
||||
local inv_involved = {}
|
||||
if inv_list then
|
||||
for _,v in pairs(inv_list) do
|
||||
--print(dump(v))
|
||||
local parts = string.split(v," ")
|
||||
if #parts == 3 then
|
||||
inv_involved[parts[1]]=true
|
||||
@ -115,11 +116,19 @@ minetest.register_on_player_receive_fields(function(player, bot_key, fields)
|
||||
inv:set_stack(i,a, "")
|
||||
end
|
||||
end
|
||||
local i={}
|
||||
for _,v in pairs(inv_list) do
|
||||
local parts = string.split(v," ")
|
||||
if #parts == 3 then
|
||||
inv:add_item(parts[1],parts[2].." "..parts[3])
|
||||
if not i[parts[1]] then
|
||||
i[parts[1]]=1
|
||||
else
|
||||
i[parts[1]]=i[parts[1]]+1
|
||||
end
|
||||
local stack=""
|
||||
if #parts == 3 then
|
||||
stack = parts[2].." "..parts[3]
|
||||
end
|
||||
inv:set_stack(parts[1], i[parts[1]], stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
6
init.lua
6
init.lua
@ -134,10 +134,10 @@ vbots.save = function(pos)
|
||||
for i,t in pairs(meta_table.inventory) do
|
||||
if i ~= "main" then
|
||||
for _,s in pairs(t) do
|
||||
local itemname = s:get_name()
|
||||
if s and s:get_count()>0 and itemname:sub(1,5)=="vbots" then
|
||||
--local itemname = s:get_name()
|
||||
--if s and s:get_count()>0 and itemname:sub(1,5)=="vbots" then
|
||||
inv_list[#inv_list+1] = i.." "..s:get_name().." "..s:get_count()
|
||||
end
|
||||
--end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user