From 7962a26072272ddfcba970a7db99f1ed6a7d9499 Mon Sep 17 00:00:00 2001 From: Chris N Date: Tue, 5 Aug 2014 16:11:42 -1000 Subject: [PATCH] Version 0.4 Release! The treacherous Dungeon Master's Lair awaits! --- abms.lua | 56 +++++++++++++ functions.lua | 16 +++- init.lua | 57 +++++++++---- nodes.lua | 115 ++++++++++++++++++++++++++ schems/DMFort.mts | Bin 0 -> 920 bytes schems/DMFountain.mts | Bin 0 -> 184 bytes textures/caverealms_dm_stone.png | Bin 0 -> 667 bytes textures/caverealms_glow_ruby.png | Bin 0 -> 812 bytes textures/caverealms_glow_ruby_ore.png | Bin 0 -> 684 bytes textures/caverealms_hot_cobble.png | Bin 0 -> 784 bytes textures/caverealms_stone_eyes.png | Bin 0 -> 739 bytes 11 files changed, 225 insertions(+), 19 deletions(-) create mode 100644 abms.lua create mode 100644 schems/DMFort.mts create mode 100644 schems/DMFountain.mts create mode 100644 textures/caverealms_dm_stone.png create mode 100644 textures/caverealms_glow_ruby.png create mode 100644 textures/caverealms_glow_ruby_ore.png create mode 100644 textures/caverealms_hot_cobble.png create mode 100644 textures/caverealms_stone_eyes.png diff --git a/abms.lua b/abms.lua new file mode 100644 index 0000000..4f49efc --- /dev/null +++ b/abms.lua @@ -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, +}) \ No newline at end of file diff --git a/functions.lua b/functions.lua index 6c62a93..7cb0af7 100644 --- a/functions.lua +++ b/functions.lua @@ -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 diff --git a/init.lua b/init.lua index c13671b..4773441 100644 --- a/init.lua +++ b/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!") diff --git a/nodes.lua b/nodes.lua index 7588234..952f9a4 100644 --- a/nodes.lua +++ b/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" + } +}) diff --git a/schems/DMFort.mts b/schems/DMFort.mts new file mode 100644 index 0000000000000000000000000000000000000000..14cc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Pv0l-7)*$e6VAM4BS52#RVWb0H=q zh3?qwwQ*HqFZ$!baWq5?DTpyKHPrr0RaZom7=ehPl}Tk%dtuGc2+k&)r(?|!0YM=Y z6~)RBb3`CAa92T8*+5mXvhaTJC}GH?X0rE0)hH1}p~gZK$iTCNu@_@5>^K?YMol>! z)K5w#&5boDl@PL_1T}#wT$^G2z}DuzCu=QiIgj(8iSX>fH4=3L6z>nLHBcqi#MfLD z!dOY6;0IryUmVR)6-=QwL*3Y`&lkOBYz002ovPDHLkV1mgN BC-wjU literal 0 HcmV?d00001 diff --git a/textures/caverealms_glow_ruby.png b/textures/caverealms_glow_ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..2ef07e67a53e37ed893012f78e3ef1f4f222c8fa GIT binary patch literal 812 zcmV+{1JnG8P)WFU8GbZ8()Nlj2>E@cM*00NLnL_t(I%Ux4JPZL2D z{${7U8>_pWg;pAxZ9`kMLE-@}#l)CY4kjMtpeAyVAL$tqV?5GCj0wR)p_`4=*3Qrk zba#e!y|B&dTqc<}-+SNp-uK9-N7a4YokqQmpmzaZs^keJLk9q4bIiTp+{#CtpO(H{ z%KSLkZx{89Al;9=`BI@|=tyn=u*ww#y^DFWOLfbpaqO%X3M`Y)J157-ZMr?V z-mxiVHl-l|*p$NA*mQN>7^lI$REU9)5&~06LT589H@B*!^X7FtKJ6S>uFC??6DbA^ zfJi4um>EQ4dZFONQN*;{;gH+4dMofe@in+c$#d!v(S9Te5vMOt6Tv9n64{M zeV-H46y)r~yAc3T<~V=8d_G8YPiFDTFQs4-!V@O{_sAd`(`2tVRQBB zbN~RO+uN>5NcTLFqEV}|lA*)d*mToOWIPkv&6V)fV8Cy#gwV2C{`BQ`D?P$jPu384 zo|w$y72ZDdEZ1d85nn23R=ENh&xAoVo-kQ_{$ida?TdR4td+p?M59(^i4@Xae>^u* z(p`ONi6uQr`y*{E0L+(4XwJr_Yn3bTr9wA~gc=OE>i5M|@HrD-Dy%n~Zj$IMk}JMc z0s!dVRPLCz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