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 = {} local stacks = {}
-- Fill with sand in sand-flooded pyramids -- Fill with sand in sand-flooded pyramids
if flood_sand then 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 end
-- Add treasures -- Add treasures
if math.random(1,10) >= 7 then if math.random(1,10) >= 7 then

View File

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