From 6a43244322375096faa3f2d0ec210dc3fcc5e933 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 20 Aug 2019 03:26:54 +0200 Subject: [PATCH] Fix various flood_sand bugs --- init.lua | 2 +- room.lua | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index d304f91..e7ed4b5 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/room.lua b/room.lua index 938e50c..93ca40a 100644 --- a/room.lua +++ b/room.lua @@ -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