Skip to content

Commit 4bb9652

Browse files
committedSep 17, 2015
Flowers: Add waterlily and add to mapgen
1 parent b6c1201 commit 4bb9652

File tree

5 files changed

+89
-6
lines changed

5 files changed

+89
-6
lines changed
 

‎mods/flowers/README.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ License of media (textures and sounds)
1616
WTFPL
1717

1818
Gambit (WTFPL):
19-
flowers_mushroom_*.png
19+
flowers_mushroom_*.png
20+
flowers_waterlily.png
2021

2122
DanDuncombe (WTFPL):
22-
flowers_spores_*.png
23+
flowers_spores_*.png

‎mods/flowers/init.lua

+36
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,39 @@ minetest.register_abm({
236236
end
237237
end
238238
})
239+
240+
241+
--
242+
-- Waterlily
243+
--
244+
245+
minetest.register_node("flowers:waterlily", {
246+
description = "Waterlily",
247+
drawtype = "nodebox",
248+
paramtype = "light",
249+
paramtype2 = "facedir",
250+
tiles = {"flowers_waterlily.png"},
251+
inventory_image = "flowers_waterlily.png",
252+
wield_image = "flowers_waterlily.png",
253+
liquids_pointable = true,
254+
groups = {snappy = 3},
255+
sounds = default.node_sound_leaves_defaults(),
256+
node_box = {
257+
type = "fixed",
258+
fixed = {-0.5, -0.5, -0.5, 0.5, -0.46875, 0.5}
259+
},
260+
selection_box = {
261+
type = "fixed",
262+
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
263+
},
264+
265+
after_place_node = function(pos, placer, itemstack, pointed_thing)
266+
local find_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1},
267+
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:water_source")
268+
if #find_water ~= 0 then
269+
minetest.set_node(pos, {name = "default:water_source"})
270+
pos.y = pos.y + 1
271+
end
272+
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
273+
end
274+
})

‎mods/flowers/mapgen.lua

+50-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local function register_mgv6_flower(name)
1010
noise_params = {
1111
offset = 0,
1212
scale = 0.006,
13-
spread = {x=100, y=100, z=100},
13+
spread = {x = 100, y = 100, z = 100},
1414
seed = 436,
1515
octaves = 3,
1616
persist = 0.6
@@ -29,7 +29,7 @@ local function register_mgv6_mushroom(name)
2929
noise_params = {
3030
offset = 0,
3131
scale = 0.04,
32-
spread = {x=100, y=100, z=100},
32+
spread = {x = 100, y = 100, z = 100},
3333
seed = 7133,
3434
octaves = 3,
3535
persist = 0.6
@@ -42,6 +42,26 @@ local function register_mgv6_mushroom(name)
4242
})
4343
end
4444

45+
local function register_mgv6_waterlily()
46+
minetest.register_decoration({
47+
deco_type = "schematic",
48+
place_on = {"default:dirt"},
49+
sidelen = 16,
50+
noise_params = {
51+
offset = -0.12,
52+
scale = 0.3,
53+
spread = {x = 100, y = 100, z = 100},
54+
seed = 33,
55+
octaves = 3,
56+
persist = 0.7
57+
},
58+
y_min = 0,
59+
y_max = 0,
60+
schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
61+
rotation = "random",
62+
})
63+
end
64+
4565
function flowers.register_mgv6_decorations()
4666
register_mgv6_flower("rose")
4767
register_mgv6_flower("tulip")
@@ -52,6 +72,8 @@ function flowers.register_mgv6_decorations()
5272

5373
register_mgv6_mushroom("mushroom_fertile_brown")
5474
register_mgv6_mushroom("mushroom_fertile_red")
75+
76+
register_mgv6_waterlily()
5577
end
5678

5779

@@ -67,7 +89,7 @@ local function register_flower(seed, name)
6789
noise_params = {
6890
offset = -0.02,
6991
scale = 0.03,
70-
spread = {x=200, y=200, z=200},
92+
spread = {x = 200, y = 200, z = 200},
7193
seed = seed,
7294
octaves = 3,
7395
persist = 0.6
@@ -92,7 +114,7 @@ local function register_mushroom(name)
92114
noise_params = {
93115
offset = 0,
94116
scale = 0.006,
95-
spread = {x=200, y=200, z=200},
117+
spread = {x = 200, y = 200, z = 200},
96118
seed = 2,
97119
octaves = 3,
98120
persist = 0.66
@@ -104,6 +126,28 @@ local function register_mushroom(name)
104126
})
105127
end
106128

129+
local function register_waterlily()
130+
minetest.register_decoration({
131+
deco_type = "schematic",
132+
place_on = {"default:dirt", "default:sand"},
133+
sidelen = 16,
134+
noise_params = {
135+
offset = -0.12,
136+
scale = 0.3,
137+
spread = {x = 200, y = 200, z = 200},
138+
seed = 33,
139+
octaves = 3,
140+
persist = 0.7
141+
},
142+
biomes = {"deciduous_forest_ocean", "sandstone_grassland_ocean",
143+
"rainforest_swamp", "savanna_ocean", "desert_ocean"},
144+
y_min = 0,
145+
y_max = 0,
146+
schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
147+
rotation = "random",
148+
})
149+
end
150+
107151
function flowers.register_decorations()
108152
register_flower(436, "rose")
109153
register_flower(19822, "tulip")
@@ -114,6 +158,8 @@ function flowers.register_decorations()
114158

115159
register_mushroom("mushroom_fertile_brown")
116160
register_mushroom("mushroom_fertile_red")
161+
162+
register_waterlily()
117163
end
118164

119165

‎mods/flowers/schematics/waterlily.mts

92 Bytes
Binary file not shown.
3.28 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.