move the furnace_burntime to node definitions and short nodes.lua

This commit is contained in:
HybridDog 2015-06-12 18:11:45 +02:00
parent 3527d3158d
commit d5cdc50f3a
2 changed files with 89 additions and 209 deletions

View File

@ -1,51 +1,17 @@
--[[ --[[
Crafting Sections (in order, top to bottom): Crafting Sections (in order, top to bottom):
1. Fuel 1. Cooking
2. Cooking 2. Crafting and Recycling
3. Crafting and Recycling
The crafting recipe for the sled is in the sled.lua file. The crafting recipe for the sled is in the sled.lua file.
~ LazyJ ~ LazyJ
--]] ]]
-- 1. Fuel
minetest.register_craft({
type = "fuel",
recipe = "snow:needles",
burntime = 1,
})
-- 1. Cooking
minetest.register_craft({
type = "fuel",
recipe = "snow:sapling_pine",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "snow:needles_decorated",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "snow:xmas_tree",
burntime = 10,
})
-- 2. Cooking
--[[ --[[
"Cooks_into_ice" is a custom group I assigned to full-sized, snow-stuff nodes "Cooks_into_ice" is a custom group I assigned to full-sized, snow-stuff nodes
@ -53,7 +19,7 @@ minetest.register_craft({
recipe for each one. recipe for each one.
~ LazyJ ~ LazyJ
--]] ]]
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
@ -67,17 +33,17 @@ minetest.register_craft({
-- 3. Crafting and Recycling -- 2. Crafting and Recycling
-- Let's make moss craftable so players can more easily create mossycobble and -- Let's make moss craftable so players can more easily create mossycobble and
-- gives another useful purpose to pine needles. ~ LazyJ -- gives another useful purpose to pine needles. ~ LazyJ
minetest.register_craft({ minetest.register_craft({
output = 'snow:moss', output = 'snow:moss',
recipe = { recipe = {
{'snow:needles', 'snow:needles'}, {'snow:needles', 'snow:needles'},
{'snow:needles', 'snow:needles'}, {'snow:needles', 'snow:needles'},
}, },
}) })
@ -99,7 +65,7 @@ minetest.register_craft({
recipe = { recipe = {
'snow:snow_cobble', 'snow:snow_cobble',
'snow:snow_cobble' 'snow:snow_cobble'
} }
}) })
@ -110,17 +76,17 @@ minetest.register_craft({
recipe = { recipe = {
'default:snowblock', 'default:snowblock',
'default:snowblock' 'default:snowblock'
} }
})]] })]]
minetest.register_craft({ minetest.register_craft({
output = 'snow:snow_brick', output = 'snow:snow_brick',
recipe = { recipe = {
{'default:snowblock', 'default:snowblock'}, {'default:snowblock', 'default:snowblock'},
{'default:snowblock', 'default:snowblock'} {'default:snowblock', 'default:snowblock'}
} }
}) })
--Craft icy snow. --Craft icy snow.
@ -137,7 +103,7 @@ minetest.register_craft({
'default:ice', 'default:ice',
'default:ice', 'default:ice',
'default:ice' 'default:ice'
} }
}) })
@ -151,7 +117,7 @@ minetest.register_craft({
'default:snow', 'default:snow',
'default:ice', 'default:ice',
'default:ice' 'default:ice'
} }
}) })
minetest.register_craft({ minetest.register_craft({
@ -161,7 +127,7 @@ minetest.register_craft({
'default:snow', 'default:snow',
'default:snow', 'default:snow',
'default:ice' 'default:ice'
} }
}) })
minetest.register_craft({ minetest.register_craft({
@ -170,16 +136,16 @@ minetest.register_craft({
recipe = { recipe = {
'default:snow', 'default:snow',
'default:ice' 'default:ice'
} }
}) })
-- Why not recycle snow_bricks back into snowblocks? ~ LazyJ -- Why not recycle snow_bricks back into snowblocks? ~ LazyJ
minetest.register_craft({ minetest.register_craft({
output = 'default:snowblock 4', output = 'default:snowblock 4',
recipe = { recipe = {
{'snow:snow_brick'} {'snow:snow_brick'}
} }
}) })

View File

@ -1,7 +1,7 @@
-- NODES -- NODES
-- Pine Needles -- Pine Needles
minetest.register_node("snow:needles",{ local nodedef = {
description = "Pine Needles", description = "Pine Needles",
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
visual_scale = 1.3, visual_scale = 1.3,
@ -9,6 +9,7 @@ minetest.register_node("snow:needles",{
waving = 1, waving = 1,
paramtype = "light", paramtype = "light",
groups = {snappy=3, leafdecay=5}, groups = {snappy=3, leafdecay=5},
furnace_burntime = 1,
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
@ -18,14 +19,12 @@ minetest.register_node("snow:needles",{
rarity = 20, rarity = 20,
}, },
{ {
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'snow:needles'}, items = {'snow:needles'},
} }
} }
}, },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) }
--[[ --[[
If christmas_content is enabled, then this next part will override the pine needles' drop code If christmas_content is enabled, then this next part will override the pine needles' drop code
@ -33,36 +32,20 @@ If christmas_content is enabled, then this next part will override the pine need
The Xmas tree needles are registred and defined a farther down in this nodes.lua file. The Xmas tree needles are registred and defined a farther down in this nodes.lua file.
~ LazyJ ~ LazyJ
]]
--]]
if snow.christmas_content then if snow.christmas_content then
--Christmas trees table.insert(nodedef.drop.items, 1, {
-- player will get xmas tree with 1/120 chance
minetest.override_item("snow:needles", { items = {'snow:xmas_tree'},
drop = { rarity = 120,
max_items = 1,
items = {
{
-- player will get xmas tree with 1/120 chance
items = {'snow:xmas_tree'},
rarity = 120,
},
{
-- player will get sapling with 1/20 chance
items = {'snow:sapling_pine'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'snow:needles'},
}
}
}
}) })
end end
minetest.register_node("snow:needles", table.copy(nodedef))
--Christmas easter egg --Christmas easter egg
minetest.register_on_mapgen_init( function() minetest.register_on_mapgen_init( function()
@ -73,102 +56,28 @@ end
) )
--[[
Original, static Xmas lights. Keep so people can "turn off" the
animation if it is too much for them. ~ LazyJ
--Decorated Pine leaves
minetest.register_node("snow:needles_decorated", {
description = "Decorated Pine Needles",
drawtype = "allfaces_optional",
tiles = {"snow_needles_decorated.png"},
paramtype = "light",
groups = {snappy=3, leafdecay=3},
drop = {
max_items = 1,
items = {
{
-- player will get xmas tree with 1/20 chance
items = {'snow:xmas_tree'},
rarity = 50,
},
{
-- player will get sapling with 1/20 chance
items = {'snow:sapling_pine'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'snow:needles_decorated'},
}
}
},
sounds = default.node_sound_leaves_defaults(),
})
--]]
-- Animated, "blinking lights" version. ~ LazyJ
-- Decorated Pine Leaves -- Decorated Pine Leaves
minetest.register_node("snow:needles_decorated", {
description = "Decorated Pine Needles", nodedef.description ="Decorated "..nodedef.description
drawtype = "allfaces_optional", nodedef.light_source = 5
light_source = 5, nodedef.waving = nil
inventory_image = minetest.inventorycube("snow_needles_decorated.png"), if snow.disable_deco_needle_ani then
--tiles = {"snow_needles_decorated.png"}, nodedef.tiles = {"snow_needles_decorated.png"}
tiles = { else
-- Animated, "blinking lights" version. ~ LazyJ
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
nodedef.tiles = {
{name="snow_needles_decorated_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=20.0}} {name="snow_needles_decorated_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=20.0}}
}, }
paramtype = "light", end
groups = {snappy=3, leafdecay=5}, nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
drop = {
max_items = 1, minetest.register_node("snow:needles_decorated", nodedef)
items = {
{
-- player will get xmas tree with 1/120 chance
items = {'snow:xmas_tree'},
rarity = 120,
},
{
-- player will get sapling with 1/20 chance
items = {'snow:sapling_pine'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'snow:needles_decorated'},
}
}
},
sounds = default.node_sound_leaves_defaults(),
})
-- Saplings
nodedef = {
-- Xmas Tree Sapling
minetest.register_node("snow:xmas_tree", {
description = "Christmas Tree",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"snow_xmas_tree.png"},
inventory_image = "snow_xmas_tree.png",
wield_image = "snow_xmas_tree.png",
paramtype = "light",
walkable = false,
groups = {snappy=2,dig_immediate=3},
sounds = default.node_sound_defaults(),
})
-- Pine Sapling
minetest.register_node("snow:sapling_pine", {
description = "Pine Sapling", description = "Pine Sapling",
drawtype = "plantlike", drawtype = "plantlike",
visual_scale = 1.0, visual_scale = 1.0,
@ -178,52 +87,57 @@ minetest.register_node("snow:sapling_pine", {
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
groups = {snappy=2,dig_immediate=3}, groups = {snappy=2,dig_immediate=3},
furnace_burntime = 10,
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}
}) -- Pine Sapling
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
-- Xmas Tree Sapling
nodedef.description = "Christmas Tree"
nodedef.tiles = {"snow_xmas_tree.png"}
nodedef.inventory_image = "snow_xmas_tree.png"
nodedef.wield_image = "snow_xmas_tree.png"
minetest.register_node("snow:xmas_tree", nodedef)
nodedef = {
-- Star on Xmas Trees
minetest.register_node("snow:star", {
description = "Star", description = "Star",
--drawtype = "torchlike", drawtype = "plantlike",
drawtype = "plantlike", -- Stars disappeared when viewed at the right angle. "Plantlike" solved the visual problem. ~ LazyJ
tiles = {"snow_star.png"}, tiles = {"snow_star.png"},
inventory_image = "snow_star.png", inventory_image = "snow_star.png",
wield_image = "snow_star.png", wield_image = "snow_star.png",
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
--groups = {snappy=2,dig_immediate=3}, -- Don't want the ornament breaking too easily because you have to punch it to turn it on and off. ~ LazyJ
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1}, -- Don't want the ornament breaking too easily because you have to punch it to turn it on and off. ~ LazyJ groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1},
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}), -- Breaking "glass" sound makes it sound like a real, broken, Xmas tree ornament (Sorry, Mom!). ;)- ~ LazyJ -- Breaking "glass" sound makes it sound like a real, broken, Xmas tree ornament (Sorry, Mom!). ;)- ~ LazyJ
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}),
on_punch = function(pos, node) -- Added a "lit" star that can be punched on or off depending on your preference. ~ LazyJ on_punch = function(pos, node) -- Added a "lit" star that can be punched on or off depending on your preference. ~ LazyJ
node.name = "snow:star_lit" node.name = "snow:star_lit"
minetest.set_node(pos, node) minetest.set_node(pos, node)
nodeupdate(pos) nodeupdate(pos)
end, end,
}) }
-- Star on Xmas Trees
minetest.register_node("snow:star", table.copy(nodedef))
-- Star (Lit Version) on Xmas Trees -- Star (Lit Version) on Xmas Trees
minetest.register_node("snow:star_lit", { nodedef.description = nodedef.description.." Lighted"
description = "Star Lighted", nodedef.light_source = LIGHT_MAX
drawtype = "plantlike", nodedef.tiles = {"snow_star_lit.png"}
light_source = LIGHT_MAX, nodedef.drop = "snow:star"
tiles = {"snow_star_lit.png"}, nodedef.groups.not_in_creative_inventory = 1
wield_image = "snow_star.png", nodedef.on_punch = function(pos, node)
paramtype = "light", node.name = "snow:star"
walkable = false, minetest.set_node(pos, node)
drop = "snow:star", nodeupdate(pos)
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, end
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}),
on_punch = function(pos, node) minetest.register_node("snow:star_lit", nodedef)
node.name = "snow:star"
minetest.set_node(pos, node)
nodeupdate(pos)
end,
})