Version 0.4 Release!
The treacherous Dungeon Master's Lair awaits!
This commit is contained in:
parent
7ebacfd25b
commit
7962a26072
56
abms.lua
Normal file
56
abms.lua
Normal file
@ -0,0 +1,56 @@
|
||||
--grab schematics
|
||||
local fortress = minetest.get_modpath("caverealms").."/schems/DMFort.mts"
|
||||
local fountain = minetest.get_modpath("caverealms").."/schems/DMFountain.mts"
|
||||
|
||||
--place Dungeon Master Statue fountains
|
||||
minetest.register_abm({
|
||||
nodenames = {"caverealms:s_fountain"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.place_schematic(pos, fountain, "random", {}, true)
|
||||
end,
|
||||
})
|
||||
|
||||
--place Dungeon Master Fortresses
|
||||
minetest.register_abm({
|
||||
nodenames = {"caverealms:s_fortress"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
npos = {x=pos.x,y=pos.y-7,z=pos.z}
|
||||
minetest.place_schematic(npos, fortress, "random", {}, true)
|
||||
end,
|
||||
})
|
||||
|
||||
local MAX_ITEMS = 5 --maximum number of items to put in chests - do not set to less than 2
|
||||
--table of itemstrings
|
||||
local ITEMS = {
|
||||
"default:diamond",
|
||||
"default:obsidian 33",
|
||||
"default:mese",
|
||||
"default:pick_diamond",
|
||||
"default:stonebrick 50",
|
||||
"default:sandstone 75",
|
||||
"default:torch 99",
|
||||
"default:water_source 4",
|
||||
}
|
||||
|
||||
--spawn and fill chests
|
||||
minetest.register_abm({
|
||||
nodenames = {"caverealms:s_chest"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
oldparam = minetest.get_node(pos).param2
|
||||
minetest.set_node(pos, {name="default:chest", param2=oldparam})
|
||||
minetest.after(1.0, function()
|
||||
local inv = minetest.get_inventory({type="node", pos=pos})
|
||||
local item_num = math.random(1, MAX_ITEMS)
|
||||
for i = 1, item_num do
|
||||
item_i = math.random(8) --if you add or subtract items from ITEMS, be sure to change this value to reflect it
|
||||
inv:add_item("main", ITEMS[item_i])
|
||||
end
|
||||
end)
|
||||
end,
|
||||
})
|
@ -117,6 +117,8 @@ function caverealms:crystal_stalagmite(x,y,z, area, data, biome)
|
||||
local c_emore = minetest.get_content_id("caverealms:glow_emerald_ore")
|
||||
local c_mesecry = minetest.get_content_id("caverealms:glow_mese")
|
||||
local c_meseore = minetest.get_content_id("default:stone_with_mese")
|
||||
local c_ruby = minetest.get_content_id("caverealms:glow_ruby")
|
||||
local c_rubore = minetest.get_content_id("caverealms:glow_ruby_ore")
|
||||
local c_ice = minetest.get_content_id("default:ice")
|
||||
local c_thinice = minetest.get_content_id("caverealms:thin_ice")
|
||||
|
||||
@ -142,14 +144,16 @@ function caverealms:crystal_stalagmite(x,y,z, area, data, biome)
|
||||
{ {c_crystore, c_crystal}, {c_emore, c_emerald} },
|
||||
{ {c_emore, c_emerald}, {c_crystore, c_crystal} },
|
||||
{ {c_emore, c_emerald}, {c_meseore, c_mesecry} },
|
||||
{ {c_ice, c_thinice}, {c_crystore, c_crystal}}
|
||||
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
|
||||
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
|
||||
{ {c_rubore, c_ruby}, {c_meseore, c_mesecry}},
|
||||
}
|
||||
|
||||
local nid_a
|
||||
local nid_b
|
||||
local nid_s = c_stone --stone base, will be rewritten to ice in certain biomes
|
||||
|
||||
if biome > 3 then
|
||||
if biome > 3 and biome < 6 then
|
||||
if mode == 1 then
|
||||
nid_a = c_ice
|
||||
nid_b = c_thinice
|
||||
@ -209,6 +213,8 @@ function caverealms:crystal_stalactite(x,y,z, area, data, biome)
|
||||
local c_emore = minetest.get_content_id("caverealms:glow_emerald_ore")
|
||||
local c_mesecry = minetest.get_content_id("caverealms:glow_mese")
|
||||
local c_meseore = minetest.get_content_id("default:stone_with_mese")
|
||||
local c_ruby = minetest.get_content_id("caverealms:glow_ruby")
|
||||
local c_rubore = minetest.get_content_id("caverealms:glow_ruby_ore")
|
||||
local c_ice = minetest.get_content_id("default:ice")
|
||||
local c_thinice = minetest.get_content_id("caverealms:hanging_thin_ice")
|
||||
|
||||
@ -234,14 +240,16 @@ function caverealms:crystal_stalactite(x,y,z, area, data, biome)
|
||||
{ {c_crystore, c_crystal}, {c_emore, c_emerald} },
|
||||
{ {c_emore, c_emerald}, {c_crystore, c_crystal} },
|
||||
{ {c_emore, c_emerald}, {c_meseore, c_mesecry} },
|
||||
{ {c_ice, c_thinice}, {c_crystore, c_crystal}}
|
||||
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
|
||||
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
|
||||
{ {c_rubore, c_ruby}, {c_meseore, c_mesecry}},
|
||||
}
|
||||
|
||||
local nid_a
|
||||
local nid_b
|
||||
local nid_s = c_stone --stone base, will be rewritten to ice in certain biomes
|
||||
|
||||
if biome > 3 then
|
||||
if biome > 3 and biome < 6 then
|
||||
if mode == 1 then
|
||||
nid_a = c_ice
|
||||
nid_b = c_thinice
|
||||
|
57
init.lua
57
init.lua
@ -15,6 +15,7 @@ dofile(modpath.."/config.lua") --configuration file; holds various constants
|
||||
dofile(modpath.."/crafting.lua") --crafting recipes
|
||||
dofile(modpath.."/nodes.lua") --node definitions
|
||||
dofile(modpath.."/functions.lua") --function definitions
|
||||
dofile(modpath.."/abms.lua") --abm definitions
|
||||
|
||||
if caverealms.config.falling_icicles == true then
|
||||
dofile(modpath.."/falling_ice.lua") --complicated function for falling icicles
|
||||
@ -37,6 +38,12 @@ local MYCCHA = caverealms.config.myccha --0.03 --chance of mycena mushrooms
|
||||
local WORMCHA = caverealms.config.wormcha --0.03 --chance of glow worms
|
||||
local GIANTCHA = caverealms.config.giantcha --0.001 -- chance of giant mushrooms
|
||||
local ICICHA = caverealms.config.icicha --0.035 -- chance of icicles
|
||||
local FLACHA = 0.04 --chance of constant flames
|
||||
local FOUNCHA = 0.001 --chance of statue + fountain
|
||||
local FORTCHA = 0.0003 --chance of DM Fortresses
|
||||
|
||||
local DM_TOP = -4000 --level at which Dungeon Master Realms start to appear
|
||||
local DM_BOT = -5000 --level at which "" ends
|
||||
|
||||
-- 3D noise for caves
|
||||
|
||||
@ -94,13 +101,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local x0 = minp.x
|
||||
local y0 = minp.y
|
||||
local z0 = minp.z
|
||||
|
||||
|
||||
print ("[caverealms] chunk minp ("..x0.." "..y0.." "..z0..")") --tell people you are generating a chunk
|
||||
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local data = vm:get_data()
|
||||
|
||||
|
||||
--grab content IDs
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_stone = minetest.get_content_id("default:stone")
|
||||
@ -117,26 +124,30 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local c_moss = minetest.get_content_id("caverealms:stone_with_moss")
|
||||
local c_lichen = minetest.get_content_id("caverealms:stone_with_lichen")
|
||||
local c_algae = minetest.get_content_id("caverealms:stone_with_algae")
|
||||
local c_hcobble = minetest.get_content_id("caverealms:hot_cobble")
|
||||
local c_fungus = minetest.get_content_id("caverealms:fungus")
|
||||
local c_mycena = minetest.get_content_id("caverealms:mycena")
|
||||
local c_worm = minetest.get_content_id("caverealms:glow_worm")
|
||||
local c_iciu = minetest.get_content_id("caverealms:icicle_up")
|
||||
local c_icid = minetest.get_content_id("caverealms:icicle_down")
|
||||
|
||||
local c_flame = minetest.get_content_id("caverealms:constant_flame")
|
||||
local c_fountain = minetest.get_content_id("caverealms:s_fountain")
|
||||
local c_fortress = minetest.get_content_id("caverealms:s_fortress")
|
||||
|
||||
--mandatory values
|
||||
local sidelen = x1 - x0 + 1 --length of a mapblock
|
||||
local chulens = {x=sidelen, y=sidelen, z=sidelen} --table of chunk edges
|
||||
local minposxyz = {x=x0, y=y0, z=z0} --bottom corner
|
||||
local minposxz = {x=x0, y=z0} --2D bottom corner
|
||||
|
||||
|
||||
local nvals_cave = minetest.get_perlin_map(np_cave, chulens):get3dMap_flat(minposxyz) --cave noise for structure
|
||||
local nvals_wave = minetest.get_perlin_map(np_wave, chulens):get3dMap_flat(minposxyz) --wavy structure of cavern ceilings and floors
|
||||
local nvals_biome = minetest.get_perlin_map(np_biome, chulens):get2dMap_flat({x=x0+150, y=z0+50}) --2D noise for biomes (will be 3D humidity/temp later)
|
||||
|
||||
|
||||
local nixyz = 1 --3D node index
|
||||
local nixz = 1 --2D node index
|
||||
local nixyz2 = 1 --second 3D index for second loop
|
||||
|
||||
|
||||
for z = z0, z1 do -- for each xy plane progressing northwards
|
||||
--structure loop
|
||||
for y = y0, y1 do -- for each x row progressing upwards
|
||||
@ -159,7 +170,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--decoration loop
|
||||
for y = y0, y1 do -- for each x row progressing upwards
|
||||
local tcave --same as above
|
||||
@ -172,7 +183,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
end
|
||||
local vi = area:index(x0, y, z)
|
||||
for x = x0, x1 do -- for each node do
|
||||
|
||||
|
||||
--determine biome
|
||||
local biome = false --preliminary declaration
|
||||
n_biome = nvals_biome[nixz] --make an easier reference to the noise
|
||||
@ -190,7 +201,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
else
|
||||
biome = 3 --algae
|
||||
end
|
||||
|
||||
|
||||
if y <= DM_TOP and y >= DM_BOT then
|
||||
biome = 6 --DUNGEON MASTER'S LAIR
|
||||
end
|
||||
--if y <= -1000 then
|
||||
--biome = 6 --DUNGEON MASTER'S LAIR
|
||||
--end
|
||||
|
||||
if math.floor(((nvals_cave[nixyz2] + nvals_wave[nixyz2])/2)*100) == math.floor(tcave*100) then
|
||||
--ceiling
|
||||
local ai = area:index(x,y+1,z) --above index
|
||||
@ -261,8 +279,19 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if math.random() < ICICHA then --if glaciated, place icicles
|
||||
data[ai] = c_iciu
|
||||
end
|
||||
elseif biome == 6 then
|
||||
data[vi] = c_hcobble
|
||||
if math.random() < FLACHA then --neverending flames
|
||||
data[ai] = c_flame
|
||||
end
|
||||
if math.random() < FOUNCHA then --DM FOUNTAIN
|
||||
data[ai] = c_fountain
|
||||
end
|
||||
if math.random() < FORTCHA then --DM FORTRESS
|
||||
data[ai] = c_fortress
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if math.random() < STAGCHA then
|
||||
caverealms:stalagmite(x,y,z, area, data)
|
||||
end
|
||||
@ -270,7 +299,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
caverealms:crystal_stalagmite(x,y,z, area, data, biome)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
nixyz2 = nixyz2 + 1
|
||||
nixz = nixz + 1
|
||||
@ -280,7 +309,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
end
|
||||
nixz = nixz + sidelen --shift the 2D index up a layer
|
||||
end
|
||||
|
||||
|
||||
--send data back to voxelmanip
|
||||
vm:set_data(data)
|
||||
--calc lighting
|
||||
@ -292,6 +321,4 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took
|
||||
print ("[caverealms] "..chugent.." ms") --tell people how long
|
||||
end)
|
||||
|
||||
|
||||
print("[caverealms] loaded!")
|
||||
|
115
nodes.lua
115
nodes.lua
@ -48,6 +48,20 @@ minetest.register_node("caverealms:glow_mese", {
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
--glowing ruby
|
||||
minetest.register_node("caverealms:glow_ruby", {
|
||||
description = "Glow Ruby",
|
||||
tiles = {"caverealms_glow_ruby.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = 13,
|
||||
paramtype = "light",
|
||||
use_texture_alpha = true,
|
||||
drawtype = "glasslike",
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
--embedded crystal
|
||||
minetest.register_node("caverealms:glow_ore", {
|
||||
description = "Glow Crystal Ore",
|
||||
@ -70,6 +84,17 @@ minetest.register_node("caverealms:glow_emerald_ore", {
|
||||
paramtype = "light",
|
||||
})
|
||||
|
||||
--embedded rub
|
||||
minetest.register_node("caverealms:glow_ruby_ore", {
|
||||
description = "Glow Ruby Ore",
|
||||
tiles = {"caverealms_glow_ruby_ore.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = 10,
|
||||
paramtype = "light",
|
||||
})
|
||||
|
||||
--thin (transparent) ice
|
||||
minetest.register_node("caverealms:thin_ice", {
|
||||
description = "Thin Ice",
|
||||
@ -235,6 +260,19 @@ minetest.register_node("caverealms:stone_with_algae", {
|
||||
}),
|
||||
})
|
||||
|
||||
--Hot Cobble - cobble with lava instead of mortar XD
|
||||
minetest.register_node("caverealms:hot_cobble", {
|
||||
description = "Hot Cobble",
|
||||
tiles = {"caverealms_hot_cobble.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=2, hot=1},
|
||||
damage_per_second = 1,
|
||||
light_source = 3,
|
||||
sounds = default.node_sound_stone_defaults({
|
||||
footstep = {name="default_stone_footstep", gain=0.25},
|
||||
}),
|
||||
})
|
||||
|
||||
--glow worms
|
||||
minetest.register_node("caverealms:glow_worm", {
|
||||
description = "Glow Worms",
|
||||
@ -323,3 +361,80 @@ minetest.register_node("caverealms:mushroom_gills", {
|
||||
drawtype = "plantlike",
|
||||
paramtype = "light",
|
||||
})
|
||||
|
||||
--define special flame so that it does not expire
|
||||
minetest.register_node("caverealms:constant_flame", {
|
||||
description = "Fire",
|
||||
drawtype = "plantlike",
|
||||
tiles = {{
|
||||
name="fire_basic_flame_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
|
||||
}},
|
||||
inventory_image = "fire_basic_flame.png",
|
||||
light_source = 14,
|
||||
groups = {igniter=2,dig_immediate=3,hot=3},
|
||||
drop = '',
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
damage_per_second = 4,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
fire.on_flame_add_at(pos)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
fire.on_flame_remove_at(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
--node to create a treasure chest in DM Forts.
|
||||
minetest.register_node("caverealms:s_chest", {
|
||||
description = "Trying to rob the bank before it's opened, eh?",
|
||||
tiles = {"default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=3,oddly_breakable_by_hand=2,cavechest=1},
|
||||
})
|
||||
|
||||
--hacky schematic placers
|
||||
|
||||
minetest.register_node("caverealms:s_fountain", {
|
||||
description = "A Hack like you should know what this does...",
|
||||
tiles = {"caverealms_stone_eyes.png"},
|
||||
groups = {crumbly=3, schema=1},
|
||||
})
|
||||
|
||||
minetest.register_node("caverealms:s_fortress", {
|
||||
description = "A Hack like you should know what this does...",
|
||||
tiles = {"caverealms_stone_eyes.png"},
|
||||
groups = {crumbly=3, schema=1},
|
||||
})
|
||||
|
||||
--dungeon master statue (nodebox)
|
||||
minetest.register_node("caverealms:dm_statue", {
|
||||
tiles = {
|
||||
"caverealms_dm_stone.png",
|
||||
"caverealms_dm_stone.png",
|
||||
"caverealms_dm_stone.png",
|
||||
"caverealms_dm_stone.png",
|
||||
"caverealms_dm_stone.png",
|
||||
"caverealms_stone_eyes.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.4375, -0.5, -0.4375, 0.4375, -0.3125, 0.4375}, -- NodeBox1
|
||||
{-0.25, -0.125, -0.1875, 0.25, 0.5, 0.1875}, -- NodeBox2
|
||||
{-0.375, 0, -0.125, -0.25, 0.4375, 0.125}, -- NodeBox3
|
||||
{0.25, 0.125, -0.4375, 0.375, 0.375, 0.1875}, -- NodeBox4
|
||||
{-0.25, -0.5, -0.125, -0.125, -0.125, 0.125}, -- NodeBox5
|
||||
{0.125, -0.3125, -0.125, 0.25, 0, 0.125}, -- NodeBox6
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "regular"
|
||||
}
|
||||
})
|
||||
|
BIN
schems/DMFort.mts
Normal file
BIN
schems/DMFort.mts
Normal file
Binary file not shown.
BIN
schems/DMFountain.mts
Normal file
BIN
schems/DMFountain.mts
Normal file
Binary file not shown.
BIN
textures/caverealms_dm_stone.png
Normal file
BIN
textures/caverealms_dm_stone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 667 B |
BIN
textures/caverealms_glow_ruby.png
Normal file
BIN
textures/caverealms_glow_ruby.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 812 B |
BIN
textures/caverealms_glow_ruby_ore.png
Normal file
BIN
textures/caverealms_glow_ruby_ore.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 684 B |
BIN
textures/caverealms_hot_cobble.png
Normal file
BIN
textures/caverealms_hot_cobble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 784 B |
BIN
textures/caverealms_stone_eyes.png
Normal file
BIN
textures/caverealms_stone_eyes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 739 B |
Loading…
x
Reference in New Issue
Block a user