farlands/mods/fruit/init.lua

415 lines
10 KiB
Lua
Raw Normal View History

2017-07-26 09:47:22 +10:00
minetest.register_node("fruit:leaves_with_mango", {
description = "Leaves with Mango",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
2017-07-26 09:47:22 +10:00
tiles = {
"default_jungleleaves.png^fruit_mango_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_jungleleaves_simple.png^fruit_mango_leaves.png"},
2017-07-26 09:47:22 +10:00
paramtype = "light",
2017-08-31 10:23:13 +10:00
waving = 1,
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
2017-07-26 09:47:22 +10:00
drop = "default:jungleleaves",
on_destruct = function(pos)
minetest.add_item(pos, "fruit:mango")
end,
sounds = default.node_sound_leaves_defaults()
})
minetest.override_item("default:apple", {
description = "Leaves with Apple",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
tiles = {
"default_leaves.png^fruit_apple_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_leaves_simple.png^fruit_apple_leaves.png"},
paramtype = "light",
2017-08-31 10:23:13 +10:00
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
drop = "default:leaves",
2017-08-31 10:23:13 +10:00
waving = 1,
on_destruct = function(pos)
minetest.add_item(pos, "fruit:apple")
end,
2017-08-31 10:23:13 +10:00
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("fruit:apple", {
description = "Apple",
drawtype = "plantlike",
tiles = {
"default_apple.png",
},
2017-08-31 10:23:13 +10:00
inventory_image = "default_apple.png",
wield_image = "default_apple.png",
paramtype = "light",
groups = {snappy=1, oddly_breakable_by_hand=1},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("fruit:cactus_fruit", {
description = "Cactus Fruit",
drawtype = "plantlike",
tiles = {
"fruit_cactus.png",
},
paramtype = "light",
groups = {fleshy=1, oddly_breakable_by_hand=1,},
inventory_image = "fruit_cactus_inv.png",
2017-08-29 09:40:45 +10:00
wield_image = "fruit_cactus_inv.png",
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.4, -0.3, 0.3, -0.5, 0.3},
}
},
collision_box = {
type = "fixed",
fixed = {
{-0.3, -0.4, -0.3, 0.3, -0.5, 0.3},
}
},
on_use = minetest.item_eat(2)
})
2017-07-26 09:47:22 +10:00
minetest.register_node("fruit:leaves_with_berry", {
description = "Leaves with Berry",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
2017-07-26 09:47:22 +10:00
tiles = {
"default_leaves_simple.png^fruit_berry_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_leaves_simple.png^fruit_berry_leaves.png"},
2017-07-26 09:47:22 +10:00
paramtype = "light",
2017-08-31 10:23:13 +10:00
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
2017-07-26 09:47:22 +10:00
drop = "default:bush_leaves",
on_destruct = function(pos)
minetest.add_item(pos, "fruit:berry")
end,
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("fruit:leaves_with_pear", {
description = "Leaves with Pear",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
2017-07-26 09:47:22 +10:00
tiles = {
"default_leaves.png^fruit_pear_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_leaves_simple.png^fruit_pear_leaves.png"},
2017-07-26 09:47:22 +10:00
paramtype = "light",
2017-08-31 10:23:13 +10:00
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
2017-07-26 09:47:22 +10:00
drop = "default:leaves",
2017-08-31 10:23:13 +10:00
waving = 1,
2017-07-26 09:47:22 +10:00
on_destruct = function(pos)
minetest.add_item(pos, "fruit:pear")
end,
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("fruit:leaves_with_plum", {
description = "Leaves with Plum",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
2017-07-26 09:47:22 +10:00
tiles = {
"default_leaves.png^fruit_plum_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_leaves_simple.png^fruit_plum_leaves.png"},
2017-07-26 09:47:22 +10:00
paramtype = "light",
2017-08-31 10:23:13 +10:00
waving = 1,
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
2017-07-26 09:47:22 +10:00
drop = "default:leaves",
on_destruct = function(pos)
minetest.add_item(pos, "fruit:plum")
end,
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("fruit:leaves_with_peach", {
description = "Leaves with Peach",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
2017-07-26 09:47:22 +10:00
tiles = {
"default_leaves.png^fruit_peach_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_leaves_simple.png^fruit_peach_leaves.png"},
2017-07-26 09:47:22 +10:00
paramtype = "light",
2017-08-31 10:23:13 +10:00
waving = 1,
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
2017-07-26 09:47:22 +10:00
drop = "default:leaves",
on_destruct = function(pos)
minetest.add_item(pos, "fruit:peach")
end,
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("fruit:leaves_with_orange", {
description = "Leaves with Orange",
2017-08-31 10:23:13 +10:00
drawtype = "allfaces_optional",
2017-07-26 09:47:22 +10:00
tiles = {
"default_acacia_leaves.png^fruit_orange_leaves.png",
},
2017-08-31 10:23:13 +10:00
special_tiles = {"default_leaves_simple.png^fruit_orange_leaves.png"},
2017-07-26 09:47:22 +10:00
paramtype = "light",
2017-08-31 10:23:13 +10:00
waving = 1,
groups = {snappy=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, leaves = 1},
2017-07-26 09:47:22 +10:00
drop = "default:acacia_leaves",
on_destruct = function(pos)
minetest.add_item(pos, "fruit:orange")
end,
sounds = default.node_sound_leaves_defaults()
})
2017-08-31 10:23:13 +10:00
minetest.register_node("fruit:palm_leaves_coconut", {
description = "Palm Leaves (coconut)",
drawtype = "allfaces_optional",
paramtype = "light",
tiles = {
"fruit_palmleaves_coconut.png",
},
special_tiles = {"fruit_palmleaves_coconut.png"},
waving = 1,
groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 1, dig_immediate = 1, leaves = 1, leafdecay = 3,},
sounds = default.node_sound_leaves_defaults(),
on_destruct = function(pos, oldnode)
minetest.env:add_item(pos, "fruit:coconut")
end,
})
minetest.register_craftitem("fruit:coconut", {
description = "Coconut",
inventory_image = "fruit_coconut.png",
on_use = function(itemstack, placer, pointed_thing)
if pointed_thing.under == nil then
return
end
local item = minetest.get_node(pointed_thing.under).name
if minetest.get_item_group(item, "cracky") ~= 0 then
itemstack:take_item()
minetest.env:add_item(pointed_thing.above, "fruit:coconut_open")
end
return itemstack
end,
})
minetest.register_craftitem("fruit:coconut_open", {
description = "Cracked Coconut",
inventory_image = "fruit_coconut_opened.png",
on_use = minetest.item_eat(2)
})
2017-07-26 09:47:22 +10:00
minetest.register_craftitem("fruit:pear", {
description = "Pear",
inventory_image = "fruit_pear.png",
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("fruit:plum", {
description = "Plum",
inventory_image = "fruit_plum.png",
on_use = minetest.item_eat(1)
})
minetest.register_craftitem("fruit:peach", {
description = "Peach",
inventory_image = "fruit_peach.png",
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("fruit:orange", {
description = "Orange",
inventory_image = "fruit_orange.png",
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("fruit:berry", {
description = "Berry",
inventory_image = "fruit_berry.png",
on_use = minetest.item_eat(1)
})
minetest.register_craftitem("fruit:mango", {
description = "Mango",
inventory_image = "fruit_mango.png",
on_use = minetest.item_eat(2)
})
fruit = {}
function fruit.register_ores()
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:leaves_with_orange",
wherein = "default:acacia_leaves",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
2017-09-07 18:39:25 +10:00
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:palm_leaves_coconut",
wherein = "mapgen:palm_leaves",
clust_scarcity = 5 * 5 * 5,
clust_num_ores = 4,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
2017-07-26 09:47:22 +10:00
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:leaves_with_berry",
wherein = "default:bush_leaves",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:leaves_with_mango",
wherein = "default:jungleleaves",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:leaves_with_peach",
wherein = "default:leaves",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:apple",
wherein = "default:leaves",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
2017-07-26 09:47:22 +10:00
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:leaves_with_pear",
wherein = "default:leaves",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
minetest.register_ore({
ore_type = "scatter",
ore = "fruit:leaves_with_plum",
wherein = "default:leaves",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 6,
clust_size = 4,
y_min = 0,
y_max = 31000,
noise_params = {
offset = 0.5,
scale = 1,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
end
minetest.register_abm({
nodenames = {"default:cactus",},
interval = 30,
chance = 50,
action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then
minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="fruit:cactus_fruit"})
end
end,
})