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