2019-08-28 17:31:41 +02:00
|
|
|
local S = minetest.get_translator("farming")
|
2017-05-17 17:57:14 +02:00
|
|
|
--
|
|
|
|
-- Nodes
|
|
|
|
--
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:wheat_1",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Wheat Seed"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_wheat_1.png"},
|
2015-10-03 23:21:41 +02:00
|
|
|
inventory_image = "farming_wheat_seed.png",
|
|
|
|
wield_image = "farming_wheat_seed.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:wheat"}, rarity = 3}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, seed=1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:wheat_2",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Wheat Plant (stage 1)"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_wheat_2.png"},
|
2019-09-24 00:42:24 +02:00
|
|
|
inventory_image = "farming_wheat_2.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:wheat"}, rarity = 2}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, not_in_craft_guide = 1, not_in_creative_inventory = 1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:wheat_3",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Wheat Plant (stage 2)"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_wheat_3.png"},
|
2019-09-24 00:42:24 +02:00
|
|
|
inventory_image = "farming_wheat_3.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:wheat"}, rarity = 1}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, not_in_craft_guide = 1, not_in_creative_inventory = 1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:wheat_4",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Wheat Plant (stage 3)"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_wheat_4.png"},
|
2019-09-24 00:42:24 +02:00
|
|
|
inventory_image = "farming_wheat_4.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:wheat"}, rarity = 1},
|
|
|
|
{items = {"farming:wheat 2"}, rarity = 4},
|
|
|
|
{items = {"farming:wheat_1"}, rarity = 1},
|
|
|
|
{items = {"farming:wheat_1"}, rarity = 2},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, not_in_craft_guide = 1, not_in_creative_inventory = 1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:cotton_1",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Cotton Seed"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_cotton_1.png"},
|
2015-10-03 23:21:41 +02:00
|
|
|
inventory_image = "farming_cotton_seed.png",
|
|
|
|
wield_image = "farming_cotton_seed.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:cotton"}, rarity = 3}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, seed=1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:cotton_2",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Cotton Plant (stage 1)"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_cotton_2.png"},
|
2019-09-24 00:42:24 +02:00
|
|
|
inventory_image = "farming_cotton_2.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:cotton"}, rarity = 2}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, not_in_craft_guide = 1, not_in_creative_inventory = 1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:cotton_3",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Cotton Plant (stage 2)"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_cotton_3.png"},
|
2019-09-24 00:42:24 +02:00
|
|
|
inventory_image = "farming_cotton_3.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:cotton"}, rarity = 1}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, not_in_craft_guide = 1, not_in_creative_inventory = 1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults()
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:cotton_4",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Cotton Plant (stage 3)"),
|
2015-09-01 17:15:24 +02:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"farming_cotton_4.png"},
|
2019-09-24 00:42:24 +02:00
|
|
|
inventory_image = "farming_cotton_4.png",
|
2015-09-01 17:15:24 +02:00
|
|
|
paramtype = "light",
|
2015-09-01 18:07:56 +02:00
|
|
|
waving = 1,
|
2015-09-01 17:15:24 +02:00
|
|
|
walkable = false,
|
2019-09-06 15:51:59 +02:00
|
|
|
floodable = true,
|
2015-09-01 17:15:24 +02:00
|
|
|
buildable_to = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"farming:cotton"}, rarity = 1},
|
|
|
|
{items = {"farming:cotton 2"}, rarity = 4},
|
|
|
|
{items = {"farming:cotton_1"}, rarity = 1},
|
|
|
|
{items = {"farming:cotton_1"}, rarity = 2},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5}
|
|
|
|
},
|
2019-09-24 02:53:21 +02:00
|
|
|
groups = {snappy=3, handy=2, attached_node=1, not_in_craft_guide = 1, not_in_creative_inventory = 1},
|
2017-05-17 17:57:14 +02:00
|
|
|
sounds=default.node_sound_leaves_defaults(),
|
|
|
|
on_punch = function(pos, node, player)
|
2019-09-24 03:36:33 +02:00
|
|
|
local item = player:get_wielded_item()
|
|
|
|
local name = item:get_name()
|
2017-05-17 17:57:14 +02:00
|
|
|
|
2019-09-24 03:36:33 +02:00
|
|
|
if minetest.get_item_group(name, "shears") > 0 then
|
2017-07-04 18:48:25 +02:00
|
|
|
minetest.set_node(pos, {name = "farming:cotton_2"})
|
2017-05-17 17:57:14 +02:00
|
|
|
|
2017-07-04 18:48:25 +02:00
|
|
|
-- Drop some seeds
|
2017-05-17 17:57:14 +02:00
|
|
|
|
2017-07-04 18:48:25 +02:00
|
|
|
if math.random(1, 2) == 1 then
|
|
|
|
item_drop.drop_item(pos, "farming:cotton_1")
|
|
|
|
end
|
2017-05-17 17:57:14 +02:00
|
|
|
|
2017-07-04 18:48:25 +02:00
|
|
|
-- Drop an extra cotton ball
|
2017-05-17 17:57:14 +02:00
|
|
|
|
2017-07-04 18:48:25 +02:00
|
|
|
for i = 1, 2 do
|
|
|
|
if math.random(1, 4) == 1 then -- 25% chance of dropping 2x
|
|
|
|
item_drop.drop_item(pos, "farming:cotton 2")
|
|
|
|
else
|
|
|
|
item_drop.drop_item(pos, "farming:cotton")
|
2017-05-17 17:57:14 +02:00
|
|
|
end
|
|
|
|
end
|
2017-07-04 18:48:25 +02:00
|
|
|
|
2019-09-24 03:36:33 +02:00
|
|
|
-- Add wear
|
|
|
|
if not minetest.settings:get_bool("creative_mode") then
|
|
|
|
local def = item:get_definition()
|
|
|
|
item:add_wear(math.ceil(65536 / def.tool_capabilities.groupcaps.snappy.uses))
|
|
|
|
player:set_wielded_item(item)
|
|
|
|
end
|
|
|
|
|
2017-07-04 18:48:25 +02:00
|
|
|
-- Keep it growing
|
|
|
|
|
|
|
|
farming.begin_growing_plant(pos)
|
2017-05-17 17:57:14 +02:00
|
|
|
end
|
|
|
|
end,
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-09-01 17:15:24 +02:00
|
|
|
"farming:cotton_bale",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Cotton Bale"),
|
2015-09-01 17:15:24 +02:00
|
|
|
tiles ={"farming_cotton_bale.png"},
|
|
|
|
is_ground_content = false,
|
2017-05-17 17:57:14 +02:00
|
|
|
groups = {snappy = 2, oddly_breakable_by_hand = 3,
|
|
|
|
fall_damage_add_percent = -15, fuzzy = 1},
|
2015-09-01 17:15:24 +02:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2017-07-04 18:48:25 +02:00
|
|
|
}
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_alias("farming:cotton_seed", "farming:cotton_1")
|
|
|
|
minetest.register_alias("farming:wheat_seed", "farming:wheat_1")
|
2015-10-03 23:21:41 +02:00
|
|
|
|
2017-05-17 17:57:14 +02:00
|
|
|
default.log("nodes", "loaded")
|