]> git.lizzy.rs Git - Crafter.git/blob - mods/main/nodes.lua
Add in running, sneaking, hurt sound
[Crafter.git] / mods / main / nodes.lua
1 print("Initializing nodes")
2
3 minetest.register_node("main:stone", {
4     description = "Stone",
5     tiles = {"stone.png"},
6     groups = {stone = 1, hard = 1, pickaxe = 1, hand = 4},
7     sounds = main.stoneSound(),
8     drop="main:cobble",
9 })
10
11 local ores = {"coal","iron","gold","diamond"}
12 for id,ore in pairs(ores) do
13         local drop = "main:"..ore.."ore"
14         if ore == "diamond" then drop = "main:diamond" elseif ore == "coal" then drop = "main:coal" end
15         
16         minetest.register_node("main:"..ore.."ore", {
17                 description = ore:gsub("^%l", string.upper).." Ore",
18                 tiles = {"stone.png^"..ore.."ore.png"},
19                 groups = {stone = id, hard = id, pickaxe = 1, hand = 4},
20                 sounds = main.stoneSound(),
21                 --light_source = 14,--debugging ore spawn
22                 drop = drop,
23         })
24 end
25
26 minetest.register_node("main:cobble", {
27     description = "Cobblestone",
28     tiles = {"cobble.png"},
29     groups = {stone = 2, hard = 1, pickaxe = 2, hand = 4},
30     sounds = main.stoneSound(),
31 })
32
33 minetest.register_node("main:dirt", {
34     description = "Dirt",
35     tiles = {"dirt.png"},
36     groups = {dirt = 1, soft = 1, shovel = 1, hand = 1},
37     sounds = main.grassSound(),
38 })
39
40 minetest.register_node("main:grass", {
41     description = "Grass",
42     tiles = {"grass.png"},
43     groups = {dirt = 1, soft = 1, shovel = 1, hand = 1},
44     sounds = main.grassSound(),
45     drop="main:dirt",
46 })
47
48 minetest.register_node("main:sand", {
49     description = "Sand",
50     tiles = {"sand.png"},
51     groups = {dirt = 1, sand = 1, soft = 1, shovel = 1, hand = 1},
52     sounds = main.sandSound(),
53 })
54
55 minetest.register_node("main:tree", {
56     description = "Tree",
57     tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
58     groups = {wood = 2, tree = 1, hard = 1, axe = 1, hand = 3},
59     sounds = main.woodSound(),
60     --set metadata so treecapitator doesn't destroy houses
61     on_place = function(itemstack, placer, pointed_thing)
62                 local pos = pointed_thing.above
63                 minetest.item_place_node(itemstack, placer, pointed_thing)
64                 local meta = minetest.get_meta(pos)
65                 meta:set_string("placed", "true")       
66                 return(itemstack)
67         end,
68         --treecapitator - move treecapitator into own file using override
69         on_dig = function(pos, node, digger)
70         
71                 --check if wielding axe?
72                 
73                 local meta = minetest.get_meta(pos)
74                 if not meta:contains("placed") then
75                         --remove tree
76                         for y = -6,6 do
77                                 --print(y)
78                                 if minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name == "main:tree" then
79                                         minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
80                                 end
81                         end
82                 else
83                         minetest.node_dig(pos, node, digger)
84                 end     
85         end
86 })
87
88 minetest.register_node("main:wood", {
89     description = "Wood",
90     tiles = {"wood.png"},
91     groups = {wood = 1, hard = 1, axe = 1, hand = 3},
92     sounds = main.woodSound(),
93 })
94
95 minetest.register_node("main:leaves", {
96     description = "Leaves",
97     drawtype = "allfaces_optional",
98         waving = 1,
99         walkable = false,
100         climbable = true,
101         paramtype = "light",
102         is_ground_content = false,      
103     tiles = {"leaves.png"},
104     groups = {leaves = 1, plant = 1, axe = 1, hand = 0, leafdecay = 1},
105     sounds = main.grassSound(),
106     drop = {
107                 max_items = 1,
108                 items= {
109                 {
110                         -- Only drop if using a tool whose name is identical to one
111                         -- of these.
112                         tools = {"main:shears"},
113                         rarity = 2,
114                         items = {"main:leaves"},
115                         -- Whether all items in the dropped item list inherit the
116                         -- hardware coloring palette color from the dug node.
117                         -- Default is 'false'.
118                         --inherit_color = true,
119                 },
120                 {
121                         -- Only drop if using a tool whose name is identical to one
122                         -- of these.
123                         tools = {"main:shears"},
124                         rarity = 2,
125                         items = {"main:stick"},
126                         -- Whether all items in the dropped item list inherit the
127                         -- hardware coloring palette color from the dug node.
128                         -- Default is 'false'.
129                         --inherit_color = true,
130                 },
131                 {
132                         -- Only drop if using a tool whose name is identical to one
133                         -- of these.
134                         tools = {"main:shears"},
135                         rarity = 6,
136                         items = {"main:apple"},
137                         -- Whether all items in the dropped item list inherit the
138                         -- hardware coloring palette color from the dug node.
139                         -- Default is 'false'.
140                         --inherit_color = true,
141                 },
142                 },
143     },
144 })
145
146 minetest.register_node("main:waterSource", {
147         description = "Water Source",
148         drawtype = "liquid",
149         waving = 3,
150         tiles = {
151                 {
152                         name = "waterSource.png",
153                         backface_culling = false,
154                         animation = {
155                                 type = "vertical_frames",
156                                 aspect_w = 16,
157                                 aspect_h = 16,
158                                 length = 2.0,
159                         },
160                 },
161                 {
162                         name = "waterSource.png",
163                         backface_culling = true,
164                         animation = {
165                                 type = "vertical_frames",
166                                 aspect_w = 16,
167                                 aspect_h = 16,
168                                 length = 2.0,
169                         },
170                 },
171         },
172         alpha = 191,
173         paramtype = "light",
174         walkable = false,
175         pointable = false,
176         diggable = false,
177         buildable_to = true,
178         is_ground_content = false,
179         drop = "",
180         drowning = 1,
181         liquidtype = "source",
182         liquid_alternative_flowing = "main:waterFlow",
183         liquid_alternative_source = "main:waterSource",
184         liquid_viscosity = 1,
185         post_effect_color = {a = 103, r = 30, g = 60, b = 90},
186         groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1},
187         --sounds = default.node_sound_water_defaults(),
188 })
189
190 minetest.register_node("main:waterFlow", {
191         description = "Water Flow",
192         drawtype = "flowingliquid",
193         waving = 3,
194         tiles = {"water.png"},
195         special_tiles = {
196                 {
197                         name = "waterFlow.png",
198                         backface_culling = false,
199                         animation = {
200                                 type = "vertical_frames",
201                                 aspect_w = 16,
202                                 aspect_h = 16,
203                                 length = 0.8,
204                         },
205                 },
206                 {
207                         name = "waterFlow.png",
208                         backface_culling = true,
209                         animation = {
210                                 type = "vertical_frames",
211                                 aspect_w = 16,
212                                 aspect_h = 16,
213                                 length = 0.8,
214                         },
215                 },
216         },
217         alpha = 191,
218         paramtype = "light",
219         paramtype2 = "flowingliquid",
220         walkable = false,
221         pointable = false,
222         diggable = false,
223         buildable_to = true,
224         is_ground_content = false,
225         drop = "",
226         drowning = 1,
227         liquidtype = "flowing",
228         liquid_alternative_flowing = "main:waterFlow",
229         liquid_alternative_source = "main:waterSource",
230         liquid_viscosity = 1,
231         post_effect_color = {a = 103, r = 30, g = 60, b = 90},
232         groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1},
233         --sounds = default.node_sound_water_defaults(),
234 })
235
236 --[[
237
238 minetest.register_node("default:lava_source", {
239         description = S("Lava Source"),
240         drawtype = "liquid",
241         tiles = {
242                 {
243                         name = "default_lava_source_animated.png",
244                         backface_culling = false,
245                         animation = {
246                                 type = "vertical_frames",
247                                 aspect_w = 16,
248                                 aspect_h = 16,
249                                 length = 3.0,
250                         },
251                 },
252                 {
253                         name = "default_lava_source_animated.png",
254                         backface_culling = true,
255                         animation = {
256                                 type = "vertical_frames",
257                                 aspect_w = 16,
258                                 aspect_h = 16,
259                                 length = 3.0,
260                         },
261                 },
262         },
263         paramtype = "light",
264         light_source = default.LIGHT_MAX - 1,
265         walkable = false,
266         pointable = false,
267         diggable = false,
268         buildable_to = true,
269         is_ground_content = false,
270         drop = "",
271         drowning = 1,
272         liquidtype = "source",
273         liquid_alternative_flowing = "default:lava_flowing",
274         liquid_alternative_source = "default:lava_source",
275         liquid_viscosity = 7,
276         liquid_renewable = false,
277         damage_per_second = 4 * 2,
278         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
279         groups = {lava = 3, liquid = 2, igniter = 1},
280 })
281
282 minetest.register_node("default:lava_flowing", {
283         description = S("Flowing Lava"),
284         drawtype = "flowingliquid",
285         tiles = {"default_lava.png"},
286         special_tiles = {
287                 {
288                         name = "default_lava_flowing_animated.png",
289                         backface_culling = false,
290                         animation = {
291                                 type = "vertical_frames",
292                                 aspect_w = 16,
293                                 aspect_h = 16,
294                                 length = 3.3,
295                         },
296                 },
297                 {
298                         name = "default_lava_flowing_animated.png",
299                         backface_culling = true,
300                         animation = {
301                                 type = "vertical_frames",
302                                 aspect_w = 16,
303                                 aspect_h = 16,
304                                 length = 3.3,
305                         },
306                 },
307         },
308         paramtype = "light",
309         paramtype2 = "flowingliquid",
310         light_source = default.LIGHT_MAX - 1,
311         walkable = false,
312         pointable = false,
313         diggable = false,
314         buildable_to = true,
315         is_ground_content = false,
316         drop = "",
317         drowning = 1,
318         liquidtype = "flowing",
319         liquid_alternative_flowing = "default:lava_flowing",
320         liquid_alternative_source = "default:lava_source",
321         liquid_viscosity = 7,
322         liquid_renewable = false,
323         damage_per_second = 4 * 2,
324         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
325         groups = {lava = 3, liquid = 2, igniter = 1,
326                 not_in_creative_inventory = 1},
327 })
328
329 ]]--