Code tidy and tweak

This commit is contained in:
TenPlus1 2015-07-05 10:54:18 +01:00
parent 6e4fa56475
commit 16cc62a1d4
23 changed files with 622 additions and 352 deletions

View File

@ -44,19 +44,28 @@ minetest.register_node("farming:beanpole", {
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beanpole'},rarity=1}, {items = {'farming:beanpole'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local nod = minetest.get_node_or_nil(pointed_thing.under) local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and minetest.get_item_group(nod.name, "soil") < 2 then return end if nod and minetest.get_item_group(nod.name, "soil") < 2 then
local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z} return
end
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}
nod = minetest.get_node_or_nil(top) nod = minetest.get_node_or_nil(top)
if nod and nod.name ~= "air" then return end if nod and nod.name ~= "air" then return end
minetest.set_node(pointed_thing.above, {name="farming:beanpole"}) minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
@ -85,11 +94,14 @@ minetest.register_node("farming:beanpole_1", {
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beanpole'},rarity=1}, {items = {'farming:beanpole'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=3,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -103,11 +115,14 @@ minetest.register_node("farming:beanpole_2", {
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beanpole'},rarity=1}, {items = {'farming:beanpole'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -121,11 +136,14 @@ minetest.register_node("farming:beanpole_3", {
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beanpole'},rarity=1}, {items = {'farming:beanpole'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -140,35 +158,40 @@ minetest.register_node("farming:beanpole_4", {
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beanpole'},rarity=1}, {items = {'farming:beanpole'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Green Bean growth does not have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:beanpole_5", { minetest.register_node("farming:beanpole_5", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_beanpole_5.png"}, tiles = {"farming_beanpole_5.png"},
visual_scale = 1.45, visual_scale = 1.45,
paramtype = "light", paramtype = "light",
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beanpole'},rarity=1}, {items = {'farming:beanpole'}, rarity = 1},
{items = {'farming:beans 3'},rarity=1}, {items = {'farming:beans 3'}, rarity = 1},
{items = {'farming:beans 2'},rarity=2}, {items = {'farming:beans 2'}, rarity = 2},
{items = {'farming:beans 2'},rarity=3}, {items = {'farming:beans 2'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -184,12 +207,15 @@ minetest.register_node("farming:beanbush", {
sunlight_propagates = true, sunlight_propagates = true,
drop = { drop = {
items = { items = {
{items = {'farming:beans 1'},rarity=1}, {items = {'farming:beans 1'}, rarity = 1},
{items = {'farming:beans 1'},rarity=2}, {items = {'farming:beans 1'}, rarity = 2},
{items = {'farming:beans 1'},rarity=3}, {items = {'farming:beans 1'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -32,12 +32,14 @@ minetest.register_node("farming:blueberry_1", {
tiles = {"farming_blueberry_1.png"}, tiles = {"farming_blueberry_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -50,8 +52,11 @@ minetest.register_node("farming:blueberry_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -64,12 +69,15 @@ minetest.register_node("farming:blueberry_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Blueberry growth does not have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:blueberry_4", { minetest.register_node("farming:blueberry_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -79,15 +87,17 @@ minetest.register_node("farming:blueberry_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:blueberries 2'},rarity=1}, {items = {'farming:blueberries 2'}, rarity = 1},
{items = {'farming:blueberries'},rarity=2}, {items = {'farming:blueberries'}, rarity = 2},
{items = {'farming:blueberries'},rarity=3}, {items = {'farming:blueberries'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -22,7 +22,7 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
end end
-- add the node and remove 1 item from the itemstack -- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname}) minetest.add_node(pt.above, {name = plantname})
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
@ -85,11 +85,17 @@ minetest.register_node("farming:cocoa_1", {
walkable = true, walkable = true,
drop = { drop = {
items = { items = {
{items = {'farming:cocoa_beans 1'},rarity=2}, {items = {'farming:cocoa_beans 1'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},}, selection_box = {
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1}, type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -100,11 +106,17 @@ minetest.register_node("farming:cocoa_2", {
walkable = true, walkable = true,
drop = { drop = {
items = { items = {
{items = {'farming:cocoa_beans 1'},rarity=1}, {items = {'farming:cocoa_beans 1'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},}, selection_box = {
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1}, type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -117,12 +129,18 @@ minetest.register_node("farming:cocoa_3", {
walkable = true, walkable = true,
drop = { drop = {
items = { items = {
{items = {'farming:cocoa_beans 2'},rarity=1}, {items = {'farming:cocoa_beans 2'}, rarity = 1},
{items = {'farming:cocoa_beans 1'},rarity=2}, {items = {'farming:cocoa_beans 1'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},}, selection_box = {
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1}, type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -144,10 +162,15 @@ minetest.register_abm({
else return else return
end end
if minetest.get_node(pos).name == "air" and minetest.get_node_light(pos) > 12 then local nod = minetest.get_node_or_nil(pos)
-- print ("COCOA", pos.x, pos.y, pos.z) if nod then nod = nod.name else return end
minetest.set_node(pos,{name="farming:cocoa_"..tostring(math.random(1,3))})
end
if nod == "air"
and minetest.get_node_light(pos) > 12 then
-- print ("COCOA", pos.x, pos.y, pos.z)
minetest.set_node(pos, {
name = "farming:cocoa_"..tostring(math.random(1, 3))
})
end
end, end,
}) })

View File

@ -27,7 +27,7 @@ minetest.register_node("farming:drinking_cup", {
type = "fixed", type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
}, },
groups = {vessel=1,dig_immediate=3,attached_node=1}, groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
@ -58,7 +58,7 @@ minetest.register_node("farming:coffee_cup", {
type = "fixed", type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
}, },
groups = {vessel=1,dig_immediate=3,attached_node=1}, groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
on_use = minetest.item_eat(2, "farming:drinking_cup"), on_use = minetest.item_eat(2, "farming:drinking_cup"),
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
@ -99,7 +99,7 @@ minetest.register_node("farming:coffee_cup_hot", {
type = "fixed", type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
}, },
groups = {vessel=1,dig_immediate=3,attached_node=1}, groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
on_use = minetest.item_eat(3, "farming:drinking_cup"), on_use = minetest.item_eat(3, "farming:drinking_cup"),
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
@ -111,12 +111,14 @@ minetest.register_node("farming:coffee_1", {
tiles = {"farming_coffee_1.png"}, tiles = {"farming_coffee_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -129,8 +131,11 @@ minetest.register_node("farming:coffee_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -143,8 +148,11 @@ minetest.register_node("farming:coffee_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -157,12 +165,15 @@ minetest.register_node("farming:coffee_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Coffee growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth doesn not have growing group so abm never checks these
minetest.register_node("farming:coffee_5", { minetest.register_node("farming:coffee_5", {
drawtype = "plantlike", drawtype = "plantlike",
@ -172,15 +183,17 @@ minetest.register_node("farming:coffee_5", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:coffee_beans 2'},rarity=1}, {items = {'farming:coffee_beans 2'}, rarity = 1},
{items = {'farming:coffee_beans 2'},rarity=2}, {items = {'farming:coffee_beans 2'}, rarity = 2},
{items = {'farming:coffee_beans 2'},rarity=3}, {items = {'farming:coffee_beans 2'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -58,8 +58,11 @@ minetest.register_node("farming:corn_1", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -71,8 +74,11 @@ minetest.register_node("farming:corn_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -85,8 +91,11 @@ minetest.register_node("farming:corn_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -99,8 +108,11 @@ minetest.register_node("farming:corn_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -108,12 +120,16 @@ minetest.register_node("farming:corn_5", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_corn_5.png"}, tiles = {"farming_corn_5.png"},
paramtype = "light", paramtype = "light",
waving = 1,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -122,12 +138,16 @@ minetest.register_node("farming:corn_6", {
tiles = {"farming_corn_6.png"}, tiles = {"farming_corn_6.png"},
visual_scale = 1.45, visual_scale = 1.45,
paramtype = "light", paramtype = "light",
waving = 1,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -136,22 +156,25 @@ minetest.register_node("farming:corn_7", {
tiles = {"farming_corn_7.png"}, tiles = {"farming_corn_7.png"},
visual_scale = 1.45, visual_scale = 1.45,
paramtype = "light", paramtype = "light",
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:corn'},rarity=1}, {items = {'farming:corn'}, rarity = 1},
{items = {'farming:corn'},rarity=2}, {items = {'farming:corn'}, rarity = 2},
{items = {'farming:corn'},rarity=3}, {items = {'farming:corn'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Corn growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth doesn not have growing group so abm never checks these
minetest.register_node("farming:corn_8", { minetest.register_node("farming:corn_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -161,15 +184,17 @@ minetest.register_node("farming:corn_8", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:corn 2'},rarity=1}, {items = {'farming:corn 2'}, rarity = 1},
{items = {'farming:corn 2'},rarity=2}, {items = {'farming:corn 2'}, rarity = 2},
{items = {'farming:corn 2'},rarity=2}, {items = {'farming:corn 2'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -19,7 +19,7 @@ minetest.register_node("farming:seed_cotton", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
sunlight_propagates = true, sunlight_propagates = true,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
end, end,
@ -51,12 +51,14 @@ minetest.register_node("farming:cotton_1", {
tiles = {"farming_cotton_1.png"}, tiles = {"farming_cotton_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -65,12 +67,14 @@ minetest.register_node("farming:cotton_2", {
tiles = {"farming_cotton_2.png"}, tiles = {"farming_cotton_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -83,8 +87,11 @@ minetest.register_node("farming:cotton_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -97,8 +104,11 @@ minetest.register_node("farming:cotton_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -112,11 +122,14 @@ minetest.register_node("farming:cotton_5", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {"farming:seed_cotton"},rarity=1}, {items = {"farming:seed_cotton"}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -129,12 +142,15 @@ minetest.register_node("farming:cotton_6", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {"farming:cotton"},rarity=1}, {items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"},rarity=2}, {items = {"farming:cotton"}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -147,18 +163,21 @@ minetest.register_node("farming:cotton_7", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {"farming:cotton"},rarity=1}, {items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"},rarity=2}, {items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"},rarity=1}, {items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"},rarity=2}, {items = {"farming:seed_cotton"}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Define last stage of Cotton growth separate and without growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:cotton_8", { minetest.register_node("farming:cotton_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -169,15 +188,18 @@ minetest.register_node("farming:cotton_8", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {"farming:string"},rarity=1}, {items = {"farming:string"}, rarity = 1},
{items = {"farming:string"},rarity=2}, {items = {"farming:string"}, rarity = 2},
{items = {"farming:string"},rarity=3}, {items = {"farming:string"}, rarity = 3},
{items = {"farming:seed_cotton"},rarity=1}, {items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"},rarity=2}, {items = {"farming:seed_cotton"}, rarity = 2},
{items = {"farming:seed_cotton"},rarity=3}, {items = {"farming:seed_cotton"}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -17,12 +17,14 @@ minetest.register_node("farming:cucumber_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"}, tiles = {"farming_cucumber_1.png"},
paramtype = "light", paramtype = "light",
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -34,8 +36,11 @@ minetest.register_node("farming:cucumber_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -47,12 +52,15 @@ minetest.register_node("farming:cucumber_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Cucumber growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:cucumber_4", { minetest.register_node("farming:cucumber_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -61,14 +69,16 @@ minetest.register_node("farming:cucumber_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:cucumber'},rarity=1}, {items = {'farming:cucumber'}, rarity = 1},
{items = {'farming:cucumber 2'},rarity=2}, {items = {'farming:cucumber 2'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -7,7 +7,7 @@ for i=1,5 do
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
{items = {'farming:seed_wheat'},rarity = 5}, {items = {'farming:seed_wheat'}, rarity = 5},
{items = {'default:grass_1'}}, {items = {'default:grass_1'}},
} }
}, },
@ -21,7 +21,7 @@ minetest.override_item("default:junglegrass", {
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
{items = {'farming:seed_cotton'},rarity = 8}, {items = {'farming:seed_cotton'}, rarity = 8},
{items = {'default:junglegrass'}}, {items = {'default:junglegrass'}},
} }
}, },

View File

@ -55,7 +55,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
return return
end end
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} local p = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z}
local above = minetest.get_node(p) local above = minetest.get_node(p)
-- return if any of the nodes is not registered -- return if any of the nodes is not registered
@ -75,9 +75,9 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
end end
-- turn the node into soil, wear out item and play sound -- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name="farming:soil"}) minetest.set_node(pt.under, {name = "farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,}) minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5})
itemstack:add_wear(65535/(uses-1)) itemstack:add_wear(65535/(uses - 1))
return itemstack return itemstack
end end

View File

@ -1,5 +1,5 @@
--[[ --[[
Minetest Farming Redo Mod 1.20 (20th May 2015) Minetest Farming Redo Mod 1.20 (5th July 2015)
by TenPlus1 by TenPlus1
NEW growing routine by prestidigitator NEW growing routine by prestidigitator
]] ]]
@ -8,6 +8,10 @@ farming = {}
farming.mod = "redo" farming.mod = "redo"
farming.path = minetest.get_modpath("farming") farming.path = minetest.get_modpath("farming")
farming.hoe_on_use = default.hoe_on_use farming.hoe_on_use = default.hoe_on_use
farming.select = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
}
farming.DEBUG = false farming.DEBUG = false
-- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions -- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions
@ -38,7 +42,6 @@ if farming.DEBUG then
timer_avg.."µs/run") timer_avg.."µs/run")
print("Total farming time: "..dt.."µs") print("Total farming time: "..dt.."µs")
end end
else
end end
local statistics = dofile(farming.path.."/statistics.lua") local statistics = dofile(farming.path.."/statistics.lua")
@ -68,7 +71,7 @@ dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility
-- Utility Functions -- Utility Functions
local time_speed = tonumber(minetest.setting_get("time_speed")) or 72 local time_speed = tonumber(minetest.setting_get("time_speed")) or 72
local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60/time_speed) or nil local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or nil
local function clamp(x, min, max) local function clamp(x, min, max)
return (x < min and min) or (x > max and max) or x return (x < min and min) or (x > max and max) or x
@ -214,7 +217,12 @@ local function reg_plant_stages(plant_name, stage, force_last)
local ns = reg_plant_stages(plant_name, stage + 1, true) local ns = reg_plant_stages(plant_name, stage + 1, true)
local stages_left = (ns and { ns.name, unpack(ns.stages_left) }) or {} local stages_left = (ns and { ns.name, unpack(ns.stages_left) }) or {}
stages = { plant_name = plant_name, name = node_name, stage = stage, stages_left = stages_left } stages = {
plant_name = plant_name,
name = node_name,
stage = stage,
stages_left = stages_left
}
if #stages_left > 0 then if #stages_left > 0 then
local old_constr = node_def.on_construct local old_constr = node_def.on_construct
@ -237,7 +245,12 @@ local function reg_plant_stages(plant_name, stage, force_last)
}) })
end end
elseif force_last then elseif force_last then
stages = { plant_name = plant_name, name = node_name, stage = stage, stages_left = {} } stages = {
plant_name = plant_name,
name = node_name,
stage = stage,
stages_left = {}
}
else else
return nil return nil
end end
@ -378,7 +391,6 @@ if farming.DEBUG then
end end
end end
-- Place Seeds on Soil -- Place Seeds on Soil
function farming.place_seed(itemstack, placer, pointed_thing, plantname) function farming.place_seed(itemstack, placer, pointed_thing, plantname)
@ -393,7 +405,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local above = minetest.get_node(pt.above) local above = minetest.get_node(pt.above)
-- check if pointing at the top of the node -- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then if pt.above.y ~= pt.under.y + 1 then
return return
end end
@ -420,7 +432,6 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
end end
end end
-- Function to register plants (for compatibility) -- Function to register plants (for compatibility)
farming.register_plant = function(name, def) farming.register_plant = function(name, def)
@ -450,7 +461,7 @@ farming.register_plant = function(name, def)
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
sunlight_propagates = true, sunlight_propagates = true,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1")
end end
@ -489,7 +500,7 @@ farming.register_plant = function(name, def)
buildable_to = true, buildable_to = true,
is_ground_content = true, is_ground_content = true,
drop = drop, drop = drop,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = g, groups = g,
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -503,8 +514,7 @@ end
--[[ Cotton (example, is already registered in cotton.lua) --[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", { farming.register_plant("farming:cotton", {
description = "Cotton seed", description = "Cotton2 seed",
inventory_image = "farming_cotton_seed.png", inventory_image = "farming_cotton_seed.png",
steps = 8, steps = 8,
}) })]]
--]]

View File

@ -9,7 +9,7 @@ local function register_plant(name, min, max, spawnby, num)
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 0.006, scale = 0.006,
spread = {x=100, y=100, z=100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 329,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
@ -38,9 +38,8 @@ function farming.register_mgv6_decorations()
register_plant("beanbush", 18, 35, "", -1) register_plant("beanbush", 18, 35, "", -1)
end end
-- enable in mapgen v6 only -- enable in v6 mapgen only
local mg_params = minetest.get_mapgen_params() if minetest.get_mapgen_params().mgname == "v6" then
if mg_params.mgname == "v6" then
farming.register_mgv6_decorations() farming.register_mgv6_decorations()
end end

View File

@ -33,12 +33,14 @@ minetest.register_node("farming:melon_1", {
tiles = {"farming_melon_1.png"}, tiles = {"farming_melon_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -47,12 +49,14 @@ minetest.register_node("farming:melon_2", {
tiles = {"farming_melon_2.png"}, tiles = {"farming_melon_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -65,8 +69,11 @@ minetest.register_node("farming:melon_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -79,8 +86,11 @@ minetest.register_node("farming:melon_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -93,8 +103,11 @@ minetest.register_node("farming:melon_5", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -105,8 +118,11 @@ minetest.register_node("farming:melon_6", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -117,12 +133,15 @@ minetest.register_node("farming:melon_7", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Melon growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:melon_8", { minetest.register_node("farming:melon_8", {
--drawtype = "nodebox", --drawtype = "nodebox",
@ -130,12 +149,11 @@ minetest.register_node("farming:melon_8", {
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}, tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"},
paramtype = "light", paramtype = "light",
walkable = true, walkable = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:melon_slice 9'},rarity=1}, {items = {'farming:melon_slice 9'}, rarity = 1},
} }
}, },
groups = {snappy=1,oddly_breakable_by_hand=1,flammable=2,plant=1}, groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })

View File

@ -35,8 +35,11 @@ minetest.register_node("farming:potato_1", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -49,8 +52,11 @@ minetest.register_node("farming:potato_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -62,19 +68,21 @@ minetest.register_node("farming:potato_3", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:potato'},rarity=1}, {items = {'farming:potato'}, rarity = 1},
{items = {'farming:potato'},rarity=3}, {items = {'farming:potato'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Potato growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:potato_4", { minetest.register_node("farming:potato_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -84,14 +92,16 @@ minetest.register_node("farming:potato_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:potato 2'},rarity=1}, {items = {'farming:potato 2'}, rarity = 1},
{items = {'farming:potato 3'},rarity=2}, {items = {'farming:potato 3'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -3,11 +3,18 @@
minetest.register_node("farming:pumpkin", { minetest.register_node("farming:pumpkin", {
description = "Pumpkin", description = "Pumpkin",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"}, tiles = {
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2,plant=1}, "farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png"
},
groups = {
choppy = 1, oddly_breakable_by_hand = 1,
flammable = 2, plant = 1
},
drop = { drop = {
items = { items = {
{items = {'farming:pumpkin_slice 9'},rarity=1}, {items = {'farming:pumpkin_slice 9'}, rarity = 1},
} }
}, },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
@ -41,9 +48,16 @@ minetest.register_craft({
-- Jack 'O Lantern -- Jack 'O Lantern
minetest.register_node("farming:jackolantern", { minetest.register_node("farming:jackolantern", {
description = "Jack 'O Lantern", description = "Jack 'O Lantern",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_off.png"}, tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_off.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2}, groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
node.name = "farming:jackolantern_on" node.name = "farming:jackolantern_on"
@ -53,10 +67,17 @@ minetest.register_node("farming:jackolantern", {
minetest.register_node("farming:jackolantern_on", { minetest.register_node("farming:jackolantern_on", {
description = "Jack 'O Lantern", description = "Jack 'O Lantern",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_on.png"}, tiles = {
light_source = 14, "farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_on.png"
},
light_source = default.LIGHT_MAX - 1,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2}, groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "farming:jackolantern", drop = "farming:jackolantern",
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
@ -110,8 +131,11 @@ minetest.register_node("farming:pumpkin_1", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -124,8 +148,11 @@ minetest.register_node("farming:pumpkin_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory =1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -138,8 +165,11 @@ minetest.register_node("farming:pumpkin_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -152,8 +182,11 @@ minetest.register_node("farming:pumpkin_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -166,8 +199,11 @@ minetest.register_node("farming:pumpkin_5", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -179,8 +215,11 @@ minetest.register_node("farming:pumpkin_6", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -191,12 +230,15 @@ minetest.register_node("farming:pumpkin_7", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Pumpkin growth does not have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:pumpkin_8", { minetest.register_node("farming:pumpkin_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -204,13 +246,15 @@ minetest.register_node("farming:pumpkin_8", {
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:pumpkin_slice 9'},rarity=1}, {items = {'farming:pumpkin_slice 9'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })

View File

@ -34,12 +34,14 @@ minetest.register_node("farming:raspberry_1", {
tiles = {"farming_raspberry_1.png"}, tiles = {"farming_raspberry_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -52,8 +54,11 @@ minetest.register_node("farming:raspberry_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -66,12 +71,15 @@ minetest.register_node("farming:raspberry_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Raspberry growth does not have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:raspberry_4", { minetest.register_node("farming:raspberry_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -81,15 +89,17 @@ minetest.register_node("farming:raspberry_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:raspberries 2'},rarity=1}, {items = {'farming:raspberries 2'}, rarity = 1},
{items = {'farming:raspberries'},rarity=2}, {items = {'farming:raspberries'}, rarity = 2},
{items = {'farming:raspberries'},rarity=3}, {items = {'farming:raspberries'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -32,12 +32,14 @@ minetest.register_node("farming:rhubarb_1", {
tiles = {"farming_rhubarb_1.png"}, tiles = {"farming_rhubarb_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -50,12 +52,15 @@ minetest.register_node("farming:rhubarb_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Rhubarb growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:rhubarb_3", { minetest.register_node("farming:rhubarb_3", {
drawtype = "plantlike", drawtype = "plantlike",
@ -65,15 +70,17 @@ minetest.register_node("farming:rhubarb_3", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:rhubarb 2'},rarity=1}, {items = {'farming:rhubarb 2'}, rarity = 1},
{items = {'farming:rhubarb'},rarity=2}, {items = {'farming:rhubarb'}, rarity = 2},
{items = {'farming:rhubarb'},rarity=3}, {items = {'farming:rhubarb'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -3,8 +3,7 @@ minetest.register_node("farming:soil", {
description = "Soil", description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"}, tiles = {"farming_soil.png", "default_dirt.png"},
drop = "default:dirt", drop = "default:dirt",
is_ground_content = true, groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -16,8 +15,7 @@ minetest.register_node("farming:soil_wet", {
description = "Wet Soil", description = "Wet Soil",
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"}, tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
drop = "default:dirt", drop = "default:dirt",
is_ground_content = true, groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet") minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet")
@ -29,13 +27,17 @@ minetest.register_abm({
chance = 4, chance = 4,
action = function(pos, node) action = function(pos, node)
local nn = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name pos.y = pos.y + 1
local nn = minetest.get_node_or_nil(pos)
pos.y = pos.y - 1
if nn then nn = nn.name else return end
-- what's on top of soil, if solid/not plant change soil to dirt -- what's on top of soil, if solid/not plant change soil to dirt
if minetest.registered_nodes[nn] if minetest.registered_nodes[nn]
and minetest.registered_nodes[nn].walkable and minetest.registered_nodes[nn].walkable
and minetest.get_item_group(nn, "plant") == 0 then and minetest.get_item_group(nn, "plant") == 0 then
minetest.set_node(pos, {name="default:dirt"}) minetest.set_node(pos, {name = "default:dirt"})
return return
end end
@ -47,12 +49,12 @@ minetest.register_abm({
-- check if there is water nearby and change soil accordingly -- check if there is water nearby and change soil accordingly
if minetest.find_node_near(pos, 3, {"group:water"}) then if minetest.find_node_near(pos, 3, {"group:water"}) then
if node.name == "farming:soil" then if node.name == "farming:soil" then
minetest.set_node(pos, {name="farming:soil_wet"}) minetest.set_node(pos, {name = "farming:soil_wet"})
end end
elseif node.name == "farming:soil_wet" then elseif node.name == "farming:soil_wet" then
minetest.set_node(pos, {name="farming:soil"}) minetest.set_node(pos, {name = "farming:soil"})
elseif node.name == "farming:soil" then elseif node.name == "farming:soil" then
minetest.set_node(pos, {name="default:dirt"}) minetest.set_node(pos, {name = "default:dirt"})
end end
end, end,
}) })

View File

@ -16,7 +16,7 @@ erf = function(x)
if x == 0 then return 0; end if x == 0 then return 0; end
local xSq = x * x local xSq = x * x
local aXSq = A * xSq local aXSq = A * xSq
local v = math.sqrt(1.0 - math.exp(-xSq * (B + aXSq)/(1.0 + aXSq))) local v = math.sqrt(1.0 - math.exp(-xSq * (B + aXSq) / (1.0 + aXSq)))
return (x > 0 and v) or -v return (x > 0 and v) or -v
end end

View File

@ -12,4 +12,3 @@ minetest.register_craft({
output = "farming:sugar 2", output = "farming:sugar 2",
recipe = "default:papyrus", recipe = "default:papyrus",
}) })

View File

@ -18,12 +18,14 @@ minetest.register_node("farming:tomato_1", {
tiles = {"farming_tomato_1.png"}, tiles = {"farming_tomato_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -32,12 +34,14 @@ minetest.register_node("farming:tomato_2", {
tiles = {"farming_tomato_2.png"}, tiles = {"farming_tomato_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -50,8 +54,11 @@ minetest.register_node("farming:tomato_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -64,8 +71,11 @@ minetest.register_node("farming:tomato_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -78,8 +88,11 @@ minetest.register_node("farming:tomato_5", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -92,8 +105,11 @@ minetest.register_node("farming:tomato_6", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -104,19 +120,21 @@ minetest.register_node("farming:tomato_7", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:tomato'},rarity=1}, {items = {'farming:tomato'}, rarity = 1},
{items = {'farming:tomato'},rarity=3}, {items = {'farming:tomato'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Carrot growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:tomato_8", { minetest.register_node("farming:tomato_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -125,14 +143,16 @@ minetest.register_node("farming:tomato_8", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:tomato 3'},rarity=1}, {items = {'farming:tomato 3'}, rarity = 1},
{items = {'farming:tomato 3'},rarity=2}, {items = {'farming:tomato 3'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -22,7 +22,7 @@ minetest.register_node("farming:seed_wheat", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
sunlight_propagates = true, sunlight_propagates = true,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
end, end,
@ -41,7 +41,7 @@ minetest.register_node("farming:straw", {
description = "Straw", description = "Straw",
tiles = {"farming_straw.png"}, tiles = {"farming_straw.png"},
is_ground_content = false, is_ground_content = false,
groups = {snappy=3, flammable=4}, groups = {snappy = 3, flammable = 4},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -96,12 +96,14 @@ minetest.register_node("farming:wheat_1", {
tiles = {"farming_wheat_1.png"}, tiles = {"farming_wheat_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -110,12 +112,14 @@ minetest.register_node("farming:wheat_2", {
tiles = {"farming_wheat_2.png"}, tiles = {"farming_wheat_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -128,8 +132,11 @@ minetest.register_node("farming:wheat_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -142,8 +149,11 @@ minetest.register_node("farming:wheat_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -157,12 +167,15 @@ minetest.register_node("farming:wheat_5", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {'farming:wheat'},rarity=2}, {items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'},rarity=2}, {items = {'farming:seed_wheat'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -176,12 +189,15 @@ minetest.register_node("farming:wheat_6", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {'farming:wheat'},rarity=2}, {items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'},rarity=1}, {items = {'farming:seed_wheat'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -195,18 +211,21 @@ minetest.register_node("farming:wheat_7", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {'farming:wheat'},rarity=1}, {items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'},rarity=3}, {items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'},rarity=1}, {items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'},rarity=3}, {items = {'farming:seed_wheat'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
-- Last stage of Wheat growth doesnnot have growing=1 so abm never has to check these -- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:wheat_8", { minetest.register_node("farming:wheat_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -217,13 +236,16 @@ minetest.register_node("farming:wheat_8", {
buildable_to = true, buildable_to = true,
drop = { drop = {
items = { items = {
{items = {'farming:wheat'},rarity=1}, {items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'},rarity=2}, {items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'},rarity=1}, {items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'},rarity=2}, {items = {'farming:seed_wheat'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })