mckaygerhard 2f9a385fc5 farming - 3d_apple : backported the try to fix undesired behaviour..
* https://github.com/C-C-Minetest-Server/3d_apple/issues/2
* https://github.com/C-C-Minetest-Server/3d_apple/issues/3
* backported bf48dbd72f
* i cannot found the way to made the node non buildable
  without using the drawtype = "planlike" unless we can provide
  another parameter to selection_box or `on_use`
  i did `on_use =  minetest.item_eat(2)` but still when make
  such action just dig in the ground
2023-06-08 01:32:49 -04:00

179 lines
3.7 KiB
Lua

-- Global farming namespace
farming = {}
farming.path = minetest.get_modpath("farming")
-- Load files
dofile(farming.path .. "/api.lua")
dofile(farming.path .. "/nodes.lua")
dofile(farming.path .. "/hoes.lua")
-- WHEAT
farming.register_plant("farming:wheat", {
description = "Wheat Seed",
paramtype2 = "meshoptions",
inventory_image = "farming_wheat_seed.png",
steps = 8,
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"},
groups = {flammable = 4},
place_param2 = 3,
})
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
groups = {flammable = 1},
})
minetest.register_craftitem("farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(5),
groups = {flammable = 2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
-- Cotton
farming.register_plant("farming:cotton", {
description = "Cotton Seed",
inventory_image = "farming_cotton_seed.png",
steps = 8,
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland", "desert"},
groups = {flammable = 4},
})
minetest.register_craftitem("farming:string", {
description = "String",
inventory_image = "farming_string.png",
groups = {flammable = 2},
})
minetest.register_craft({
output = "wool:white",
recipe = {
{"farming:cotton", "farming:cotton"},
{"farming:cotton", "farming:cotton"},
}
})
minetest.register_craft({
output = "farming:string 2",
recipe = {
{"farming:cotton"},
{"farming:cotton"},
}
})
-- Straw
minetest.register_craft({
output = "farming:straw 3",
recipe = {
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
}
})
minetest.register_craft({
output = "farming:wheat 3",
recipe = {
{"farming:straw"},
}
})
-- Fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:straw",
burntime = 3,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:wheat",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:cotton",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:string",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:hoe_wood",
burntime = 5,
})
local box = {
type = "fixed",
fixed = {
{-0.1875, -0.4375, -0.1875, 0.1875, 0.0625, 0.1875}, -- Bottom
{-0.25, -0.375, -0.25, 0.25, 0, 0.25}, -- Middle
-- {-0.1875, 0.0625, -0.1875, 0.1875, 0, 0.1875}, -- Top
{-0.0625, 0.0625, -0.0625, 0, 0.125, 0}, -- NodeBox4
{0.0625, 0.0625, 0.0625, 0, 0.125, 0}, -- NodeBox5
{0.0625, 0.125, -0.0625, 0, 0.1875, 0}, -- NodeBox4
{-0.0625, 0.125, 0.0625, 0, 0.1875, 0}, -- NodeBox5
}
}
minetest.override_item("default:apple",{
drawtype = "nodebox",
paramtype = "light",
tiles = { -- +Y, -Y, +X, -X, +Z, -Z
"apple_bottom.png^apple_top_overlay.png",
"apple_bottom.png",
"apple_side.png",
"apple_side.png",
"apple_side.png",
"apple_side.png",
},
node_box = box,
inventory_image = "default_apple.png",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
selection_box = box,
groups = {fleshy = 3, dig_immediate = 3, flammable = 2, leafdecay = 3, leafdecay_drop = 1},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
after_place_node = function(pos, placer, itemstack)
minetest.set_node(pos, {name = "default:apple", param2 = 1})
end,
})