Adjust pyramid caskets.
This commit is contained in:
parent
695316ea2a
commit
e2d29e0dd9
3 changed files with 18 additions and 34 deletions
10
mapgen.lua
10
mapgen.lua
|
@ -374,7 +374,6 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
end
|
end
|
||||||
|
|
||||||
local aster = false
|
local aster = false
|
||||||
local true_casket
|
|
||||||
if minp.y > 17200 then
|
if minp.y > 17200 then
|
||||||
-- nop
|
-- nop
|
||||||
elseif minp.y > 11000 then
|
elseif minp.y > 11000 then
|
||||||
|
@ -403,7 +402,7 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
write2, write_p2 = fun_caves.decogen(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone)
|
write2, write_p2 = fun_caves.decogen(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone)
|
||||||
write3 = fun_caves.treegen(minp, maxp, data, p2data, area, node)
|
write3 = fun_caves.treegen(minp, maxp, data, p2data, area, node)
|
||||||
if not write3 then
|
if not write3 then
|
||||||
write4, write_p4, true_casket = fun_caves.pyramid(minp, maxp, data, p2data, area, biomemap, biome_ids, node, heightmap)
|
write4, write_p4 = fun_caves.pyramid(minp, maxp, data, p2data, area, biomemap, biome_ids, node, heightmap)
|
||||||
end
|
end
|
||||||
if biomemap and not (write3 or write4) then
|
if biomemap and not (write3 or write4) then
|
||||||
local biome = biome_ids[biomemap[40*80+40]]
|
local biome = biome_ids[biomemap[40*80+40]]
|
||||||
|
@ -431,13 +430,6 @@ local function generate(p_minp, p_maxp, seed)
|
||||||
end
|
end
|
||||||
vm:update_liquids()
|
vm:update_liquids()
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
|
|
||||||
if true_casket then
|
|
||||||
vm:update_map()
|
|
||||||
local meta = minetest.get_meta(true_casket)
|
|
||||||
local id = meta:set_string('true', 'true')
|
|
||||||
--print('* True casket at '..minetest.pos_to_string(true_casket))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Deal with memory issues. This, of course, is supposed to be automatic.
|
-- Deal with memory issues. This, of course, is supposed to be automatic.
|
||||||
|
|
27
pyramid.lua
27
pyramid.lua
|
@ -10,10 +10,8 @@ minetest.register_node("fun_caves:pyramid_1", newnode)
|
||||||
|
|
||||||
local newnode = fun_caves.clone_node("default:chest")
|
local newnode = fun_caves.clone_node("default:chest")
|
||||||
newnode.description = "Treasure Casket"
|
newnode.description = "Treasure Casket"
|
||||||
newnode.on_construct = function(pos)
|
newnode.light_source = 1
|
||||||
local meta = minetest.get_meta(pos)
|
newnode.on_construct = nil
|
||||||
meta:set_string("true", 'true')
|
|
||||||
end
|
|
||||||
|
|
||||||
local chest_formspec =
|
local chest_formspec =
|
||||||
"size[8,9]" ..
|
"size[8,9]" ..
|
||||||
|
@ -37,14 +35,14 @@ local gems = {'fun_caves:moonstone', 'fun_caves:coral_gem', 'fun_caves:garnet',
|
||||||
|
|
||||||
newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local true_casket = meta:get_string('true')
|
|
||||||
if true_casket ~= 'true' then
|
|
||||||
clicker:set_hp(clicker:get_hp() - 2)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ready = meta:get_string('formspec')
|
local ready = meta:get_string('formspec')
|
||||||
|
|
||||||
if ready == '' then
|
if ready == '' then
|
||||||
|
if math.random(15) ~= 1 then
|
||||||
|
meta:set_string("formspec", 'del')
|
||||||
|
clicker:set_hp(clicker:get_hp() - 2)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
else
|
||||||
meta:set_string("formspec", chest_formspec)
|
meta:set_string("formspec", chest_formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*4)
|
inv:set_size("main", 8*4)
|
||||||
|
@ -53,6 +51,7 @@ newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
inv:add_item('main', gems[math.random(#gems)])
|
inv:add_item('main', gems[math.random(#gems)])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
minetest.register_node("fun_caves:casket", newnode)
|
minetest.register_node("fun_caves:casket", newnode)
|
||||||
|
|
||||||
|
@ -75,7 +74,6 @@ fun_caves.pyramid = function(minp, maxp, data, p2data, area, biomemap, biome_ids
|
||||||
if not pyramid_biomes[biome] then
|
if not pyramid_biomes[biome] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--print('* Creating pyramid in '..biome)
|
|
||||||
elseif math.random(5) ~= 1 then
|
elseif math.random(5) ~= 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -109,7 +107,6 @@ fun_caves.pyramid = function(minp, maxp, data, p2data, area, biomemap, biome_ids
|
||||||
|
|
||||||
local write = true
|
local write = true
|
||||||
local p2write = false
|
local p2write = false
|
||||||
local caskets = {}
|
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
local index3d = 0
|
local index3d = 0
|
||||||
|
@ -121,14 +118,12 @@ fun_caves.pyramid = function(minp, maxp, data, p2data, area, biomemap, biome_ids
|
||||||
index3d = math.floor((z - minp.z) / 5) * (csize.y) * csize.x + math.floor((x - minp.x) / 5) + 1
|
index3d = math.floor((z - minp.z) / 5) * (csize.y) * csize.x + math.floor((x - minp.x) / 5) + 1
|
||||||
local ivm = area:index(x, minp.y, z)
|
local ivm = area:index(x, minp.y, z)
|
||||||
|
|
||||||
--pyramid_1[index] = math.floor(pyramid_1[index] + 0.5)
|
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
local dy = y - minp.y
|
local dy = y - minp.y
|
||||||
|
|
||||||
if dy >= base_height + 3 and dy <= base_height + 37 - math.max(math.abs(dx - 40), math.abs(dz - 40)) and pyramid_1[index3d] > 0 then
|
if dy >= base_height + 3 and dy <= base_height + 37 - math.max(math.abs(dx - 40), math.abs(dz - 40)) and pyramid_1[index3d] > 0 then
|
||||||
if data[ivm - area.ystride] == node['fun_caves:pyramid_1'] and math.random(100) == 1 then
|
if data[ivm - area.ystride] == node['fun_caves:pyramid_1'] and math.random(100) == 1 then
|
||||||
data[ivm] = node['fun_caves:casket']
|
data[ivm] = node['fun_caves:casket']
|
||||||
caskets[#caskets+1] = {x=x, y=y, z=z}
|
|
||||||
else
|
else
|
||||||
data[ivm] = node['air']
|
data[ivm] = node['air']
|
||||||
end
|
end
|
||||||
|
@ -144,9 +139,5 @@ fun_caves.pyramid = function(minp, maxp, data, p2data, area, biomemap, biome_ids
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if #caskets > 0 then
|
|
||||||
return write, p2write, caskets[math.random(#caskets)]
|
|
||||||
else
|
|
||||||
return write, p2write
|
return write, p2write
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,6 +43,7 @@ fun_caves.village = function(minp, maxp, data, p2data, area, node, biome, height
|
||||||
if not biome or math.random(10) ~= 1 then
|
if not biome or math.random(10) ~= 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local turf
|
||||||
if biome:find('grass') or biome:find('forest') then
|
if biome:find('grass') or biome:find('forest') then
|
||||||
turf = 'default:dirt_with_grass'
|
turf = 'default:dirt_with_grass'
|
||||||
elseif biome:find('taiga') or biome:find('tundra') then
|
elseif biome:find('taiga') or biome:find('tundra') then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue