]> git.lizzy.rs Git - Crafter.git/blob - mods/nether/nodes.lua
Add in prototype nether trees
[Crafter.git] / mods / nether / nodes.lua
1
2 minetest.register_node("nether:bedrock", {
3     description = "Bedrock",
4     tiles = {"bedrock.png"},
5     groups = {unbreakable = 1, pathable = 1},
6     sounds = main.stoneSound(),
7     is_ground_content = false,
8     --light_source = 14, --debugging
9 })
10
11
12 minetest.register_node("nether:netherrack", {
13     description = "Netherrack",
14     tiles = {"netherrack.png"},
15     groups = {netherrack = 1, pathable = 1},
16     sounds = main.stoneSound(),
17     is_ground_content = false,
18     light_source = 7,
19     drop = {
20                         max_items = 1,
21                         items= {
22                                 {
23                                         rarity = 0,
24                                         tools = {"main:woodpick","main:stonepick","main:ironpick","main:goldpick","main:diamondpick"},
25                                         items = {"nether:netherrack"},
26                                 },
27                                 },
28                         },
29 })
30 minetest.register_node("nether:glowstone", {
31     description = "Glowstone",
32     tiles = {"glowstone.png"},
33     groups = {glass = 1, pathable = 1},
34     sounds = main.stoneSound({
35                 footstep = {name = "glass_footstep", gain = 0.4},
36         dug =  {name = "break_glass", gain = 0.4},
37         }),
38     is_ground_content = false,
39     light_source = 12,
40     after_destruct = function(pos, oldnode)
41                 destroy_aether_portal(pos)
42     end,
43     drop = {
44                         max_items = 5,
45                         tools = tool_required,
46                         items= {
47                                 {
48                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
49                                         items = {"nether:glowstone_dust"},
50                                 },
51                                 {
52                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
53                                         items = {"nether:glowstone_dust"},
54                                 },
55                                 {
56                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
57                                         items = {"nether:glowstone_dust"},
58                                 },
59                                 {
60                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
61                                         items = {"nether:glowstone_dust"},
62                                 },
63                                 {
64                                         rarity = 5,
65                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
66                                         items = {"nether:glowstone_dust"},
67                                 },
68                         },
69                 }
70 })
71
72 minetest.register_node("nether:obsidian", {
73     description = "Obsidian",
74     tiles = {"obsidian.png"},
75     groups = {stone = 5, pathable = 1},
76     --groups = {stone = 1, pathable = 1}, --leave this here for debug
77     sounds = main.stoneSound(),
78     is_ground_content = false,
79     after_destruct = function(pos, oldnode)
80                 destroy_nether_portal(pos)
81     end,
82     --light_source = 7,
83 })
84
85
86 minetest.register_node("nether:lava", {
87         description = "Lava",
88         drawtype = "liquid",
89         tiles = {
90                 {
91                         name = "lava_source.png",
92                         backface_culling = false,
93                         animation = {
94                                 type = "vertical_frames",
95                                 aspect_w = 16,
96                                 aspect_h = 16,
97                                 length = 2.0,
98                         },
99                 },
100                 {
101                         name = "lava_source.png",
102                         backface_culling = true,
103                         animation = {
104                                 type = "vertical_frames",
105                                 aspect_w = 16,
106                                 aspect_h = 16,
107                                 length = 2.0,
108                         },
109                 },
110         },
111         paramtype = "light",
112         light_source = 13,
113         walkable = false,
114         pointable = false,
115         diggable = false,
116         buildable_to = true,
117         is_ground_content = false,
118         drop = "",
119         drowning = 1,
120         liquidtype = "source",
121         liquid_alternative_flowing = "nether:lavaflow",
122         liquid_alternative_source = "nether:lava",
123         liquid_viscosity = 1,
124         liquid_renewable = true,
125         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
126         groups = {lava = 3, liquid = 2, igniter = 1,hurt_inside=2},
127 })
128
129 minetest.register_node("nether:lavaflow", {
130         description = "Flowing Lava",
131         drawtype = "flowingliquid",
132         tiles = {"lava_flow.png"},
133         special_tiles = {
134                 {
135                         name = "lava_flow.png",
136                         backface_culling = false,
137                         animation = {
138                                 type = "vertical_frames",
139                                 aspect_w = 16,
140                                 aspect_h = 16,
141                                 length = 3.3,
142                         },
143                 },
144                 {
145                         name = "lava_flow.png",
146                         backface_culling = true,
147                         animation = {
148                                 type = "vertical_frames",
149                                 aspect_w = 16,
150                                 aspect_h = 16,
151                                 length = 3.3,
152                         },
153                 },
154         },
155         selection_box = {
156             type = "fixed",
157             fixed = {
158                 {0, 0, 0, 0, 0, 0},
159             },
160         },
161         paramtype = "light",
162         paramtype2 = "flowingliquid",
163         light_source = 13,
164         walkable = false,
165         pointable = false,
166         diggable = false,
167         buildable_to = true,
168         is_ground_content = false,
169         drop = "",
170         drowning = 1,
171         liquidtype = "flowing",
172         liquid_alternative_flowing = "nether:lavaflow",
173         liquid_alternative_source = "nether:lava",
174         liquid_viscosity = 1,
175         liquid_renewable = true,
176         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
177         groups = {lava = 3, liquid = 2, igniter = 1,hurt_inside=2},
178 })
179
180 local ores = {"redstone_","coal","iron","gold","diamond"}
181 local tool = {"main:woodpick","main:stonepick","main:ironpick","main:goldpick","main:diamondpick"}
182 for id,ore in pairs(ores) do
183
184         if id > 1 then
185                 id = id - 1
186         end
187         local tool_required = {}
188         for i = id,5 do
189                 table.insert(tool_required, tool[i])
190         end
191
192         
193
194         local drops = {
195                         max_items = 1,
196                         items= {
197                                 {
198                                         rarity = 0,
199                                         tools = tool_required,
200                                         items = {"nether:"..ore.."ore"},
201                                 },
202                                 },
203                         }
204         if ore == "diamond" then 
205                 drops = {
206                         max_items = 1,
207                         items= {
208                                 {
209                                         rarity = 0,
210                                         tools = tool_required,
211                                         items = {"main:diamond"},
212                                 },
213                                 },
214                         }
215         elseif ore == "coal" then 
216                 drops = {
217                         max_items = 1,
218                         items= {
219                                 {
220                                         rarity = 0,
221                                         tools = tool_required,
222                                         items = {"main:coal"},
223                                 },
224                                 },
225                         }
226         elseif ore == "redstone_" then
227                 drops = {
228                         max_items = 5,
229                         tools = tool_required,
230                         items= {
231                                 {
232                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
233                                         items = {"redstone:dust"},
234                                 },
235                                 {
236                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
237                                         items = {"redstone:dust"},
238                                 },
239                                 {
240                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
241                                         items = {"redstone:dust"},
242                                 },
243                                 {
244                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
245                                         items = {"redstone:dust"},
246                                 },
247                                 {
248                                         rarity = 5,
249                                         tools = {"main:ironpick","main:goldpick","main:diamondpick"},
250                                         items = {"redstone:dust"},
251                                 },
252                         },
253                 }
254         end
255         
256         minetest.register_node("nether:"..ore.."ore", {
257                 description = ore:gsub("^%l", string.upper).." Ore",
258                 tiles = {"netherrack.png^"..ore.."ore.png"},
259                 groups = {netherrack = id, pathable = 1, experience = id*2},
260                 sounds = main.stoneSound(),
261                 light_source = 7,
262                 drop = drops,
263                 after_destruct = function(pos, oldnode)
264                         if math.random() > 0.95 then
265                                 minetest.sound_play("tnt_ignite")
266                                 minetest.after(3, function(pos)
267                                         tnt(pos,9)
268                                 end,pos)
269                         end
270                 end,
271         })
272 end
273
274 local colorize_ratio = 125
275 minetest.register_node("nether:tree", {
276     description = "Nether Tree",
277     tiles = {"treeCore.png^[colorize:red:"..colorize_ratio,"treeCore.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio},
278     groups = {wood = 1, tree = 1, pathable = 1},
279     sounds = main.woodSound(),
280     --set metadata so treecapitator doesn't destroy houses
281     on_place = function(itemstack, placer, pointed_thing)
282                 if not pointed_thing.type == "node" then
283                         return
284                 end
285                 
286                 local sneak = placer:get_player_control().sneak
287                 local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
288                 if not sneak and noddef.on_rightclick then
289                         minetest.item_place(itemstack, placer, pointed_thing)
290                         return
291                 end
292                 
293                 local pos = pointed_thing.above
294                 minetest.item_place_node(itemstack, placer, pointed_thing)
295                 local meta = minetest.get_meta(pos)
296                 meta:set_string("placed", "true")       
297                 return(itemstack)
298         end,
299         light_source = 7,
300         --treecapitator - move treecapitator into own file using override
301         on_dig = function(pos, node, digger)
302         
303                 --check if wielding axe?
304                 
305                 local meta = minetest.get_meta(pos)
306                 if not meta:contains("placed") then
307                         --remove tree
308                         for y = -6,6 do
309                                 local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
310                                 --print(y)
311                                 if name == "nether:tree" then
312                                         minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
313                                 end
314                         end
315                 else
316                         minetest.node_dig(pos, node, digger)
317                 end     
318         end
319 })
320
321 minetest.register_node("nether:wood", {
322     description = "Nether Wood",
323     tiles = {"wood.png^[colorize:red:"..colorize_ratio},
324     groups = {wood = 1, pathable = 1},
325     sounds = main.woodSound(),
326     light_source = 7,
327 })
328
329
330 minetest.register_node("nether:leaves", {
331     description = "Nether Leaves",
332     drawtype = "allfaces_optional",
333         waving = 1,
334         walkable = false,
335         climbable = true,
336         paramtype = "light",
337         is_ground_content = false,      
338     tiles = {"leaves.png^[colorize:red:"..colorize_ratio},
339     groups = {leaves = 1, leafdecay = 1},
340     sounds = main.grassSound(),
341     light_source = 7,
342     drop = {
343                 max_items = 1,
344                 items= {
345                  {
346                         -- Only drop if using a tool whose name is identical to one
347                         -- of these.
348                         rarity = 10,
349                         items = {"main:sapling"},
350                         -- Whether all items in the dropped item list inherit the
351                         -- hardware coloring palette color from the dug node.
352                         -- Default is 'false'.
353                         --inherit_color = true,
354                 },
355                 {
356                         -- Only drop if using a tool whose name is identical to one
357                         -- of these.
358                         tools = {"main:shears"},
359                         rarity = 2,
360                         items = {"main:leaves"},
361                         -- Whether all items in the dropped item list inherit the
362                         -- hardware coloring palette color from the dug node.
363                         -- Default is 'false'.
364                         --inherit_color = true,
365                 },
366                 {
367                         -- Only drop if using a tool whose name is identical to one
368                         -- of these.
369                         tools = {"main:shears"},
370                         rarity = 2,
371                         items = {"main:stick"},
372                         -- Whether all items in the dropped item list inherit the
373                         -- hardware coloring palette color from the dug node.
374                         -- Default is 'false'.
375                         --inherit_color = true,
376                 },
377                 {
378                         -- Only drop if using a tool whose name is identical to one
379                         -- of these.
380                         tools = {"main:shears"},
381                         rarity = 6,
382                         items = {"main:apple"}, --golden apples
383                         -- Whether all items in the dropped item list inherit the
384                         -- hardware coloring palette color from the dug node.
385                         -- Default is 'false'.
386                         --inherit_color = true,
387                 },
388                 },
389     },
390 })