diff options
Diffstat (limited to 'cavestuff')
-rw-r--r-- | cavestuff/depends.txt | 2 | ||||
-rw-r--r-- | cavestuff/init.lua | 12 | ||||
-rw-r--r-- | cavestuff/mapgen.lua | 52 | ||||
-rw-r--r-- | cavestuff/models/cavestuff_pebble.obj | 279 | ||||
-rw-r--r-- | cavestuff/nodes.lua | 145 | ||||
-rw-r--r-- | cavestuff/textures/undergrowth_desert_pebble.png | bin | 0 -> 303 bytes | |||
-rw-r--r-- | cavestuff/textures/undergrowth_pebble.png | bin | 0 -> 362 bytes |
7 files changed, 490 insertions, 0 deletions
diff --git a/cavestuff/depends.txt b/cavestuff/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/cavestuff/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/cavestuff/init.lua b/cavestuff/init.lua new file mode 100644 index 0000000..f2bed1a --- /dev/null +++ b/cavestuff/init.lua @@ -0,0 +1,12 @@ +----------------------------------------------------------------------------------------------- +local title = "Cave Stuff" +local version = "0.0.3" +local mname = "cavestuff" +----------------------------------------------------------------------------------------------- + +dofile(minetest.get_modpath("cavestuff").."/nodes.lua") +dofile(minetest.get_modpath("cavestuff").."/mapgen.lua") + +----------------------------------------------------------------------------------------------- + +print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") diff --git a/cavestuff/mapgen.lua b/cavestuff/mapgen.lua new file mode 100644 index 0000000..a91a2f0 --- /dev/null +++ b/cavestuff/mapgen.lua @@ -0,0 +1,52 @@ +--Map Generation Stuff + +minetest.register_on_generated(function(minp, maxp, seed) + if maxp.y >= 2 and minp.y <= 0 then + -- Generate pebbles + local perlin1 = minetest.get_perlin(329, 3, 0.6, 100) + -- Assume X and Z lengths are equal + local divlen = 16 + local divs = (maxp.x-minp.x)/divlen+1; + for divx=0,divs-1 do + for divz=0,divs-1 do + local x0 = minp.x + math.floor((divx+0)*divlen) + local z0 = minp.z + math.floor((divz+0)*divlen) + local x1 = minp.x + math.floor((divx+1)*divlen) + local z1 = minp.z + math.floor((divz+1)*divlen) + -- Determine pebble amount from perlin noise + local pebble_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 2 * 2) + -- Find random positions for pebbles based on this random + local pr = PseudoRandom(seed+1) + for i=0,pebble_amount do + local x = pr:next(x0, x1) + local z = pr:next(z0, z1) + -- Find ground level (0...15) + local ground_y = nil + for y=30,0,-1 do + if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then + ground_y = y + break + end + end + + if ground_y then + local p = {x=x,y=ground_y+1,z=z} + local nn = minetest.get_node(p).name + -- Check if the node can be replaced + if minetest.registered_nodes[nn] and + minetest.registered_nodes[nn].buildable_to then + nn = minetest.get_node({x=x,y=ground_y,z=z}).name + -- If desert sand, add dry shrub + if nn == "default:dirt_with_grass" then + minetest.set_node(p,{name="cavestuff:pebble_"..pr:next(1,2), param2=math.random(0,3)}) + elseif nn == "default:desert_sand" then + minetest.set_node(p,{name="cavestuff:desert_pebble_"..pr:next(1,2), param2=math.random(0,3)}) + end + end + end + + end + end + end + end +end) diff --git a/cavestuff/models/cavestuff_pebble.obj b/cavestuff/models/cavestuff_pebble.obj new file mode 100644 index 0000000..243d1ce --- /dev/null +++ b/cavestuff/models/cavestuff_pebble.obj @@ -0,0 +1,279 @@ +# Blender v2.69 (sub 0) OBJ File: '' +# www.blender.org +mtllib cavestuff_pebble.mtl +o Icosphere.001_Icosphere.002 +v -0.000327 -0.410467 0.180121 +v -0.235610 -0.410468 0.155391 +v -0.284796 -0.410468 -0.076018 +v -0.121985 -0.209219 0.205980 +v -0.284738 -0.218753 0.040139 +v -0.201573 -0.219323 -0.168447 +v -0.100950 -0.116906 0.005837 +v -0.088586 -0.496875 -0.111804 +v -0.196648 -0.428134 -0.159917 +v -0.209011 -0.497294 -0.042276 +v -0.041805 -0.497429 0.108278 +v -0.180101 -0.487871 0.093742 +v -0.120956 -0.428134 0.196184 +v -0.288163 -0.428135 0.045629 +v -0.147553 -0.309844 -0.213938 +v -0.268157 -0.309844 -0.144718 +v -0.192465 -0.309844 0.211384 +v -0.054169 -0.309844 0.225920 +v -0.324717 -0.309844 -0.017682 +v -0.288965 -0.319377 0.114387 +v -0.023183 -0.210866 0.195570 +v -0.221888 -0.201086 0.143956 +v -0.275798 -0.233149 -0.072011 +v -0.160094 -0.150509 -0.096605 +v -0.113314 -0.150508 0.123477 +v -0.216653 -0.160042 0.030431 +v 0.073364 -0.397538 -0.267606 +v 0.268711 -0.397538 -0.091716 +v 0.161795 -0.397537 0.148424 +v 0.199614 -0.173928 -0.211396 +v 0.254265 -0.173928 0.045725 +v 0.026620 -0.195887 0.177156 +v -0.061812 -0.173929 -0.238874 +v 0.049992 -0.055394 -0.045225 +v 0.178551 -0.485125 -0.072552 +v 0.063729 -0.498396 -0.175936 +v 0.192289 -0.417167 -0.203264 +v -0.056339 -0.417167 -0.229396 +v -0.070077 -0.496109 -0.098684 +v 0.115708 -0.497252 0.068599 +v 0.244268 -0.417167 0.041273 +v 0.027763 -0.417167 0.166272 +v -0.001987 -0.285733 -0.289762 +v -0.109557 -0.285733 -0.245455 +v 0.258217 -0.285733 -0.165444 +v 0.151676 -0.285733 -0.273611 +v 0.235777 -0.285733 0.122059 +v 0.298622 -0.285733 -0.019093 +v 0.101971 -0.285733 0.199312 +v 0.072221 -0.154299 -0.256722 +v 0.258006 -0.154298 -0.089439 +v 0.156323 -0.154299 0.138946 +v 0.137937 -0.086893 -0.142897 +v -0.015725 -0.073070 -0.159049 +v 0.170060 -0.073069 0.008234 +v 0.036254 -0.095028 0.085487 +v -0.059660 -0.090744 -0.028814 +v -0.016904 -0.495185 -0.020480 +v -0.038530 -0.134593 0.104482 +v 0.018559 -0.297788 0.203363 +vt 0.999784 0.777888 +vt 0.781916 0.751069 +vt 0.930695 0.535842 +vt 0.718554 0.493678 +vt 0.498343 0.500066 +vt 0.612704 0.301958 +vt 0.278288 0.491767 +vt 0.136170 0.301428 +vt 0.385039 0.315647 +vt 0.861174 0.302958 +vt 0.817615 0.924676 +vt 0.662334 0.996212 +vt 0.719667 0.785775 +vt 0.955856 0.540882 +vt 0.919844 0.749017 +vt 0.810792 0.580191 +vt 0.698724 0.249779 +vt 0.882029 0.358101 +vt 0.648319 0.423681 +vt 0.738504 0.311189 +vt 0.859769 0.100574 +vt 0.955856 0.301223 +vt 0.603011 0.109855 +vt 0.889116 0.979094 +vt 0.625593 0.954685 +vt 0.572947 0.723101 +vt 0.629662 0.708272 +vt 0.361849 0.694965 +vt 0.626863 0.523494 +vt 0.877334 0.514944 +vt 0.753445 0.687054 +vt 0.678897 0.522004 +vt 0.804007 0.322784 +vt 0.508145 0.125975 +vt 0.614686 0.322544 +vt 0.274631 0.088482 +vt 0.046907 0.080882 +vt 0.724191 0.150589 +vt 0.955856 0.101994 +vt 0.459738 0.810380 +vt 0.524431 0.596612 +vt 0.614955 0.619521 +vt 0.385224 0.455707 +vt 0.518113 0.743431 +vt 0.397247 0.481913 +vt 0.473092 0.333636 +vt 0.593136 0.806842 +vt 0.542133 0.566645 +vt 0.245991 0.361941 +vt 0.291514 0.126530 +vt 0.515385 0.289890 +vt 0.348981 0.560141 +vt 0.480373 0.537386 +vt 0.705144 0.472239 +vt 0.601667 0.722403 +vt 0.283471 0.700220 +vt 0.061144 0.812481 +vt 0.120014 0.502516 +vt 0.080353 0.535703 +vt 0.356859 0.719702 +vt 0.417004 0.243099 +vt 0.001005 0.468262 +vt 0.186797 0.314823 +vt 0.187216 0.555587 +vt 0.094383 0.931756 +vt 0.003057 0.709324 +vt 0.238065 0.772821 +vt 0.569632 0.999536 +vt 0.323797 1.000000 +vt 0.482075 0.313011 +vt 0.735871 0.182001 +vt 0.032983 0.251846 +vt 0.574313 0.080491 +vt 0.318361 0.961238 +vt 0.229901 0.178033 +vt 0.256609 0.467686 +vt 0.464307 0.768933 +vt 0.865183 0.712997 +vt 0.725052 0.926500 +vt 0.093408 0.705147 +vt 0.230523 0.921209 +vt 0.968797 0.984796 +vt 0.210756 0.792236 +vt 0.477482 0.962103 +vt 0.256493 0.223509 +vt 0.000000 0.255402 +vt 0.543998 0.500902 +vt 0.362414 0.637562 +vt 0.469769 0.648982 +vt 0.379376 0.894841 +vt 0.246514 0.544201 +vt 0.117965 0.884444 +vt 0.047032 0.632888 +vt 0.079441 0.605161 +vt 0.000000 0.325670 +vt 0.241712 0.163133 +vt 0.470206 0.343559 +usemtl None +s off +f 2/1 13/2 17/3 +f 3/4 14/5 19/6 +f 2/7 17/8 20/9 +f 3/4 19/6 16/10 +f 4/11 21/12 25/13 +f 5/14 22/15 26/16 +f 6/17 23/18 24/19 +f 9/20 10/21 3/22 +f 9/20 8/23 10/21 +f 12/24 13/2 2/1 +f 12/24 11/25 13/2 +f 11/25 1/26 13/2 +f 10/27 14/5 3/4 +f 10/27 12/28 14/5 +f 12/28 2/7 14/5 +f 15/29 16/30 6/31 +f 15/29 9/20 16/30 +f 9/20 3/22 16/30 +f 17/3 18/32 4/33 +f 17/3 13/2 18/32 +f 13/2 1/26 18/32 +f 19/6 20/9 5/34 +f 19/6 14/5 20/9 +f 14/5 2/7 20/9 +f 18/32 21/35 4/33 +f 20/9 22/36 5/34 +f 20/9 17/8 22/36 +f 17/8 4/37 22/36 +f 16/10 23/38 6/39 +f 16/10 19/6 23/38 +f 19/6 5/34 23/38 +f 56/40 57/41 7/42 +f 57/41 54/43 24/19 +f 1/26 42/44 49/45 +f 38/46 9/20 15/29 +f 25/13 21/12 59/47 +f 15/29 6/31 44/48 +f 26/16 25/13 7/42 +f 26/16 22/15 25/13 +f 22/15 4/11 25/13 +f 24/19 26/16 7/42 +f 24/19 23/18 26/16 +f 23/18 5/14 26/16 +f 27/49 36/50 38/46 +f 32/51 21/35 49/45 +f 27/49 38/46 43/52 +f 28/53 37/54 45/55 +f 29/56 41/57 47/58 +f 1/26 11/25 42/44 +f 27/49 43/52 46/59 +f 28/53 45/55 48/60 +f 29/56 47/58 49/45 +f 6/17 24/19 33/61 +f 30/62 50/63 53/64 +f 31/65 51/66 55/67 +f 32/68 52/69 56/40 +f 35/70 37/54 28/53 +f 35/70 36/71 37/54 +f 36/50 27/49 37/72 +f 9/20 38/46 8/23 +f 38/46 36/50 39/73 +f 40/74 41/57 29/56 +f 40/75 35/70 41/76 +f 35/70 28/53 41/76 +f 44/48 38/46 15/29 +f 38/46 39/73 8/23 +f 40/74 29/56 42/44 +f 43/52 44/48 33/77 +f 43/52 38/46 44/48 +f 45/55 46/78 30/79 +f 45/55 37/54 46/78 +f 37/72 27/49 46/59 +f 47/80 48/60 31/81 +f 47/80 41/76 48/60 +f 41/76 28/53 48/60 +f 11/25 40/74 42/44 +f 42/44 29/56 49/45 +f 46/78 50/82 30/79 +f 46/59 43/52 50/83 +f 43/52 33/77 50/83 +f 48/60 51/84 31/81 +f 48/60 45/55 51/84 +f 45/55 30/79 51/84 +f 49/45 52/85 32/51 +f 49/45 47/58 52/85 +f 47/58 31/86 52/85 +f 18/32 1/26 60/87 +f 21/35 18/32 60/87 +f 6/31 33/77 44/48 +f 53/64 54/43 34/88 +f 53/64 50/63 54/43 +f 50/63 33/61 54/43 +f 55/67 53/64 34/88 +f 55/67 51/66 53/64 +f 51/66 30/62 53/64 +f 56/40 55/67 34/88 +f 56/40 52/69 55/67 +f 52/69 31/65 55/67 +f 57/41 56/40 34/88 +f 21/12 32/68 56/40 +f 25/13 59/47 7/42 +f 54/43 57/41 34/88 +f 7/42 57/41 24/19 +f 33/61 24/19 54/43 +f 11/89 12/90 58/91 +f 12/90 10/92 58/91 +f 10/92 8/93 58/91 +f 8/93 39/94 58/91 +f 39/94 36/95 58/91 +f 36/95 35/96 58/91 +f 35/96 40/97 58/91 +f 40/97 11/89 58/91 +f 21/12 56/40 59/47 +f 59/47 56/40 7/42 +f 1/26 49/45 60/87 +f 49/45 21/35 60/87 diff --git a/cavestuff/nodes.lua b/cavestuff/nodes.lua new file mode 100644 index 0000000..dc537cf --- /dev/null +++ b/cavestuff/nodes.lua @@ -0,0 +1,145 @@ +--Rocks + +local cbox = { + type = "fixed", + fixed = {-5/16, -8/16, -6/16, 5/16, -1/32, 5/16}, +} + +minetest.register_node("cavestuff:pebble_1",{ + description = "Pebble", + drawtype = "mesh", + mesh = "cavestuff_pebble.obj", + tiles = {"undergrowth_pebble.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=3, stone=1}, + selection_box = cbox, + collision_box = cbox, + on_place = function(itemstack, placer, pointed_thing) + -- place a random pebble node + local stack = ItemStack("cavestuff:pebble_"..math.random(1,2)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("cavestuff:pebble_1 "..itemstack:get_count()-(1-ret:get_count())) + end, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("cavestuff:pebble_2",{ + drawtype = "mesh", + mesh = "cavestuff_pebble.obj", + tiles = {"undergrowth_pebble.png"}, + drop = "cavestuff:pebble_1", + tiles = {"undergrowth_pebble.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=3, stone=1, not_in_creative_inventory=1}, + selection_box = cbox, + collision_box = cbox, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("cavestuff:desert_pebble_1",{ + description = "Desert Pebble", + drawtype = "mesh", + mesh = "cavestuff_pebble.obj", + tiles = {"default_desert_stone.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=3, stone=1}, + selection_box = cbox, + collision_box = cbox, + on_place = function(itemstack, placer, pointed_thing) + -- place a random pebble node + local stack = ItemStack("cavestuff:desert_pebble_"..math.random(1,2)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("cavestuff:desert_pebble_1 "..itemstack:get_count()-(1-ret:get_count())) + end, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("cavestuff:desert_pebble_2",{ + drawtype = "mesh", + mesh = "cavestuff_pebble.obj", + drop = "cavestuff:desert_pebble_1", + tiles = {"default_desert_stone.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=3, stone=1, not_in_creative__inventory=1}, + selection_box = cbox, + collision_box = cbox, + sounds = default.node_sound_stone_defaults(), +}) + +--Staclactites + +minetest.register_node("cavestuff:stalactite_1",{ + drawtype="nodebox", + tiles = {"undergrowth_pebble.png"}, + groups = {cracky=3,attached_node=1}, + description = "Stalactite", + paramtype = "light", + paramtype2 = "wallmounted", + node_box = { + type = "fixed", + fixed = { + {-0.187500,0.425000,-0.150003,0.162500,0.500000,0.162500}, + {-0.112500,0.162500,-0.100000,0.087500,0.475000,0.087500}, + {-0.062500,-0.275000,-0.062500,0.062500,0.500000,0.062500}, + {-0.037500,-0.837500,0.037500,0.037500,0.500000,-0.025000}, + } + }, + + on_place = function(itemstack, placer, pointed_thing) + local pt = pointed_thing + if minetest.get_node(pt.under).name=="default:stone" + and minetest.get_node({x=pt.under.x, y=pt.under.y-1, z=pt.under.z}).name=="air" + and minetest.get_node({x=pt.under.x, y=pt.under.y-2, z=pt.under.z}).name=="air" then + minetest.set_node({x=pt.under.x, y=pt.under.y-1, z=pt.under.z}, {name="cavestuff:stalactite_"..math.random(1,3)}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + end + return itemstack + end, +}) + +minetest.register_node("cavestuff:stalactite_2",{ + drawtype="nodebox", + tiles = {"undergrowth_pebble.png"}, + groups = {cracky=3,attached_node=1,not_in_creative_inventory=1}, + drop = "cavestuff:stalactite_1", + paramtype = "light", + paramtype2 = "wallmounted", + node_box = { + type = "fixed", + fixed = { + {-0.187500,0.387500,-0.150003,0.162500,0.500000,0.162500}, + {-0.112500,0.112500,-0.100000,0.087500,0.475000,0.087500}, + {-0.062500,-0.675000,-0.062500,0.062500,0.500000,0.062500}, + {-0.037500,-0.975000,0.037500,0.037500,0.500000,-0.025000}, + } + }, +}) + +minetest.register_node("cavestuff:stalactite_3",{ + drawtype="nodebox", + tiles = {"undergrowth_pebble.png"}, + groups = {cracky=3,attached_node=1,not_in_creative_inventory=1}, + drop = "cavestuff:stalactite_1", + paramtype = "light", + paramtype2 = "wallmounted", + node_box = { + type = "fixed", + fixed = { + {-0.187500,0.387500,-0.150003,0.162500,0.500000,0.162500}, + {-0.112500,0.037500,-0.100000,0.087500,0.475000,0.087500}, + {-0.062500,-0.437500,-0.062500,0.062500,0.500000,0.062500}, + {-0.037500,-1.237500,0.037500,0.037500,0.500000,-0.025000}, + } + }, +}) + +--Stalagmites + + + diff --git a/cavestuff/textures/undergrowth_desert_pebble.png b/cavestuff/textures/undergrowth_desert_pebble.png Binary files differnew file mode 100644 index 0000000..966e937 --- /dev/null +++ b/cavestuff/textures/undergrowth_desert_pebble.png diff --git a/cavestuff/textures/undergrowth_pebble.png b/cavestuff/textures/undergrowth_pebble.png Binary files differnew file mode 100644 index 0000000..306ca6a --- /dev/null +++ b/cavestuff/textures/undergrowth_pebble.png |