34b873e521da52ee623019dfb1383a0c4e0417c9
[oweals/minetest_game.git] / mods / default / nodes.lua
1 -- mods/default/nodes.lua
2
3 minetest.register_node("default:stone", {
4         description = "Stone",
5         tiles = {"default_stone.png"},
6         is_ground_content = true,
7         groups = {cracky=3, stone=1},
8         drop = 'default:cobble',
9         legacy_mineral = true,
10         sounds = default.node_sound_stone_defaults(),
11 })
12
13 minetest.register_node("default:desert_stone", {
14         description = "Desert Stone",
15         tiles = {"default_desert_stone.png"},
16         is_ground_content = true,
17         groups = {cracky=3, stone=1},
18         drop = 'default:desert_stone',
19         legacy_mineral = true,
20         sounds = default.node_sound_stone_defaults(),
21 })
22
23 minetest.register_node("default:stone_with_coal", {
24         description = "Coal Ore",
25         tiles = {"default_stone.png^default_mineral_coal.png"},
26         is_ground_content = true,
27         groups = {cracky=3},
28         drop = 'default:coal_lump',
29         sounds = default.node_sound_stone_defaults(),
30 })
31
32 minetest.register_node("default:stone_with_iron", {
33         description = "Iron Ore",
34         tiles = {"default_stone.png^default_mineral_iron.png"},
35         is_ground_content = true,
36         groups = {cracky=2},
37         drop = 'default:iron_lump',
38         sounds = default.node_sound_stone_defaults(),
39 })
40
41 minetest.register_node("default:stone_with_copper", {
42         description = "Copper Ore",
43         tiles = {"default_stone.png^default_mineral_copper.png"},
44         is_ground_content = true,
45         groups = {cracky=2},
46         drop = 'default:copper_lump',
47         sounds = default.node_sound_stone_defaults(),
48 })
49
50 minetest.register_node("default:stone_with_mese", {
51         description = "Mese Ore",
52         tiles = {"default_stone.png^default_mineral_mese.png"},
53         is_ground_content = true,
54         groups = {cracky=1},
55         drop = "default:mese_crystal",
56         sounds = default.node_sound_stone_defaults(),
57 })
58
59 minetest.register_node("default:stone_with_gold", {
60         description = "Gold Ore",
61         tiles = {"default_stone.png^default_mineral_gold.png"},
62         is_ground_content = true,
63         groups = {cracky=2},
64         drop = "default:gold_lump",
65         sounds = default.node_sound_stone_defaults(),
66 })
67         
68 minetest.register_node("default:stone_with_diamond", {
69         description = "Diamond Ore",
70         tiles = {"default_stone.png^default_mineral_diamond.png"},
71         is_ground_content = true,
72         groups = {cracky=1},
73         drop = "default:diamond",
74         sounds = default.node_sound_stone_defaults(),
75 })
76
77 minetest.register_node("default:stonebrick", {
78         description = "Stone Brick",
79         tiles = {"default_stone_brick.png"},
80         groups = {cracky=2, stone=1},
81         sounds = default.node_sound_stone_defaults(),
82 })
83
84 minetest.register_node("default:desert_stonebrick", {
85         description = "Desert Stone Brick",
86         tiles = {"default_desert_stone_brick.png"},
87         groups = {cracky=2, stone=1},
88         sounds = default.node_sound_stone_defaults(),
89 })
90
91 minetest.register_node("default:dirt_with_grass", {
92         description = "Dirt with Grass",
93         tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
94         is_ground_content = true,
95         groups = {crumbly=3,soil=1},
96         drop = 'default:dirt',
97         sounds = default.node_sound_dirt_defaults({
98                 footstep = {name="default_grass_footstep", gain=0.25},
99         }),
100 })
101
102 minetest.register_node("default:dirt_with_grass_footsteps", {
103         description = "Dirt with Grass and Footsteps",
104         tiles = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
105         is_ground_content = true,
106         groups = {crumbly=3,soil=1,not_in_creative_inventory=1},
107         drop = 'default:dirt',
108         sounds = default.node_sound_dirt_defaults({
109                 footstep = {name="default_grass_footstep", gain=0.25},
110         }),
111 })
112
113 minetest.register_node("default:dirt_with_snow", {
114         description = "Dirt with Snow",
115         tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
116         is_ground_content = true,
117         groups = {crumbly=3},
118         drop = 'default:dirt',
119         sounds = default.node_sound_dirt_defaults({
120                 footstep = {name="default_snow_footstep", gain=0.25},
121         }),
122 })
123
124 minetest.register_node("default:dirt", {
125         description = "Dirt",
126         tiles = {"default_dirt.png"},
127         is_ground_content = true,
128         groups = {crumbly=3,soil=1},
129         sounds = default.node_sound_dirt_defaults(),
130 })
131
132 minetest.register_abm({
133         nodenames = {"default:dirt"},
134         interval = 2,
135         chance = 200,
136         action = function(pos, node)
137                 local above = {x=pos.x, y=pos.y+1, z=pos.z}
138                 local name = minetest.get_node(above).name
139                 local nodedef = minetest.registered_nodes[name]
140                 if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
141                                 and nodedef.liquidtype == "none"
142                                 and (minetest.get_node_light(above) or 0) >= 13 then
143                         if name == "default:snow" or name == "default:snowblock" then
144                                 minetest.set_node(pos, {name = "default:dirt_with_snow"})
145                         else
146                                 minetest.set_node(pos, {name = "default:dirt_with_grass"})
147                         end
148                 end
149         end
150 })
151
152 minetest.register_abm({
153         nodenames = {"default:dirt_with_grass"},
154         interval = 2,
155         chance = 20,
156         action = function(pos, node)
157                 local above = {x=pos.x, y=pos.y+1, z=pos.z}
158                 local name = minetest.get_node(above).name
159                 local nodedef = minetest.registered_nodes[name]
160                 if name ~= "ignore" and nodedef
161                                 and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
162                                 and nodedef.liquidtype == "none") then
163                         minetest.set_node(pos, {name = "default:dirt"})
164                 end
165         end
166 })
167
168 minetest.register_node("default:sand", {
169         description = "Sand",
170         tiles = {"default_sand.png"},
171         is_ground_content = true,
172         groups = {crumbly=3, falling_node=1, sand=1},
173         sounds = default.node_sound_sand_defaults(),
174 })
175
176 minetest.register_node("default:desert_sand", {
177         description = "Desert Sand",
178         tiles = {"default_desert_sand.png"},
179         is_ground_content = true,
180         groups = {crumbly=3, falling_node=1, sand=1},
181         sounds = default.node_sound_sand_defaults(),
182 })
183
184 minetest.register_node("default:gravel", {
185         description = "Gravel",
186         tiles = {"default_gravel.png"},
187         is_ground_content = true,
188         groups = {crumbly=2, falling_node=1},
189         sounds = default.node_sound_dirt_defaults({
190                 footstep = {name="default_gravel_footstep", gain=0.5},
191                 dug = {name="default_gravel_footstep", gain=1.0},
192         }),
193 })
194
195 minetest.register_node("default:sandstone", {
196         description = "Sandstone",
197         tiles = {"default_sandstone.png"},
198         is_ground_content = true,
199         groups = {crumbly=2,cracky=3},
200         sounds = default.node_sound_stone_defaults(),
201 })
202
203 minetest.register_node("default:sandstonebrick", {
204         description = "Sandstone Brick",
205         tiles = {"default_sandstone_brick.png"},
206         is_ground_content = true,
207         groups = {cracky=2},
208         sounds = default.node_sound_stone_defaults(),
209 })
210
211 minetest.register_node("default:clay", {
212         description = "Clay",
213         tiles = {"default_clay.png"},
214         is_ground_content = true,
215         groups = {crumbly=3},
216         drop = 'default:clay_lump 4',
217         sounds = default.node_sound_dirt_defaults(),
218 })
219
220 minetest.register_node("default:brick", {
221         description = "Brick Block",
222         tiles = {"default_brick.png"},
223         is_ground_content = false,
224         groups = {cracky=3},
225         sounds = default.node_sound_stone_defaults(),
226 })
227
228 minetest.register_node("default:tree", {
229         description = "Tree",
230         tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
231         paramtype2 = "facedir",
232         is_ground_content = false,
233         groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
234         sounds = default.node_sound_wood_defaults(),
235         on_place = minetest.rotate_node
236 })
237
238 minetest.register_node("default:jungletree", {
239         description = "Jungle Tree",
240         tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
241         paramtype2 = "facedir",
242         is_ground_content = false,
243         groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
244         sounds = default.node_sound_wood_defaults(),
245         on_place = minetest.rotate_node
246 })
247
248 minetest.register_node("default:junglewood", {
249         description = "Junglewood Planks",
250         tiles = {"default_junglewood.png"},
251         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
252         sounds = default.node_sound_wood_defaults(),
253 })
254
255 minetest.register_node("default:jungleleaves", {
256         description = "Jungle Leaves",
257         drawtype = "allfaces_optional",
258         visual_scale = 1.3,
259         tiles = {"default_jungleleaves.png"},
260         paramtype = "light",
261         waving = 1,
262         is_ground_content = false,
263         groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
264         drop = {
265                 max_items = 1,
266                 items = {
267                         {
268                                 -- player will get sapling with 1/20 chance
269                                 items = {'default:junglesapling'},
270                                 rarity = 20,
271                         },
272                         {
273                                 -- player will get leaves only if he get no saplings,
274                                 -- this is because max_items is 1
275                                 items = {'default:jungleleaves'},
276                         }
277                 }
278         },
279         sounds = default.node_sound_leaves_defaults(),
280 })
281
282 minetest.register_node("default:junglesapling", {
283         description = "Jungle Sapling",
284         drawtype = "plantlike",
285         visual_scale = 1.0,
286         tiles = {"default_junglesapling.png"},
287         inventory_image = "default_junglesapling.png",
288         wield_image = "default_junglesapling.png",
289         paramtype = "light",
290         walkable = false,
291         selection_box = {
292                 type = "fixed",
293                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
294         },
295         groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
296         sounds = default.node_sound_leaves_defaults(),
297 })
298
299 minetest.register_node("default:junglegrass", {
300         description = "Jungle Grass",
301         drawtype = "plantlike",
302         visual_scale = 1.3,
303         tiles = {"default_junglegrass.png"},
304         inventory_image = "default_junglegrass.png",
305         wield_image = "default_junglegrass.png",
306         paramtype = "light",
307         walkable = false,
308         buildable_to = true,
309         is_ground_content = true,
310         groups = {snappy=3,flammable=2,flora=1,attached_node=1},
311         sounds = default.node_sound_leaves_defaults(),
312         selection_box = {
313                 type = "fixed",
314                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
315         },
316 })
317
318 minetest.register_node("default:leaves", {
319         description = "Leaves",
320         drawtype = "allfaces_optional",
321         visual_scale = 1.3,
322         tiles = {"default_leaves.png"},
323         paramtype = "light",
324         waving = 1,
325         is_ground_content = false,
326         groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
327         drop = {
328                 max_items = 1,
329                 items = {
330                         {
331                                 -- player will get sapling with 1/20 chance
332                                 items = {'default:sapling'},
333                                 rarity = 20,
334                         },
335                         {
336                                 -- player will get leaves only if he get no saplings,
337                                 -- this is because max_items is 1
338                                 items = {'default:leaves'},
339                         }
340                 }
341         },
342         sounds = default.node_sound_leaves_defaults(),
343 })
344
345 minetest.register_node("default:cactus", {
346         description = "Cactus",
347         tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
348         paramtype2 = "facedir",
349         is_ground_content = true,
350         groups = {snappy=1,choppy=3,flammable=2},
351         sounds = default.node_sound_wood_defaults(),
352         on_place = minetest.rotate_node
353 })
354
355 minetest.register_node("default:papyrus", {
356         description = "Papyrus",
357         drawtype = "plantlike",
358         tiles = {"default_papyrus.png"},
359         inventory_image = "default_papyrus.png",
360         wield_image = "default_papyrus.png",
361         paramtype = "light",
362         walkable = false,
363         is_ground_content = true,
364         selection_box = {
365                 type = "fixed",
366                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
367         },
368         groups = {snappy=3,flammable=2},
369         sounds = default.node_sound_leaves_defaults(),
370 })
371
372 minetest.register_node("default:bookshelf", {
373         description = "Bookshelf",
374         tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
375         is_ground_content = false,
376         groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
377         sounds = default.node_sound_wood_defaults(),
378 })
379
380 minetest.register_node("default:glass", {
381         description = "Glass",
382         drawtype = "glasslike",
383         tiles = {"default_glass.png"},
384         inventory_image = minetest.inventorycube("default_glass.png"),
385         paramtype = "light",
386         sunlight_propagates = true,
387         is_ground_content = false,
388         groups = {cracky=3,oddly_breakable_by_hand=3},
389         sounds = default.node_sound_glass_defaults(),
390 })
391
392 minetest.register_node("default:fence_wood", {
393         description = "Wooden Fence",
394         drawtype = "fencelike",
395         tiles = {"default_wood.png"},
396         inventory_image = "default_fence.png",
397         wield_image = "default_fence.png",
398         paramtype = "light",
399         is_ground_content = false,
400         selection_box = {
401                 type = "fixed",
402                 fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
403         },
404         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2},
405         sounds = default.node_sound_wood_defaults(),
406 })
407
408 minetest.register_node("default:rail", {
409         description = "Rail",
410         drawtype = "raillike",
411         tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
412         inventory_image = "default_rail.png",
413         wield_image = "default_rail.png",
414         paramtype = "light",
415         walkable = false,
416         is_ground_content = false,
417         selection_box = {
418                 type = "fixed",
419                 -- but how to specify the dimensions for curved and sideways rails?
420                 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
421         },
422         groups = {bendy=2,dig_immediate=2,attached_node=1},
423 })
424
425 minetest.register_node("default:ladder", {
426         description = "Ladder",
427         drawtype = "signlike",
428         tiles = {"default_ladder.png"},
429         inventory_image = "default_ladder.png",
430         wield_image = "default_ladder.png",
431         paramtype = "light",
432         paramtype2 = "wallmounted",
433         walkable = false,
434         climbable = true,
435         is_ground_content = false,
436         selection_box = {
437                 type = "wallmounted",
438                 --wall_top = = <default>
439                 --wall_bottom = = <default>
440                 --wall_side = = <default>
441         },
442         groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
443         legacy_wallmounted = true,
444         sounds = default.node_sound_wood_defaults(),
445 })
446
447 minetest.register_node("default:wood", {
448         description = "Wooden Planks",
449         tiles = {"default_wood.png"},
450         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
451         sounds = default.node_sound_wood_defaults(),
452 })
453
454 minetest.register_node("default:cloud", {
455         description = "Cloud",
456         tiles = {"default_cloud.png"},
457         sounds = default.node_sound_defaults(),
458         groups = {not_in_creative_inventory=1},
459 })
460
461 minetest.register_node("default:water_flowing", {
462         description = "Flowing Water",
463         inventory_image = minetest.inventorycube("default_water.png"),
464         drawtype = "flowingliquid",
465         tiles = {"default_water.png"},
466         special_tiles = {
467                 {
468                         image="default_water_flowing_animated.png",
469                         backface_culling=false,
470                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
471                 },
472                 {
473                         image="default_water_flowing_animated.png",
474                         backface_culling=true,
475                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
476                 },
477         },
478         alpha = WATER_ALPHA,
479         paramtype = "light",
480         paramtype2 = "flowingliquid",
481         walkable = false,
482         pointable = false,
483         diggable = false,
484         buildable_to = true,
485         drop = "",
486         drowning = 1,
487         liquidtype = "flowing",
488         liquid_alternative_flowing = "default:water_flowing",
489         liquid_alternative_source = "default:water_source",
490         liquid_viscosity = WATER_VISC,
491         freezemelt = "default:snow",
492         post_effect_color = {a=64, r=100, g=100, b=200},
493         groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1},
494 })
495
496 minetest.register_node("default:water_source", {
497         description = "Water Source",
498         inventory_image = minetest.inventorycube("default_water.png"),
499         drawtype = "liquid",
500         tiles = {
501                 {name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
502         },
503         special_tiles = {
504                 -- New-style water source material (mostly unused)
505                 {
506                         name="default_water_source_animated.png",
507                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
508                         backface_culling = false,
509                 }
510         },
511         alpha = WATER_ALPHA,
512         paramtype = "light",
513         walkable = false,
514         pointable = false,
515         diggable = false,
516         buildable_to = true,
517         drop = "",
518         drowning = 1,
519         liquidtype = "source",
520         liquid_alternative_flowing = "default:water_flowing",
521         liquid_alternative_source = "default:water_source",
522         liquid_viscosity = WATER_VISC,
523         freezemelt = "default:ice",
524         post_effect_color = {a=64, r=100, g=100, b=200},
525         groups = {water=3, liquid=3, puts_out_fire=1, freezes=1},
526 })
527
528 minetest.register_node("default:lava_flowing", {
529         description = "Flowing Lava",
530         inventory_image = minetest.inventorycube("default_lava.png"),
531         drawtype = "flowingliquid",
532         tiles = {"default_lava.png"},
533         special_tiles = {
534                 {
535                         image="default_lava_flowing_animated.png",
536                         backface_culling=false,
537                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
538                 },
539                 {
540                         image="default_lava_flowing_animated.png",
541                         backface_culling=true,
542                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
543                 },
544         },
545         paramtype = "light",
546         paramtype2 = "flowingliquid",
547         light_source = LIGHT_MAX - 1,
548         walkable = false,
549         pointable = false,
550         diggable = false,
551         buildable_to = true,
552         drop = "",
553         drowning = 1,
554         liquidtype = "flowing",
555         liquid_alternative_flowing = "default:lava_flowing",
556         liquid_alternative_source = "default:lava_source",
557         liquid_viscosity = LAVA_VISC,
558         liquid_renewable = false,
559         damage_per_second = 4*2,
560         post_effect_color = {a=192, r=255, g=64, b=0},
561         groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
562 })
563
564 minetest.register_node("default:lava_source", {
565         description = "Lava Source",
566         inventory_image = minetest.inventorycube("default_lava.png"),
567         drawtype = "liquid",
568         tiles = {
569                 {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
570         },
571         special_tiles = {
572                 -- New-style lava source material (mostly unused)
573                 {
574                         name="default_lava_source_animated.png",
575                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0},
576                         backface_culling = false,
577                 }
578         },
579         paramtype = "light",
580         light_source = LIGHT_MAX - 1,
581         walkable = false,
582         pointable = false,
583         diggable = false,
584         buildable_to = true,
585         drop = "",
586         drowning = 1,
587         liquidtype = "source",
588         liquid_alternative_flowing = "default:lava_flowing",
589         liquid_alternative_source = "default:lava_source",
590         liquid_viscosity = LAVA_VISC,
591         liquid_renewable = false,
592         damage_per_second = 4*2,
593         post_effect_color = {a=192, r=255, g=64, b=0},
594         groups = {lava=3, liquid=2, hot=3, igniter=1},
595 })
596
597 minetest.register_node("default:torch", {
598         description = "Torch",
599         drawtype = "torchlike",
600         --tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
601         tiles = {
602                 {name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
603                 {name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
604                 {name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
605         },
606         inventory_image = "default_torch_on_floor.png",
607         wield_image = "default_torch_on_floor.png",
608         paramtype = "light",
609         paramtype2 = "wallmounted",
610         sunlight_propagates = true,
611         is_ground_content = false,
612         walkable = false,
613         light_source = LIGHT_MAX-1,
614         selection_box = {
615                 type = "wallmounted",
616                 wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
617                 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
618                 wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
619         },
620         groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,hot=2},
621         legacy_wallmounted = true,
622         sounds = default.node_sound_defaults(),
623 })
624
625 minetest.register_node("default:sign_wall", {
626         description = "Sign",
627         drawtype = "signlike",
628         tiles = {"default_sign_wall.png"},
629         inventory_image = "default_sign_wall.png",
630         wield_image = "default_sign_wall.png",
631         paramtype = "light",
632         paramtype2 = "wallmounted",
633         sunlight_propagates = true,
634         is_ground_content = false,
635         walkable = false,
636         selection_box = {
637                 type = "wallmounted",
638                 --wall_top = <default>
639                 --wall_bottom = <default>
640                 --wall_side = <default>
641         },
642         groups = {choppy=2,dig_immediate=2,attached_node=1},
643         legacy_wallmounted = true,
644         sounds = default.node_sound_defaults(),
645         on_construct = function(pos)
646                 --local n = minetest.get_node(pos)
647                 local meta = minetest.get_meta(pos)
648                 meta:set_string("formspec", "field[text;;${text}]")
649                 meta:set_string("infotext", "\"\"")
650         end,
651         on_receive_fields = function(pos, formname, fields, sender)
652                 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
653                 if minetest.is_protected(pos, sender:get_player_name()) then
654                         minetest.record_protection_violation(pos, sender:get_player_name())
655                         return
656                 end
657                 local meta = minetest.get_meta(pos)
658                 fields.text = fields.text or ""
659                 minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
660                                 "\" to sign at "..minetest.pos_to_string(pos))
661                 meta:set_string("text", fields.text)
662                 meta:set_string("infotext", '"'..fields.text..'"')
663         end,
664 })
665
666 default.chest_formspec = 
667         "size[8,9]"..
668         "list[current_name;main;0,0;8,4;]"..
669         "list[current_player;main;0,5;8,4;]"
670
671 function default.get_locked_chest_formspec(pos)
672         local spos = pos.x .. "," .. pos.y .. "," ..pos.z
673         local formspec =
674                 "size[8,9]"..
675                 "list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
676                 "list[current_player;main;0,5;8,4;]"
677         return formspec
678 end
679
680
681 minetest.register_node("default:chest", {
682         description = "Chest",
683         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
684                 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
685         paramtype2 = "facedir",
686         groups = {choppy=2,oddly_breakable_by_hand=2},
687         legacy_facedir_simple = true,
688         is_ground_content = false,
689         sounds = default.node_sound_wood_defaults(),
690         on_construct = function(pos)
691                 local meta = minetest.get_meta(pos)
692                 meta:set_string("formspec",default.chest_formspec)
693                 meta:set_string("infotext", "Chest")
694                 local inv = meta:get_inventory()
695                 inv:set_size("main", 8*4)
696         end,
697         can_dig = function(pos,player)
698                 local meta = minetest.get_meta(pos);
699                 local inv = meta:get_inventory()
700                 return inv:is_empty("main")
701         end,
702         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
703                 minetest.log("action", player:get_player_name()..
704                                 " moves stuff in chest at "..minetest.pos_to_string(pos))
705         end,
706     on_metadata_inventory_put = function(pos, listname, index, stack, player)
707                 minetest.log("action", player:get_player_name()..
708                                 " moves stuff to chest at "..minetest.pos_to_string(pos))
709         end,
710     on_metadata_inventory_take = function(pos, listname, index, stack, player)
711                 minetest.log("action", player:get_player_name()..
712                                 " takes stuff from chest at "..minetest.pos_to_string(pos))
713         end,
714 })
715
716 local function has_locked_chest_privilege(meta, player)
717         if player:get_player_name() ~= meta:get_string("owner") then
718                 return false
719         end
720         return true
721 end
722
723 minetest.register_node("default:chest_locked", {
724         description = "Locked Chest",
725         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
726                 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
727         paramtype2 = "facedir",
728         groups = {choppy=2,oddly_breakable_by_hand=2},
729         legacy_facedir_simple = true,
730         is_ground_content = false,
731         sounds = default.node_sound_wood_defaults(),
732         after_place_node = function(pos, placer)
733                 local meta = minetest.get_meta(pos)
734                 meta:set_string("owner", placer:get_player_name() or "")
735                 meta:set_string("infotext", "Locked Chest (owned by "..
736                                 meta:get_string("owner")..")")
737         end,
738         on_construct = function(pos)
739                 local meta = minetest.get_meta(pos)
740                 meta:set_string("infotext", "Locked Chest")
741                 meta:set_string("owner", "")
742                 local inv = meta:get_inventory()
743                 inv:set_size("main", 8*4)
744         end,
745         can_dig = function(pos,player)
746                 local meta = minetest.get_meta(pos);
747                 local inv = meta:get_inventory()
748                 return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
749         end,
750         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
751                 local meta = minetest.get_meta(pos)
752                 if not has_locked_chest_privilege(meta, player) then
753                         minetest.log("action", player:get_player_name()..
754                                         " tried to access a locked chest belonging to "..
755                                         meta:get_string("owner").." at "..
756                                         minetest.pos_to_string(pos))
757                         return 0
758                 end
759                 return count
760         end,
761     allow_metadata_inventory_put = function(pos, listname, index, stack, player)
762                 local meta = minetest.get_meta(pos)
763                 if not has_locked_chest_privilege(meta, player) then
764                         minetest.log("action", player:get_player_name()..
765                                         " tried to access a locked chest belonging to "..
766                                         meta:get_string("owner").." at "..
767                                         minetest.pos_to_string(pos))
768                         return 0
769                 end
770                 return stack:get_count()
771         end,
772     allow_metadata_inventory_take = function(pos, listname, index, stack, player)
773                 local meta = minetest.get_meta(pos)
774                 if not has_locked_chest_privilege(meta, player) then
775                         minetest.log("action", player:get_player_name()..
776                                         " tried to access a locked chest belonging to "..
777                                         meta:get_string("owner").." at "..
778                                         minetest.pos_to_string(pos))
779                         return 0
780                 end
781                 return stack:get_count()
782         end,
783         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
784                 minetest.log("action", player:get_player_name()..
785                                 " moves stuff in locked chest at "..minetest.pos_to_string(pos))
786         end,
787     on_metadata_inventory_put = function(pos, listname, index, stack, player)
788                 minetest.log("action", player:get_player_name()..
789                                 " moves stuff to locked chest at "..minetest.pos_to_string(pos))
790         end,
791     on_metadata_inventory_take = function(pos, listname, index, stack, player)
792                 minetest.log("action", player:get_player_name()..
793                                 " takes stuff from locked chest at "..minetest.pos_to_string(pos))
794         end,
795         on_rightclick = function(pos, node, clicker)
796                 local meta = minetest.get_meta(pos)
797                 if has_locked_chest_privilege(meta, clicker) then
798                         minetest.show_formspec(
799                                 clicker:get_player_name(),
800                                 "default:chest_locked",
801                                 default.get_locked_chest_formspec(pos)
802                         )
803                 end
804         end,
805 })
806
807 function default.get_furnace_active_formspec(pos, percent)
808         local formspec =
809                 "size[8,9]"..
810                 "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
811                 (100-percent)..":default_furnace_fire_fg.png]"..
812                 "list[current_name;fuel;2,3;1,1;]"..
813                 "list[current_name;src;2,1;1,1;]"..
814                 "list[current_name;dst;5,1;2,2;]"..
815                 "list[current_player;main;0,5;8,4;]"
816         return formspec
817 end
818
819 default.furnace_inactive_formspec =
820         "size[8,9]"..
821         "image[2,2;1,1;default_furnace_fire_bg.png]"..
822         "list[current_name;fuel;2,3;1,1;]"..
823         "list[current_name;src;2,1;1,1;]"..
824         "list[current_name;dst;5,1;2,2;]"..
825         "list[current_player;main;0,5;8,4;]"
826
827 minetest.register_node("default:furnace", {
828         description = "Furnace",
829         tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
830                 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
831         paramtype2 = "facedir",
832         groups = {cracky=2},
833         legacy_facedir_simple = true,
834         is_ground_content = false,
835         sounds = default.node_sound_stone_defaults(),
836         on_construct = function(pos)
837                 local meta = minetest.get_meta(pos)
838                 meta:set_string("formspec", default.furnace_inactive_formspec)
839                 meta:set_string("infotext", "Furnace")
840                 local inv = meta:get_inventory()
841                 inv:set_size("fuel", 1)
842                 inv:set_size("src", 1)
843                 inv:set_size("dst", 4)
844         end,
845         can_dig = function(pos,player)
846                 local meta = minetest.get_meta(pos);
847                 local inv = meta:get_inventory()
848                 if not inv:is_empty("fuel") then
849                         return false
850                 elseif not inv:is_empty("dst") then
851                         return false
852                 elseif not inv:is_empty("src") then
853                         return false
854                 end
855                 return true
856         end,
857         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
858                 local meta = minetest.get_meta(pos)
859                 local inv = meta:get_inventory()
860                 if listname == "fuel" then
861                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
862                                 if inv:is_empty("src") then
863                                         meta:set_string("infotext","Furnace is empty")
864                                 end
865                                 return stack:get_count()
866                         else
867                                 return 0
868                         end
869                 elseif listname == "src" then
870                         return stack:get_count()
871                 elseif listname == "dst" then
872                         return 0
873                 end
874         end,
875         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
876                 local meta = minetest.get_meta(pos)
877                 local inv = meta:get_inventory()
878                 local stack = inv:get_stack(from_list, from_index)
879                 if to_list == "fuel" then
880                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
881                                 if inv:is_empty("src") then
882                                         meta:set_string("infotext","Furnace is empty")
883                                 end
884                                 return count
885                         else
886                                 return 0
887                         end
888                 elseif to_list == "src" then
889                         return count
890                 elseif to_list == "dst" then
891                         return 0
892                 end
893         end,
894 })
895
896 minetest.register_node("default:furnace_active", {
897         description = "Furnace",
898         tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
899                 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
900         paramtype2 = "facedir",
901         light_source = 8,
902         drop = "default:furnace",
903         groups = {cracky=2, not_in_creative_inventory=1,hot=1},
904         legacy_facedir_simple = true,
905         is_ground_content = false,
906         sounds = default.node_sound_stone_defaults(),
907         on_construct = function(pos)
908                 local meta = minetest.get_meta(pos)
909                 meta:set_string("formspec", default.furnace_inactive_formspec)
910                 meta:set_string("infotext", "Furnace");
911                 local inv = meta:get_inventory()
912                 inv:set_size("fuel", 1)
913                 inv:set_size("src", 1)
914                 inv:set_size("dst", 4)
915         end,
916         can_dig = function(pos,player)
917                 local meta = minetest.get_meta(pos);
918                 local inv = meta:get_inventory()
919                 if not inv:is_empty("fuel") then
920                         return false
921                 elseif not inv:is_empty("dst") then
922                         return false
923                 elseif not inv:is_empty("src") then
924                         return false
925                 end
926                 return true
927         end,
928         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
929                 local meta = minetest.get_meta(pos)
930                 local inv = meta:get_inventory()
931                 if listname == "fuel" then
932                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
933                                 if inv:is_empty("src") then
934                                         meta:set_string("infotext","Furnace is empty")
935                                 end
936                                 return stack:get_count()
937                         else
938                                 return 0
939                         end
940                 elseif listname == "src" then
941                         return stack:get_count()
942                 elseif listname == "dst" then
943                         return 0
944                 end
945         end,
946         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
947                 local meta = minetest.get_meta(pos)
948                 local inv = meta:get_inventory()
949                 local stack = inv:get_stack(from_list, from_index)
950                 if to_list == "fuel" then
951                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
952                                 if inv:is_empty("src") then
953                                         meta:set_string("infotext","Furnace is empty")
954                                 end
955                                 return count
956                         else
957                                 return 0
958                         end
959                 elseif to_list == "src" then
960                         return count
961                 elseif to_list == "dst" then
962                         return 0
963                 end
964         end,
965 })
966
967 local function swap_node(pos,name)
968         local node = minetest.get_node(pos)
969         if node.name == name then
970                 return
971         end
972         node.name = name
973         minetest.swap_node(pos,node)
974 end
975
976 minetest.register_abm({
977         nodenames = {"default:furnace","default:furnace_active"},
978         interval = 1.0,
979         chance = 1,
980         action = function(pos, node, active_object_count, active_object_count_wider)
981                 local meta = minetest.get_meta(pos)
982                 for i, name in ipairs({
983                                 "fuel_totaltime",
984                                 "fuel_time",
985                                 "src_totaltime",
986                                 "src_time"
987                 }) do
988                         if meta:get_string(name) == "" then
989                                 meta:set_float(name, 0.0)
990                         end
991                 end
992
993                 local inv = meta:get_inventory()
994
995                 local srclist = inv:get_list("src")
996                 local cooked = nil
997                 local aftercooked
998                 
999                 if srclist then
1000                         cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
1001                 end
1002                 
1003                 local was_active = false
1004                 
1005                 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
1006                         was_active = true
1007                         meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
1008                         meta:set_float("src_time", meta:get_float("src_time") + 1)
1009                         if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
1010                                 -- check if there's room for output in "dst" list
1011                                 if inv:room_for_item("dst",cooked.item) then
1012                                         -- Put result in "dst" list
1013                                         inv:add_item("dst", cooked.item)
1014                                         -- take stuff from "src" list
1015                                         inv:set_stack("src", 1, aftercooked.items[1])
1016                                 else
1017                                         --print("Could not insert '"..cooked.item:to_string().."'")
1018                                 end
1019                                 meta:set_string("src_time", 0)
1020                         end
1021                 end
1022                 
1023                 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
1024                         local percent = math.floor(meta:get_float("fuel_time") /
1025                                         meta:get_float("fuel_totaltime") * 100)
1026                         meta:set_string("infotext","Furnace active: "..percent.."%")
1027                         swap_node(pos,"default:furnace_active")
1028                         meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent))
1029                         return
1030                 end
1031
1032                 local fuel = nil
1033                 local afterfuel
1034                 local cooked = nil
1035                 local fuellist = inv:get_list("fuel")
1036                 local srclist = inv:get_list("src")
1037                 
1038                 if srclist then
1039                         cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
1040                 end
1041                 if fuellist then
1042                         fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
1043                 end
1044
1045                 if fuel.time <= 0 then
1046                         meta:set_string("infotext","Furnace out of fuel")
1047                         swap_node(pos,"default:furnace")
1048                         meta:set_string("formspec", default.furnace_inactive_formspec)
1049                         return
1050                 end
1051
1052                 if cooked.item:is_empty() then
1053                         if was_active then
1054                                 meta:set_string("infotext","Furnace is empty")
1055                                 swap_node(pos,"default:furnace")
1056                                 meta:set_string("formspec", default.furnace_inactive_formspec)
1057                         end
1058                         return
1059                 end
1060
1061                 meta:set_string("fuel_totaltime", fuel.time)
1062                 meta:set_string("fuel_time", 0)
1063                 
1064                 inv:set_stack("fuel", 1, afterfuel.items[1])
1065         end,
1066 })
1067
1068 minetest.register_node("default:cobble", {
1069         description = "Cobblestone",
1070         tiles = {"default_cobble.png"},
1071         is_ground_content = true,
1072         groups = {cracky=3, stone=2},
1073         sounds = default.node_sound_stone_defaults(),
1074 })
1075
1076 minetest.register_node("default:mossycobble", {
1077         description = "Mossy Cobblestone",
1078         tiles = {"default_mossycobble.png"},
1079         is_ground_content = true,
1080         groups = {cracky=3},
1081         sounds = default.node_sound_stone_defaults(),
1082 })
1083
1084 minetest.register_node("default:coalblock", {
1085         description = "Coal Block",
1086         tiles = {"default_coal_block.png"},
1087         is_ground_content = true,
1088         groups = {cracky=3},
1089         sounds = default.node_sound_stone_defaults(),
1090 })
1091
1092 minetest.register_node("default:steelblock", {
1093         description = "Steel Block",
1094         tiles = {"default_steel_block.png"},
1095         is_ground_content = true,
1096         groups = {cracky=1,level=2},
1097         sounds = default.node_sound_stone_defaults(),
1098 })
1099
1100 minetest.register_node("default:copperblock", {
1101         description = "Copper Block",
1102         tiles = {"default_copper_block.png"},
1103         is_ground_content = true,
1104         groups = {cracky=1,level=2},
1105         sounds = default.node_sound_stone_defaults(),
1106 })
1107
1108 minetest.register_node("default:bronzeblock", {
1109         description = "Bronze Block",
1110         tiles = {"default_bronze_block.png"},
1111         is_ground_content = true,
1112         groups = {cracky=1,level=2},
1113         sounds = default.node_sound_stone_defaults(),
1114 })
1115
1116 minetest.register_node("default:mese", {
1117         description = "Mese Block",
1118         tiles = {"default_mese_block.png"},
1119         is_ground_content = true,
1120         groups = {cracky=1,level=2},
1121         sounds = default.node_sound_stone_defaults(),
1122 })
1123 minetest.register_alias("default:mese_block", "default:mese")
1124
1125 minetest.register_node("default:goldblock", {
1126         description = "Gold Block",
1127         tiles = {"default_gold_block.png"},
1128         is_ground_content = true,
1129         groups = {cracky=1},
1130         sounds = default.node_sound_stone_defaults(),
1131 })
1132
1133 minetest.register_node("default:diamondblock", {
1134         description = "Diamond Block",
1135         tiles = {"default_diamond_block.png"},
1136         is_ground_content = true,
1137         groups = {cracky=1,level=3},
1138         sounds = default.node_sound_stone_defaults(),
1139 })
1140
1141 minetest.register_node("default:obsidian_glass", {
1142         description = "Obsidian Glass",
1143         drawtype = "glasslike",
1144         tiles = {"default_obsidian_glass.png"},
1145         paramtype = "light",
1146         is_ground_content = false,
1147         sunlight_propagates = true,
1148         sounds = default.node_sound_glass_defaults(),
1149         groups = {cracky=3,oddly_breakable_by_hand=3},
1150 })
1151
1152 minetest.register_node("default:obsidian", {
1153         description = "Obsidian",
1154         tiles = {"default_obsidian.png"},
1155         is_ground_content = true,
1156         sounds = default.node_sound_stone_defaults(),
1157         groups = {cracky=1,level=2},
1158 })
1159
1160 minetest.register_node("default:nyancat", {
1161         description = "Nyan Cat",
1162         tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
1163                 "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
1164         paramtype2 = "facedir",
1165         groups = {cracky=2},
1166         is_ground_content = false,
1167         legacy_facedir_simple = true,
1168         sounds = default.node_sound_defaults(),
1169 })
1170
1171 minetest.register_node("default:nyancat_rainbow", {
1172         description = "Nyan Cat Rainbow",
1173         tiles = {"default_nc_rb.png^[transformR90", "default_nc_rb.png^[transformR90",
1174                 "default_nc_rb.png", "default_nc_rb.png"},
1175         paramtype2 = "facedir",
1176         groups = {cracky=2},
1177         is_ground_content = false,
1178         sounds = default.node_sound_defaults(),
1179 })
1180
1181 minetest.register_node("default:sapling", {
1182         description = "Sapling",
1183         drawtype = "plantlike",
1184         visual_scale = 1.0,
1185         tiles = {"default_sapling.png"},
1186         inventory_image = "default_sapling.png",
1187         wield_image = "default_sapling.png",
1188         paramtype = "light",
1189         walkable = false,
1190         is_ground_content = true,
1191         selection_box = {
1192                 type = "fixed",
1193                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
1194         },
1195         groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
1196         sounds = default.node_sound_leaves_defaults(),
1197 })
1198
1199 minetest.register_node("default:apple", {
1200         description = "Apple",
1201         drawtype = "plantlike",
1202         visual_scale = 1.0,
1203         tiles = {"default_apple.png"},
1204         inventory_image = "default_apple.png",
1205         paramtype = "light",
1206         sunlight_propagates = true,
1207         walkable = false,
1208         is_ground_content = true,
1209         selection_box = {
1210                 type = "fixed",
1211                 fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
1212         },
1213         groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
1214         on_use = minetest.item_eat(1),
1215         sounds = default.node_sound_leaves_defaults(),
1216         after_place_node = function(pos, placer, itemstack)
1217                 if placer:is_player() then
1218                         minetest.set_node(pos, {name="default:apple", param2=1})
1219                 end
1220         end,
1221 })
1222
1223 minetest.register_node("default:dry_shrub", {
1224         description = "Dry Shrub",
1225         drawtype = "plantlike",
1226         visual_scale = 1.0,
1227         tiles = {"default_dry_shrub.png"},
1228         inventory_image = "default_dry_shrub.png",
1229         wield_image = "default_dry_shrub.png",
1230         paramtype = "light",
1231         waving = 1,
1232         walkable = false,
1233         is_ground_content = true,
1234         buildable_to = true,
1235         groups = {snappy=3,flammable=3,attached_node=1},
1236         sounds = default.node_sound_leaves_defaults(),
1237         selection_box = {
1238                 type = "fixed",
1239                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1240         },
1241 })
1242
1243 minetest.register_node("default:grass_1", {
1244         description = "Grass",
1245         drawtype = "plantlike",
1246         tiles = {"default_grass_1.png"},
1247         -- use a bigger inventory image
1248         inventory_image = "default_grass_3.png",
1249         wield_image = "default_grass_3.png",
1250         paramtype = "light",
1251         walkable = false,
1252         is_ground_content = true,
1253         buildable_to = true,
1254         groups = {snappy=3,flammable=3,flora=1,attached_node=1},
1255         sounds = default.node_sound_leaves_defaults(),
1256         selection_box = {
1257                 type = "fixed",
1258                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1259         },
1260         on_place = function(itemstack, placer, pointed_thing)
1261                 -- place a random grass node
1262                 local stack = ItemStack("default:grass_"..math.random(1,5))
1263                 local ret = minetest.item_place(stack, placer, pointed_thing)
1264                 return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
1265         end,
1266 })
1267
1268 minetest.register_node("default:grass_2", {
1269         description = "Grass",
1270         drawtype = "plantlike",
1271         tiles = {"default_grass_2.png"},
1272         inventory_image = "default_grass_2.png",
1273         wield_image = "default_grass_2.png",
1274         paramtype = "light",
1275         walkable = false,
1276         buildable_to = true,
1277         is_ground_content = true,
1278         drop = "default:grass_1",
1279         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1280         sounds = default.node_sound_leaves_defaults(),
1281         selection_box = {
1282                 type = "fixed",
1283                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1284         },
1285 })
1286 minetest.register_node("default:grass_3", {
1287         description = "Grass",
1288         drawtype = "plantlike",
1289         tiles = {"default_grass_3.png"},
1290         inventory_image = "default_grass_3.png",
1291         wield_image = "default_grass_3.png",
1292         paramtype = "light",
1293         walkable = false,
1294         buildable_to = true,
1295         is_ground_content = true,
1296         drop = "default:grass_1",
1297         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1298         sounds = default.node_sound_leaves_defaults(),
1299         selection_box = {
1300                 type = "fixed",
1301                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1302         },
1303 })
1304
1305 minetest.register_node("default:grass_4", {
1306         description = "Grass",
1307         drawtype = "plantlike",
1308         tiles = {"default_grass_4.png"},
1309         inventory_image = "default_grass_4.png",
1310         wield_image = "default_grass_4.png",
1311         paramtype = "light",
1312         walkable = false,
1313         buildable_to = true,
1314         is_ground_content = true,
1315         drop = "default:grass_1",
1316         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1317         sounds = default.node_sound_leaves_defaults(),
1318         selection_box = {
1319                 type = "fixed",
1320                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1321         },
1322 })
1323
1324 minetest.register_node("default:grass_5", {
1325         description = "Grass",
1326         drawtype = "plantlike",
1327         tiles = {"default_grass_5.png"},
1328         inventory_image = "default_grass_5.png",
1329         wield_image = "default_grass_5.png",
1330         paramtype = "light",
1331         walkable = false,
1332         buildable_to = true,
1333         is_ground_content = true,
1334         drop = "default:grass_1",
1335         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1336         sounds = default.node_sound_leaves_defaults(),
1337         selection_box = {
1338                 type = "fixed",
1339                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1340         },
1341 })
1342
1343 minetest.register_node("default:ice", {
1344         description = "Ice",
1345         tiles = {"default_ice.png"},
1346         is_ground_content = true,
1347         paramtype = "light",
1348         freezemelt = "default:water_source",
1349         groups = {cracky=3, melts=1},
1350         sounds = default.node_sound_glass_defaults(),
1351 })
1352
1353 minetest.register_node("default:snow", {
1354         description = "Snow",
1355         tiles = {"default_snow.png"},
1356         inventory_image = "default_snowball.png",
1357         wield_image = "default_snowball.png",
1358         is_ground_content = true,
1359         paramtype = "light",
1360         buildable_to = true,
1361         leveled = 7,
1362         drawtype = "nodebox",
1363         freezemelt = "default:water_flowing",
1364         node_box = {
1365                 type = "leveled",
1366                 fixed = {
1367                         {-0.5, -0.5, -0.5,  0.5, -0.5+2/16, 0.5},
1368                 },
1369         },
1370         groups = {crumbly=3,falling_node=1, melts=1, float=1},
1371         sounds = default.node_sound_dirt_defaults({
1372                 footstep = {name="default_snow_footstep", gain=0.25},
1373                 dug = {name="default_snow_footstep", gain=0.75},
1374         }),
1375         on_construct = function(pos)
1376                 pos.y = pos.y - 1
1377                 if minetest.get_node(pos).name == "default:dirt_with_grass" then
1378                         minetest.set_node(pos, {name="default:dirt_with_snow"})
1379                 end
1380         end,
1381 })
1382 minetest.register_alias("snow", "default:snow")
1383
1384 minetest.register_node("default:snowblock", {
1385         description = "Snow Block",
1386         tiles = {"default_snow.png"},
1387         is_ground_content = true,
1388         freezemelt = "default:water_source",
1389         groups = {crumbly=3, melts=1},
1390         sounds = default.node_sound_dirt_defaults({
1391                 footstep = {name="default_snow_footstep", gain=0.25},
1392                 dug = {name="default_snow_footstep", gain=0.75},
1393         }),
1394 })