Fix various flood_sand bugs

This commit is contained in:
Wuzzy 2019-08-20 03:26:54 +02:00
parent 6fc1d927f8
commit 6a43244322
2 changed files with 5 additions and 8 deletions

View File

@ -44,7 +44,7 @@ function tsm_pyramids.fill_chest(pos, stype, flood_sand)
local stacks = {}
-- Fill with sand in sand-flooded pyramids
if flood_sand then
table.insert(stacks, {name=sand, count = math.random(1,25)})
table.insert(stacks, {name=sand, count = math.random(1,32)})
end
-- Add treasures
if math.random(1,10) >= 7 then

View File

@ -630,12 +630,13 @@ function tsm_pyramids.make_room(pos, stype, room_id)
else
minetest.log("error", "Invalid pyramid room style! room type ID="..r)
end
local sanded = room.flood_sand ~= false and math.random(1,8) == 1
if #chests > 0 then
-- Make at least 8 attempts to fill chests
local filled = 0
while filled < 8 do
for c=1, #chests do
tsm_pyramids.fill_chest(chests[c], stype, room.flood_sand ~= false)
tsm_pyramids.fill_chest(chests[c], stype, sanded)
filled = filled + 1
end
end
@ -643,12 +644,8 @@ function tsm_pyramids.make_room(pos, stype, room_id)
if room.traps then
tsm_pyramids.make_traps(pos, stype)
end
local sanded = false
if room.flood_sand ~= false then
if math.random(1,8) == 1 then
tsm_pyramids.flood_sand(pos, stype)
sanded = true
end
if sanded then
tsm_pyramids.flood_sand(pos, stype)
end
return true, nil, sanded
end