mirror of
http://repo.or.cz/minetest_pyramids/tsm_pyramids.git
synced 2024-12-22 23:40:18 +01:00
Put sand into chests in sand-flooded pyramids
This commit is contained in:
parent
acc22a5576
commit
fb6cbbea66
28
init.lua
28
init.lua
@ -30,23 +30,31 @@ else
|
|||||||
table.insert(chest_stuff, {name="farming:apple", max = 3})
|
table.insert(chest_stuff, {name="farming:apple", max = 3})
|
||||||
end
|
end
|
||||||
|
|
||||||
function tsm_pyramids.fill_chest(pos)
|
function tsm_pyramids.fill_chest(pos, stype, flood_sand)
|
||||||
minetest.after(2, function()
|
minetest.after(2, function()
|
||||||
|
local sand = "default:sand"
|
||||||
|
if stype == "desert" then
|
||||||
|
sand = "default:desert_sand"
|
||||||
|
end
|
||||||
local n = minetest.get_node(pos)
|
local n = minetest.get_node(pos)
|
||||||
if n and n.name and n.name == "default:chest" then
|
if n and n.name and n.name == "default:chest" then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*4)
|
inv:set_size("main", 8*4)
|
||||||
if math.random(1,10) < 7 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local stacks = {}
|
local stacks = {}
|
||||||
if minetest.get_modpath("treasurer") ~= nil then
|
-- Fill with sand in sand-flooded pyramids
|
||||||
stacks = treasurer.select_random_treasures(3,7,9,{"minetool", "food", "crafting_component"})
|
if flood_sand then
|
||||||
else
|
table.insert(stacks, {name=sand, count = math.random(1,40)})
|
||||||
for i=0,2,1 do
|
end
|
||||||
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
-- Add treasures
|
||||||
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
|
if math.random(1,10) >= 7 then
|
||||||
|
if minetest.get_modpath("treasurer") ~= nil then
|
||||||
|
stacks = treasurer.select_random_treasures(3,7,9,{"minetool", "food", "crafting_component"})
|
||||||
|
else
|
||||||
|
for i=0,2,1 do
|
||||||
|
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
||||||
|
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for s=1,#stacks do
|
for s=1,#stacks do
|
||||||
|
2
room.lua
2
room.lua
@ -635,7 +635,7 @@ function tsm_pyramids.make_room(pos, stype, room_id)
|
|||||||
local filled = 0
|
local filled = 0
|
||||||
while filled < 8 do
|
while filled < 8 do
|
||||||
for c=1, #chests do
|
for c=1, #chests do
|
||||||
tsm_pyramids.fill_chest(chests[c])
|
tsm_pyramids.fill_chest(chests[c], stype, room.flood_sand ~= false)
|
||||||
filled = filled + 1
|
filled = filled + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user