From 4bb9652c0f6c1736ca325ed94aaff10be9a11b47 Mon Sep 17 00:00:00 2001 From: paramat Date: Wed, 16 Sep 2015 02:38:58 +0100 Subject: [PATCH] Flowers: Add waterlily and add to mapgen --- mods/flowers/README.txt | 5 +- mods/flowers/init.lua | 36 +++++++++++++ mods/flowers/mapgen.lua | 54 ++++++++++++++++++-- mods/flowers/schematics/waterlily.mts | Bin 0 -> 92 bytes mods/flowers/textures/flowers_waterlily.png | Bin 0 -> 3363 bytes 5 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 mods/flowers/schematics/waterlily.mts create mode 100644 mods/flowers/textures/flowers_waterlily.png diff --git a/mods/flowers/README.txt b/mods/flowers/README.txt index f83abcd..6cfa0ee 100644 --- a/mods/flowers/README.txt +++ b/mods/flowers/README.txt @@ -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 diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index af5da21..32d40cb 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -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 +}) diff --git a/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua index 5c386e5..73b4ed7 100644 --- a/mods/flowers/mapgen.lua +++ b/mods/flowers/mapgen.lua @@ -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 index 0000000000000000000000000000000000000000..876310cce9110775b10b9cef15ae36e7a5b2d800 GIT binary patch literal 92 zcmeYb3HD`RVPIrnW?-zZuLn{*DXD3Rr8y;5DVaqj3?eXId16UwQG9WJX;E@2gJ4=t letBw9u@zV}Co`wAVoq{GLPAQyulV@$2M#bWa7|%i1OWYj9~=Mx literal 0 HcmV?d00001 diff --git a/mods/flowers/textures/flowers_waterlily.png b/mods/flowers/textures/flowers_waterlily.png new file mode 100644 index 0000000000000000000000000000000000000000..a92d3b9faa3ad04fc7df64275821dd7a465d47ef GIT binary patch literal 3363 zcmV+;4czjHP)uJ@VVD_U zC<6{NG_fI~0ue<-1QkJoA_k0xBC#Thg@9ne9*`iQ#9$OrQF$}6R&?d%y_c8YA7_1Q zpS|}zXYYO1x&V;8{kgn!SPFnNo`4_X z6{c}T{8k*B#$jdxfFg<9uYy1K45IaYvHg`_dOZM)Sy63ve6hvv1)yUy0P^?0*fb9UASvow z`@mQCp^4`uNg&9uGcn1|&Nk+9SjOUl{-OWr@Hh0;_l(8q{wNRKos+;6rV8ldy0Owz z(}jF`W(JeRp&R{qi2rfmU!TJ;gp(Kmm5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