Fix regressions. Add 3 teleporters.

This commit is contained in:
Duane 2016-06-11 03:50:17 -05:00
parent 9fedc6c52a
commit f3393d36fc
13 changed files with 191 additions and 45 deletions

View file

@ -69,7 +69,7 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone)
write = true write = true
elseif underzone and (y < underzone.ceiling + 10 - (underzone.vary and cave_3[index] or 0) and y > underzone.floor - 10 + (underzone.vary and cave_3[index] or 0)) then elseif underzone and (y < underzone.ceiling + 10 - (underzone.vary and cave_3[index] or 0) and y > underzone.floor - 10 + (underzone.vary and cave_3[index] or 0)) then
-- nop -- nop
elseif y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > cave_width then elseif ((y <= maxp.y and y >= minp.y) or (data[ivm] == node['default:stone'])) and y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > cave_width then
if y <= fun_caves.underzones['Styx'].sealevel then if y <= fun_caves.underzones['Styx'].sealevel then
data[ivm] = node["default:water_source"] data[ivm] = node["default:water_source"]
else else

View file

@ -1,13 +1,10 @@
local rand = math.random local rand = math.random
local floor = math.floor local floor = math.floor
local ceil = math.ceil
local max = math.max
local map_max = 31000
local treasures = {
'fun_caves:stone_with_aquamarines',
'fun_caves:stone_with_sky_iron',
'default:obsidian',
}
fun_caves.fortress = function(minp, maxp, data, area, node) fun_caves.fortress = function(minp, maxp, data, area, node)
-- invisible maze -- invisible maze
-- hungry maze -- hungry maze
@ -16,7 +13,7 @@ fun_caves.fortress = function(minp, maxp, data, area, node)
-- hidden doors/downs -- hidden doors/downs
-- hot/ice floors -- hot/ice floors
-- --
--local level = ceil(maxp.y / 3100) local level = max(6, ceil(maxp.y / floor(map_max / 6)))
local n = 16 local n = 16
local walls = {} local walls = {}
local inner_floor = node['fun_caves:dungeon_floor_1'] local inner_floor = node['fun_caves:dungeon_floor_1']
@ -49,7 +46,7 @@ fun_caves.fortress = function(minp, maxp, data, area, node)
--data[ivm] = fun_caves.DEBUG and node["default:glass"] or inner_wall --data[ivm] = fun_caves.DEBUG and node["default:glass"] or inner_wall
if y2 == 0 and rand(3000) == 1 then if y2 == 0 and rand(3000) == 1 then
treasure_count = treasure_count + 1 treasure_count = treasure_count + 1
data[ivm] = node[treasures[rand(#treasures)]] data[ivm] = node['fun_caves:coffer']
else else
data[ivm] = inner_wall data[ivm] = inner_wall
end end

View file

@ -43,6 +43,7 @@ local fruit = minetest.get_content_id("fun_caves:fungal_tree_fruit")
function fun_caves.make_fungal_tree(data, area, ivm, height) function fun_caves.make_fungal_tree(data, area, ivm, height)
local leaf = minetest.get_content_id(fungal_tree_leaves[rand(#fungal_tree_leaves)]) local leaf = minetest.get_content_id(fungal_tree_leaves[rand(#fungal_tree_leaves)])
local air = minetest.get_content_id('air')
for y = 0, height do for y = 0, height do
local radius = 1 local radius = 1
if y > 1 and y < height - 2 then if y > 1 and y < height - 2 then
@ -52,6 +53,7 @@ function fun_caves.make_fungal_tree(data, area, ivm, height)
for x = -radius,radius do for x = -radius,radius do
local sr = rand(1,100) local sr = rand(1,100)
local i = ivm + z*area.zstride + y*area.ystride + x local i = ivm + z*area.zstride + y*area.ystride + x
if data[i] == air then
if x == 0 and y == 0 and z == 0 then if x == 0 and y == 0 and z == 0 then
data[i] = leaf data[i] = leaf
elseif sr == 1 then elseif sr == 1 then
@ -63,6 +65,7 @@ function fun_caves.make_fungal_tree(data, area, ivm, height)
end end
end end
end end
end
-- multicolored growths -- multicolored growths
local count = 0 local count = 0

View file

@ -64,7 +64,7 @@ fun_caves.is_fortress = function(pos, cs, debug)
local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z}) local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z})
if fun_caves.DEBUG and floor((n * 10000) % 4) == 1 then if fun_caves.DEBUG and floor((n * 10000) % 4) == 1 then
print('fortress ('..x..','..y..','..zn..')') --print('fortress ('..x..','..y..','..z..')')
return true return true
end end
if floor((n * 10000) % 19) == 1 then if floor((n * 10000) % 19) == 1 then

201
nodes.lua
View file

@ -1,5 +1,6 @@
local get_node_or_nil = minetest.get_node_or_nil local get_node_or_nil = minetest.get_node_or_nil
local get_item_group = minetest.get_item_group local get_item_group = minetest.get_item_group
local map_max = 31000
local old_is_protected = minetest.is_protected local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name) function minetest.is_protected(pos, name)
@ -200,6 +201,108 @@ minetest.register_craft({
cooktime = 5, cooktime = 5,
}) })
minetest.register_craftitem("fun_caves:teleporter_iron_garnet", {
description = "Iron and Garnet Teleporter",
drawtype = "plantlike",
paramtype = "light",
tiles = {"fun_caves_tesseract_iron_garnet.png"},
inventory_image = "fun_caves_tesseract_iron_garnet.png",
groups = {dig_immediate = 3},
sounds = default.node_sound_stone_defaults(),
on_use = function(itemstack, user, pointed_thing)
teleporter(user, 'underworld', 0)
end,
})
minetest.register_craft({
output = 'fun_caves:teleporter_iron_garnet',
recipe = {
{'fun_caves:sky_iron', 'default:copper_ingot', 'fun_caves:sky_iron'},
{'fun_caves:perfect_garnet', 'fun_caves:perfect_garnet', 'fun_caves:perfect_garnet'},
{'fun_caves:sky_iron', 'default:obsidian_shard', 'fun_caves:sky_iron'},
}
})
minetest.register_craftitem("fun_caves:perfect_garnet", {
description = "Perfect Garnet",
drawtype = "plantlike",
paramtype = "light",
tiles = {"fun_caves_garnet.png"},
inventory_image = "fun_caves_garnet.png",
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("fun_caves:stone_with_garnets", {
description = "Garnet Ore",
tiles = {"default_stone.png^fun_caves_mineral_garnet.png"},
groups = {cracky = 1},
drop = "fun_caves:perfect_garnet",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "scatter",
ore = "fun_caves:stone_with_garnets",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 1,
clust_size = 1,
y_min = -31000,
y_max = 31000,
})
minetest.register_craftitem("fun_caves:teleporter_iron_zoisite", {
description = "Iron and Zoisite Teleporter",
drawtype = "plantlike",
paramtype = "light",
tiles = {"fun_caves_tesseract_iron_zois.png"},
inventory_image = "fun_caves_tesseract_iron_zois.png",
groups = {dig_immediate = 3},
sounds = default.node_sound_stone_defaults(),
on_use = function(itemstack, user, pointed_thing)
teleporter(user, 'underworld', 0)
end,
})
minetest.register_craft({
output = 'fun_caves:teleporter_iron_zoisite',
recipe = {
{'fun_caves:sky_iron', 'default:copper_ingot', 'fun_caves:sky_iron'},
{'fun_caves:perfect_zoisite', 'fun_caves:perfect_zoisite', 'fun_caves:perfect_zoisite'},
{'fun_caves:sky_iron', 'default:obsidian_shard', 'fun_caves:sky_iron'},
}
})
minetest.register_craftitem("fun_caves:perfect_zoisite", {
description = "Perfect Zoisite",
drawtype = "plantlike",
paramtype = "light",
tiles = {"fun_caves_zoisite.png"},
inventory_image = "fun_caves_zoisite.png",
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("fun_caves:stone_with_zoisites", {
description = "Zoisite Ore",
tiles = {"default_stone.png^fun_caves_mineral_zoisite.png"},
groups = {cracky = 1},
drop = "fun_caves:perfect_zoisite",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "scatter",
ore = "fun_caves:stone_with_zoisites",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 1,
clust_size = 1,
y_min = -31000,
y_max = 31000,
})
minetest.register_craftitem("fun_caves:teleporter_iron_aquamarine", { minetest.register_craftitem("fun_caves:teleporter_iron_aquamarine", {
description = "Iron and Aquamarine Teleporter", description = "Iron and Aquamarine Teleporter",
drawtype = "plantlike", drawtype = "plantlike",
@ -222,6 +325,35 @@ minetest.register_craft({
} }
}) })
minetest.register_craftitem("fun_caves:perfect_aquamarine", {
description = "Perfect Aquamarine",
drawtype = "plantlike",
paramtype = "light",
tiles = {"fun_caves_aquamarine.png"},
inventory_image = "fun_caves_aquamarine.png",
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("fun_caves:stone_with_aquamarines", {
description = "Aquamarine Ore",
tiles = {"default_stone.png^fun_caves_mineral_aquamarine.png"},
groups = {cracky = 1},
drop = "fun_caves:perfect_aquamarine",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "scatter",
ore = "fun_caves:stone_with_aquamarines",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 1,
clust_size = 1,
y_min = -31000,
y_max = 31000,
})
minetest.register_craftitem("fun_caves:meteorite", { minetest.register_craftitem("fun_caves:meteorite", {
description = "Iron Meteorite", description = "Iron Meteorite",
drawtype = "plantlike", drawtype = "plantlike",
@ -293,38 +425,49 @@ minetest.register_craft({
} }
}) })
minetest.register_node("fun_caves:stone_with_aquamarines", {
description = "Aquamarine Ore",
tiles = {"default_stone.png^default_mineral_diamond.png"},
groups = {cracky = 1},
drop = "fun_caves:perfect_aquamarine",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "scatter",
ore = "fun_caves:stone_with_aquamarines",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 1,
clust_size = 1,
y_min = -6000,
y_max = 31000,
})
minetest.register_craftitem("fun_caves:perfect_aquamarine", {
description = "Perfect Aquamarine",
drawtype = "plantlike",
paramtype = "light",
tiles = {"default_diamond.png"},
inventory_image = "default_diamond.png",
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
})
local newnode = fun_caves.clone_node("default:dirt") local newnode = fun_caves.clone_node("default:dirt")
newnode.description = "Meteor Crater" newnode.description = "Meteor Crater"
newnode.tiles = {"fun_caves_crater.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"} newnode.tiles = {"fun_caves_crater.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"}
newnode.drop = "fun_caves:meteorite" newnode.drop = "fun_caves:meteorite"
newnode.groups.soil = 0 newnode.groups.soil = 0
minetest.register_node("fun_caves:meteorite_crater", newnode) minetest.register_node("fun_caves:meteorite_crater", newnode)
local treasures = {
{'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'fun_caves:sky_iron', 'fun_caves:sky_iron', 'fun_caves:sky_iron', 'fun_caves:sky_iron', 'default:obsidian'},
{'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'fun_caves:pure_copper', 'fun_caves:pure_copper', 'fun_caves:pure_copper', 'fun_caves:pure_copper', 'default:obsidian'},
{'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'},
{'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'},
{'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'},
{'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'},
}
local filler = {'default:apple 10', 'default:coal_lump 10', 'default:wood 10'}
local chest_formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
local newnode = fun_caves.clone_node("default:chest")
newnode.description = "Treasure Chest"
newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local ready = meta:get_string('formspec')
if ready == '' then
local level = math.max(6, math.ceil(pos.y / math.floor(map_max / 6)))
local big_item = treasures[level][math.random(#treasures[level])]
meta:set_string("formspec", chest_formspec)
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
inv:add_item('main', big_item)
for i = 1, math.random(4) do
inv:add_item('main', filler[math.random(#filler)])
end
end
end
minetest.register_node("fun_caves:coffer", newnode)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -2,3 +2,6 @@ Original spider textures: AspireMint
Original goblins textures and models: Francisco "FreeLikeGNU" Athens Original goblins textures and models: Francisco "FreeLikeGNU" Athens
Original tesseract: Claudio Rocchini (cc-by-sa 2.5), https://en.wikipedia.org/wiki/File:Runci_trunc_tessaract.png Original tesseract: Claudio Rocchini (cc-by-sa 2.5), https://en.wikipedia.org/wiki/File:Runci_trunc_tessaract.png
Original meteorite: MeteoriteKid (cc-by-sa 3), https://en.wikipedia.org/wiki/File:Oriented_Taza_Meteorite.jpg Original meteorite: MeteoriteKid (cc-by-sa 3), https://en.wikipedia.org/wiki/File:Oriented_Taza_Meteorite.jpg
Original tanzanite: Chromalys (cc-by-sa 4), https://en.wikipedia.org/wiki/File:Trichroic_Tanzanite_Gem_-_blue,_violet_%26_purple.jpg
Original aquamarine: Diamondexpert (cc-by-sa 2.5), https://commons.wikimedia.org/wiki/File:Gems_aquamarine.jpg
Original garnet: von de Wela49 (cc-by-sa 3), https://en.wikipedia.org/wiki/File:Garnet_cut.JPG