new data structure
parent
058f943863
commit
aaee33155d
10
api.lua
10
api.lua
|
@ -19,9 +19,17 @@ kiosk.add_inv=function(name,def)
|
|||
def.sell = kiosk.sell_factor * def.buy
|
||||
end
|
||||
if def.stock==nil then def.stock=0 end
|
||||
if def.dug==nil then def.dug=0 end
|
||||
if def.crafted==nil then def.crafted=0 end
|
||||
|
||||
if kiosk.inventar[name] ~= nil then kiosk.inventar[name] = nil end
|
||||
|
||||
local dn = name:split(":")[1]
|
||||
if dn == "group" then
|
||||
print(name)
|
||||
def.is_group=1
|
||||
end
|
||||
|
||||
kiosk.inventar[name] = def
|
||||
|
||||
end
|
||||
|
@ -51,6 +59,8 @@ kiosk.add_inventar=function(name,buy_value,sell_value,stock,fixed)
|
|||
sell = sell_value,
|
||||
buy = buy_value,
|
||||
stock=stock,
|
||||
dug=0,
|
||||
craft=0,
|
||||
}
|
||||
if fixed ~= nil then kinv.fixed=fixed end
|
||||
kiosk.inventar[name] = kinv
|
||||
|
|
17
config.lua
17
config.lua
|
@ -56,7 +56,14 @@ for i,v in pairs(minetest.registered_nodes) do
|
|||
if not kiosk.is_inventar(dn) then
|
||||
kiosk.add_inv(dn,{buy_value=node_price/(dcount*10)})
|
||||
end
|
||||
kiosk.is_drop_item(dn)
|
||||
if w.rarity then
|
||||
if w.rarity == 1 then
|
||||
kiosk.is_drop_item(dn)
|
||||
end
|
||||
else
|
||||
kiosk.is_drop_item(dn)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -93,6 +100,14 @@ for i,v in pairs(kiosk.inventar) do
|
|||
end
|
||||
end
|
||||
|
||||
local end_dest={}
|
||||
for i,v in pairs(kiosk.inventar) do
|
||||
if v.dest==nil and v.source ~= nil then
|
||||
table.insert(end_dest,i)
|
||||
end
|
||||
end
|
||||
--print(dump2(end_dest))
|
||||
|
||||
-- initialise map_extend with values, which are corrected in first run
|
||||
kiosk.map_extend={emin={x=31000,y=31000,z=31000},emax={x=(-31000),y=(-31000),z=(-31000)},volume=0}
|
||||
|
||||
|
|
Loading…
Reference in New Issue