MineClone2/mods/ITEMS/mcl_sweet_berry/init.lua

136 lines
4.2 KiB
Lua

minetest.register_craftitem("mcl_sweet_berry:sweet_berry", {
description = "Sweet Berry",
inventory_image = "sweet_berry.png",
on_use = minetest.item_eat(2),
on_place = nil --TODO
})
for i=1, 4 do
local texture = "sweet_berry_bush_"..i..".png"
local height = 0.5
local create, name, longdesc
if i == 1 then
height = 0
create = true
name = "Premature Berry Bush"
longdesc = S("Berry Bushes are bushes which grow on any type of dirt and have 4 stages of growth. They can be harvested at any time but will only yield a profit when in its 3rd or 4th growth stage.")
else
create = false
end
minetest.register_node("mcl_sweet_berry:sweet_berry_bush_"..i, {
description = "Premature Berry Bush (Stage "..i..")"
_doc_items_create_entry = create,
_doc_items_entry_name = name,
_doc_items_longdesc = longdesc,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "meshoptions",
place_param2 = 3,
liquid_viscosity = 12, -- any idea what it should actually be?
liquidtype = "source",
liquid_alternative_flowing = "mcl_sweet_berry:sweet_berry_bush_"..i,
liquid_alternative_source = "mcl_sweet_berry:sweet_berry_bush_"..i,
liquid_renewable = false,
liquid_range = 0,
walkable = false,
drawtype = "plantlike",
drop = "mcl_sweet_berry:sweet_berry",
tiles = {texture},
inventory_image = texture,
wield_image = texture,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, height, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
end
--[[
minetest.register_node("mcl_sweet_berry:sweet_berry_bush_0", {
drawtype = "plantlike",
tiles = {"sweet_berry_bush_0.png"},
damage_per_second = 1,
selection_box = {
type = "fixed",
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
},
drop = ""
})
minetest.register_node("mcl_sweet_berry:sweet_berry_bush_1", {
drawtype = "plantlike",
tiles = {"sweet_berry_bush_1.png"},
damage_per_second = 1,
selection_box = {
type = "fixed",
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
},
drop = ""
})
minetest.register_node("mcl_sweet_berry:sweet_berry_bush_2", {
drawtype = "plantlike",
tiles = {"sweet_berry_bush_2.png"},
damage_per_second = 2,
selection_box = {
type = "fixed",
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
},
drop = "mc:sweet_berry 2"
})
minetest.register_node("mcl_sweet_berry:sweet_berry_bush_3", {
drawtype = "plantlike",
tiles = {"sweet_berry_bush_3.png"},
damage_per_second = 2,
selection_box = {
type = "fixed",
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
},
drop = "mc:sweet_berry 3"
})
--]]
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_core:dirt_with_grass","mcl_core:podzol","mcl_core:dirt"},
sidelen = 16,
fill_ratio = 0.1,
biomes = {"Taiga","Forest"},
y_max = mcl_vars.mg_overworld_max,
y_min = mcl_vars.mg_overworld_min,
decoration = "mcl_sweet_berry:sweet_berry_bush_4"
})
minetest.register_abm({
nodenames = {"mcl_sweet_berry:sweet_berry_bush_1"},
interval = 10.0,
chance = 16,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "mcl_sweet_berry:sweet_berry_bush_2"})
end
})
minetest.register_abm({
nodenames = {"mcl_sweet_berry:sweet_berry_bush_2"},
interval = 10.0,
chance = 16,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "mcl_sweet_berry:sweet_berry_bush_3"})
end
})
minetest.register_abm({
nodenames = {"mcl_sweet_berry:sweet_berry_bush_3"},
interval = 10.0,
chance = 16,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "mcl_sweet_berry:sweet_berry_bush_4"})
end
})
--taken from mc modpack by TechDude/TechDudie