Flowers: Add waterlily and add to mapgen
authorparamat <mat.gregory@virginmedia.com>
Wed, 16 Sep 2015 01:38:58 +0000 (02:38 +0100)
committerparamat <mat.gregory@virginmedia.com>
Thu, 17 Sep 2015 11:34:17 +0000 (12:34 +0100)
mods/flowers/README.txt
mods/flowers/init.lua
mods/flowers/mapgen.lua
mods/flowers/schematics/waterlily.mts [new file with mode: 0644]
mods/flowers/textures/flowers_waterlily.png [new file with mode: 0644]

index f83abcdad3bd234809f11410bef34eed0b18dd70..6cfa0eea8a7a10ab4cbffbbe29f3f7005a138b7c 100644 (file)
@@ -16,7 +16,8 @@ License of media (textures and sounds)
 WTFPL
 
 Gambit (WTFPL):
-  flowers_mushroom_*.png
+    flowers_mushroom_*.png
+    flowers_waterlily.png
 
 DanDuncombe (WTFPL):
-  flowers_spores_*.png
+    flowers_spores_*.png
index af5da2178596af474421049473aa3ee32c4a7a1b..32d40cb889c6f0f62f2cc6ff82ccd64ecc5cd6f9 100644 (file)
@@ -236,3 +236,39 @@ minetest.register_abm({
                end
        end
 })
+
+
+--
+-- Waterlily
+--
+
+minetest.register_node("flowers:waterlily", {
+       description = "Waterlily",
+       drawtype = "nodebox",
+       paramtype = "light",
+       paramtype2 = "facedir",
+       tiles = {"flowers_waterlily.png"},
+       inventory_image = "flowers_waterlily.png",
+       wield_image = "flowers_waterlily.png",
+       liquids_pointable = true,
+       groups = {snappy = 3},
+       sounds = default.node_sound_leaves_defaults(),
+       node_box = {
+               type = "fixed",
+               fixed = {-0.5, -0.5, -0.5, 0.5, -0.46875, 0.5}
+       },
+       selection_box = {
+               type = "fixed",
+               fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
+       },
+
+       after_place_node = function(pos, placer, itemstack, pointed_thing)
+               local find_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1},
+                       {x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:water_source")
+               if #find_water ~= 0 then
+                       minetest.set_node(pos, {name = "default:water_source"})
+                       pos.y = pos.y + 1
+               end
+               minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
+       end
+})
index 5c386e58ad51b391bfbcf426961948e31c705036..73b4ed7c3ab671d4ea864ba5b59e785aee951738 100644 (file)
@@ -10,7 +10,7 @@ local function register_mgv6_flower(name)
                noise_params = {
                        offset = 0,
                        scale = 0.006,
-                       spread = {x=100, y=100, z=100},
+                       spread = {x = 100, y = 100, z = 100},
                        seed = 436,
                        octaves = 3,
                        persist = 0.6
@@ -29,7 +29,7 @@ local function register_mgv6_mushroom(name)
                noise_params = {
                        offset = 0,
                        scale = 0.04,
-                       spread = {x=100, y=100, z=100},
+                       spread = {x = 100, y = 100, z = 100},
                        seed = 7133,
                        octaves = 3,
                        persist = 0.6
@@ -42,6 +42,26 @@ local function register_mgv6_mushroom(name)
        })
 end
 
+local function register_mgv6_waterlily()
+       minetest.register_decoration({
+               deco_type = "schematic",
+               place_on = {"default:dirt"},
+               sidelen = 16,
+               noise_params = {
+                       offset = -0.12,
+                       scale = 0.3,
+                       spread = {x = 100, y = 100, z = 100},
+                       seed = 33,
+                       octaves = 3,
+                       persist = 0.7
+               },
+               y_min = 0,
+               y_max = 0,
+               schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
+               rotation = "random",
+       })
+end
+
 function flowers.register_mgv6_decorations()
        register_mgv6_flower("rose")
        register_mgv6_flower("tulip")
@@ -52,6 +72,8 @@ function flowers.register_mgv6_decorations()
 
        register_mgv6_mushroom("mushroom_fertile_brown")
        register_mgv6_mushroom("mushroom_fertile_red")
+
+       register_mgv6_waterlily()
 end
 
 
@@ -67,7 +89,7 @@ local function register_flower(seed, name)
                noise_params = {
                        offset = -0.02,
                        scale = 0.03,
-                       spread = {x=200, y=200, z=200},
+                       spread = {x = 200, y = 200, z = 200},
                        seed = seed,
                        octaves = 3,
                        persist = 0.6
@@ -92,7 +114,7 @@ local function register_mushroom(name)
                noise_params = {
                        offset = 0,
                        scale = 0.006,
-                       spread = {x=200, y=200, z=200},
+                       spread = {x = 200, y = 200, z = 200},
                        seed = 2,
                        octaves = 3,
                        persist = 0.66
@@ -104,6 +126,28 @@ local function register_mushroom(name)
        })
 end
 
+local function register_waterlily()
+       minetest.register_decoration({
+               deco_type = "schematic",
+               place_on = {"default:dirt", "default:sand"},
+               sidelen = 16,
+               noise_params = {
+                       offset = -0.12,
+                       scale = 0.3,
+                       spread = {x = 200, y = 200, z = 200},
+                       seed = 33,
+                       octaves = 3,
+                       persist = 0.7
+               },
+               biomes = {"deciduous_forest_ocean", "sandstone_grassland_ocean",
+                       "rainforest_swamp", "savanna_ocean", "desert_ocean"},
+               y_min = 0,
+               y_max = 0,
+               schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
+               rotation = "random",
+       })
+end
+
 function flowers.register_decorations()
        register_flower(436,     "rose")
        register_flower(19822,   "tulip")
@@ -114,6 +158,8 @@ function flowers.register_decorations()
 
        register_mushroom("mushroom_fertile_brown")
        register_mushroom("mushroom_fertile_red")
+
+       register_waterlily()
 end
 
 
diff --git a/mods/flowers/schematics/waterlily.mts b/mods/flowers/schematics/waterlily.mts
new file mode 100644 (file)
index 0000000..876310c
Binary files /dev/null and b/mods/flowers/schematics/waterlily.mts differ
diff --git a/mods/flowers/textures/flowers_waterlily.png b/mods/flowers/textures/flowers_waterlily.png
new file mode 100644 (file)
index 0000000..a92d3b9
Binary files /dev/null and b/mods/flowers/textures/flowers_waterlily.png differ