Refactor mcl_dungeons

This commit is contained in:
Wuzzy 2017-05-24 12:15:20 +02:00
parent 4625d2e8f8
commit 99a54319b1
1 changed files with 29 additions and 26 deletions

View File

@ -153,8 +153,12 @@ minetest.register_on_generated(function(minp, maxp)
end
-- Check conditions. If okay, start generating
if ceilingfloor_ok and openings >= 1 and openings <= 5 then
-- Okay! Spawning starts!
-- First prepare random chest positions.
-- Chests spawn at wall
-- But prepare random chest positions beforehand
-- We assign each position at the wall a number and each chest gets one of these numbers randomly
local totalChests = 2
local totalChestSlots = (dim.x-1) * (dim.z-1)
@ -177,7 +181,6 @@ minetest.register_on_generated(function(minp, maxp)
table.sort(chestSlots)
local currentChest = 1
if ceilingfloor_ok and openings >= 1 and openings <= 5 then
-- Ceiling and floor
local maxx, maxy, maxz = x+dim.x+1, y+dim.y+1, z+dim.z+1
local chestSlotCounter = 1