Put treasure loot into random inventory slots
This commit is contained in:
parent
7851cee45e
commit
1daf9b7a59
4 changed files with 58 additions and 12 deletions
|
@ -366,9 +366,7 @@ minetest.register_on_generated(function(minp, maxp)
|
|||
local meta = minetest.get_meta(cpos)
|
||||
local inv = meta:get_inventory()
|
||||
local items = get_loot()
|
||||
for i=1, math.min(#items, inv:get_size("main")) do
|
||||
inv:set_stack("main", i, ItemStack(items[i]))
|
||||
end
|
||||
mcl_loot.fill_inventory(inv, "main", items)
|
||||
end
|
||||
|
||||
-- Mob spawners are placed seperately, too
|
||||
|
|
|
@ -188,9 +188,7 @@ mcl_structures.generate_igloo_basement = function(pos, orientation)
|
|||
local meta = minetest.get_meta(chest_pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 9*3)
|
||||
for i=1, #lootitems do
|
||||
inv:add_item("main", lootitems[i])
|
||||
end
|
||||
mcl_loot.fill_inventory(inv, "main", lootitems)
|
||||
end
|
||||
return success
|
||||
end
|
||||
|
@ -401,9 +399,7 @@ mcl_structures.generate_desert_temple = function(pos)
|
|||
local meta = minetest.get_meta(chests[c])
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 9*3)
|
||||
for i=1, #lootitems do
|
||||
inv:add_item("main", lootitems[i])
|
||||
end
|
||||
mcl_loot.fill_inventory(inv, "main", lootitems)
|
||||
end
|
||||
|
||||
-- Initialize pressure plates and randomly remove up to 5 plates
|
||||
|
|
|
@ -377,9 +377,7 @@ local function PlaceChest(pos, param2)
|
|||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local items = tsm_railcorridors.get_treasures(pr)
|
||||
for i=1, math.min(#items, inv:get_size("main")) do
|
||||
inv:set_stack("main", i, ItemStack(items[i]))
|
||||
end
|
||||
mcl_loot.fill_inventory(inv, "main", items)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue