From fdb946ebc0f6c519e86f9d587fd0d1abb2ea8789 Mon Sep 17 00:00:00 2001 From: Mat Date: Sat, 5 Jul 2014 08:20:34 +0100 Subject: [PATCH] Stable sand, drops default. Optional luxore, crafts to lights --- README.txt | 2 +- init.lua | 95 ++++++++++++++++++++++++++++++- textures/intersecting_light.png | Bin 0 -> 134 bytes textures/intersecting_luxore.png | Bin 0 -> 311 bytes 4 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 textures/intersecting_light.png create mode 100644 textures/intersecting_luxore.png diff --git a/README.txt b/README.txt index 9effe8c..5e9788b 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -intersecting 0.2.1 by paramat +intersecting 0.2.2 by paramat For latest stable Minetest back to 0.4.8 Depends default Licenses: code WTFPL diff --git a/init.lua b/init.lua index 825fcd1..146f34b 100644 --- a/init.lua +++ b/init.lua @@ -1,11 +1,20 @@ --- intersecting 0.2.1 by paramat +-- intersecting 0.2.2 by paramat -- For latest stable Minetest and back to 0.4.8 -- Depends default -- License: code WTFPL +-- stable sand, drops default +-- luxore in stone, above stone, craftable to lights + +-- TODO +-- integrate caves as cava = math.abs(n_weba) > CAVT +-- include lava, to replace v6 cavegen + -- Parameters -local TFIS = 0.02 -- fissure and tunnel width +local TFIS = 0.02 -- Fissure and tunnel width +local LUX = true -- Enable luxore +local LUXCHA = 1 / 8 ^ 3 -- Luxore chance per stone node. -- 3D noise for fissure a @@ -55,6 +64,73 @@ local np_biome = { intersecting = {} +-- Nodes + +minetest.register_node("intersecting:sand", { + description = "Stable sand", + tiles = {"default_sand.png"}, + is_ground_content = false, + groups = {crumbly=2, sand=1}, + drop = "default:sand", + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("intersecting:luxoff", { + description = "Dark Lux Ore", + tiles = {"intersecting_luxore.png"}, + light_source = 14, + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("intersecting:luxore", { + description = "Lux Ore", + tiles = {"intersecting_luxore.png"}, + light_source = 14, + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("intersecting:light", { + description = "Light", + tiles = {"intersecting_light.png"}, + light_source = 14, + groups = {cracky=3,oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Crafting. + +minetest.register_craft({ + output = "intersecting:light 8", + recipe = { + {"default:glass", "default:glass", "default:glass"}, + {"default:glass", "intersecting:luxore", "default:glass"}, + {"default:glass", "default:glass", "default:glass"}, + }, +}) + +minetest.register_craft({ + output = "intersecting:light 8", + recipe = { + {"default:obsidian_glass", "default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "intersecting:luxore", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass", "default:obsidian_glass"}, + }, +}) + +-- ABM spread luxore light + +minetest.register_abm({ + nodenames = {"intersecting:luxoff"}, + interval = 7, + chance = 1, + action = function(pos, node) + minetest.remove_node(pos) + minetest.place_node(pos, {name="intersecting:luxore"}) + end, +}) + -- On generated function minetest.register_on_generated(function(minp, maxp, seed) @@ -78,12 +154,16 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_air = minetest.get_content_id("air") local c_water = minetest.get_content_id("default:water_source") - local c_sand = minetest.get_content_id("default:sand") local c_dirt = minetest.get_content_id("default:dirt") local c_grass = minetest.get_content_id("default:dirt_with_grass") local c_tree = minetest.get_content_id("default:tree") local c_jtree = minetest.get_content_id("default:jungletree") + local c_stone = minetest.get_content_id("default:stone") + local c_desertstone = minetest.get_content_id("default:desert_stone") + local c_sand = minetest.get_content_id("intersecting:sand") + local c_luxore = minetest.get_content_id("intersecting:luxoff") + local sidelen = x1 - x0 + 1 local chulens = {x=sidelen, y=sidelen, z=sidelen} local minposxyz = {x=x0, y=y0, z=z0} @@ -94,6 +174,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local nvals_biome = minetest.get_perlin_map(np_biome, chulens):get3dMap_flat(minposxyz) local cavbel = {} + local stobel = {} local nixyz = 1 for z = z0, z1 do -- for each xy plane progressing northwards for y = y0, y1 do -- for each x row progressing upwards @@ -141,6 +222,7 @@ minetest.register_on_generated(function(minp, maxp, seed) if void then data[vi] = c_air cavbel[ti] = 1 + stobel[ti] = 0 if nodid == c_tree or nodid == c_jtree then for j = -12, 12 do local vit = area:index(x, y+j, z) @@ -151,6 +233,12 @@ minetest.register_on_generated(function(minp, maxp, seed) end else cavbel[ti] = 0 + if LUX and nodid == c_stone or nodid == c_desertstone then + if math.random() < LUXCHA and stobel[ti] == 1 and y > y0 then + data[vi] = c_luxore + end + stobel[ti] = 1 + end end else if (nodid == c_water or watadj) and cavbel[ti] == 1 then @@ -162,6 +250,7 @@ minetest.register_on_generated(function(minp, maxp, seed) end end cavbel[ti] = 0 + stobel[ti] = 0 end nixyz = nixyz + 1 vi = vi + 1 diff --git a/textures/intersecting_light.png b/textures/intersecting_light.png new file mode 100644 index 0000000000000000000000000000000000000000..523f6bf84bb570b90dbc06de73cf7e31f41826bd GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfJyt0eBV#w-qVqr@2~QWt5RLQ6fBv^LsvJ0Sz+hEk$l-#k a3=BVxFfsFl=N|&9VeoYIb6Mw<&;$T76CvOL literal 0 HcmV?d00001 diff --git a/textures/intersecting_luxore.png b/textures/intersecting_luxore.png new file mode 100644 index 0000000000000000000000000000000000000000..9fc4830fa8a206ff854c82fcf0378a36b571f013 GIT binary patch literal 311 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfT~0YZF2&?sMj%s8db&7}+^pJ-xAX63eLl`7XMJM#B;J(Q)!*~7-u*hF$TGUb8uxfy1^uZ!0UNo!;ssx=dKu372Oa%ypp!7WRU zzI3(|S2G-aZnCR)W(mLddjIS8-47pS?%L$Ou)iq(n`Oo+(I4gOfSzLTboFyt=akR{ E087Dmt^fc4 literal 0 HcmV?d00001