This repository has been archived on 2024-12-09. You can view files and clone it, but cannot push or open issues or pull requests.
Mineclonia/mods/farming/pumpkin.old
2015-06-29 19:55:58 +02:00

125 lines
3.6 KiB
Text

LIGHT_MAX = 15
minetest.register_craftitem("farming:pumpkin_seed", {
description = "Pumpkin Seed",
stack_max = 64,
inventory_image = "farming_pumpkin_seed.png",
on_place = function(itemstack, placer, pointed_thing)
local above = minetest.env:get_node(pointed_thing.above)
if above.name == "air" then
above.name = "farming:pumpkin_1"
minetest.env:set_node(pointed_thing.above, above)
itemstack:take_item(1)
return itemstack
end
end
})
minetest.register_node("farming:pumpkin_1", {
paramtype = "light",
sunlight_propagates = true,
drawtype = "nodebox",
drop = "",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1},
})
minetest.register_node("farming:pumpkin_2", {
paramtype = "light",
sunlight_propagates = true,
drawtype = "nodebox",
drop = "",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
node_box = {
type = "fixed",
fixed = {
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
},
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1},
})
minetest.register_node("farming:pumpkin", {
description = "Pumpkin",
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
groups = {choppy=2, oddly_breakable_by_hand=2},
stack_max = 64,
on_punch = function(pos, node, puncher)
node.name = "farming:pumpkin_face"
minetest.env:set_node(pos, node)
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
if math.random(1, 5) == 1 then
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
end
end
})
farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20)
minetest.register_node("farming:pumpkin_face", {
description = "Pumpkin Face",
stack_max = 64,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
})
minetest.register_node("farming:pumpkin_face_light", {
description = "Jack O' Lantern",
stack_max = 64,
paramtype2 = "facedir",
light_source = LIGHT_MAX,
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:pumpkin_face_light",
recipe = {"farming:pumpkin_face", "default:torch"}
})
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin_seed",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin",
burntime = 5
})
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin_face",
burntime = 5
})
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin_face_light",
burntime = 7
})