Merge branch 'master' of https://github.com/PilzAdam/farming_plus
16
bananas.lua
@ -1,11 +1,19 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_node("farming_plus:banana_sapling", {
|
||||
description = "Banana Tree Sapling",
|
||||
description = S("Banana Tree Sapling"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_banana_sapling.png"},
|
||||
inventory_image = "farming_banana_sapling.png",
|
||||
wield_image = "farming_banana_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
@ -41,14 +49,14 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
return
|
||||
end
|
||||
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
|
||||
local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"})
|
||||
local pos = minetest.find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"})
|
||||
if pos ~= nil then
|
||||
farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming_plus:banana"]=10})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("farming_plus:banana", {
|
||||
description = "Banana",
|
||||
description = S("Banana"),
|
||||
tiles = {"farming_banana.png"},
|
||||
inventory_image = "farming_banana.png",
|
||||
wield_image = "farming_banana.png",
|
||||
@ -56,7 +64,7 @@ minetest.register_node("farming_plus:banana", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {fleshy=3,dig_immediate=3,flammable=2},
|
||||
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
||||
sounds = default.node_sound_defaults(),
|
||||
|
||||
on_use = minetest.item_eat(6),
|
||||
|
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:carrot_seed", {
|
||||
description = "Carrot Seeds",
|
||||
description = S("Carrot Seeds"),
|
||||
inventory_image = "farming_carrot_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:carrot_1")
|
||||
@ -75,7 +79,7 @@ minetest.register_node("farming_plus:carrot", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:carrot_item", {
|
||||
description = "Carrot",
|
||||
description = S("Carrot"),
|
||||
inventory_image = "farming_carrot.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
16
cocoa.lua
@ -1,11 +1,19 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_node("farming_plus:cocoa_sapling", {
|
||||
description = "Cocoa Tree Sapling",
|
||||
description = S("Cocoa Tree Sapling"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cocoa_sapling.png"},
|
||||
inventory_image = "farming_cocoa_sapling.png",
|
||||
wield_image = "farming_cocoa_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
@ -41,14 +49,14 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
return
|
||||
end
|
||||
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
|
||||
local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:desert_sand"})
|
||||
local pos = minetest.find_node_near(tmp, maxp.x-minp.x, {"default:desert_sand"})
|
||||
if pos ~= nil then
|
||||
farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("farming_plus:cocoa", {
|
||||
description = "Cocoa",
|
||||
description = S("Cocoa"),
|
||||
tiles = {"farming_cocoa.png"},
|
||||
visual_scale = 0.5,
|
||||
inventory_image = "farming_cocoa.png",
|
||||
@ -57,7 +65,7 @@ minetest.register_node("farming_plus:cocoa", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {fleshy=3,dig_immediate=3,flammable=2},
|
||||
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
farming
|
||||
intllib?
|
||||
|
99
init.lua
@ -1,6 +1,13 @@
|
||||
|
||||
farming.registered_plants = {}
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
farming.S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
farming.S = function ( s ) return s end
|
||||
end
|
||||
|
||||
function farming:add_plant(full_grown, names, interval, chance)
|
||||
minetest.register_abm({
|
||||
nodenames = names,
|
||||
@ -8,14 +15,14 @@ function farming:add_plant(full_grown, names, interval, chance)
|
||||
chance = chance,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
if minetest.env:get_node(pos).name ~= "farming:soil_wet" then
|
||||
if minetest.get_node(pos).name ~= "farming:soil_wet" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.env:get_node_light(pos) < 8 then
|
||||
if minetest.get_node_light(pos) < 8 then
|
||||
return
|
||||
end
|
||||
local step = nil
|
||||
@ -32,7 +39,7 @@ function farming:add_plant(full_grown, names, interval, chance)
|
||||
if new_node.name == nil then
|
||||
new_node.name = full_grown
|
||||
end
|
||||
minetest.env:set_node(pos, new_node)
|
||||
minetest.set_node(pos, new_node)
|
||||
end
|
||||
})
|
||||
|
||||
@ -46,7 +53,7 @@ end
|
||||
|
||||
function farming:generate_tree(pos, trunk, leaves, underground, replacements)
|
||||
pos.y = pos.y-1
|
||||
local nodename = minetest.env:get_node(pos).name
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local ret = true
|
||||
for _,name in ipairs(underground) do
|
||||
if nodename == name then
|
||||
@ -55,17 +62,17 @@ function farming:generate_tree(pos, trunk, leaves, underground, replacements)
|
||||
end
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if ret or minetest.env:get_node_light(pos) < 8 then
|
||||
if ret or minetest.get_node_light(pos) < 8 then
|
||||
return
|
||||
end
|
||||
|
||||
node = {name = ""}
|
||||
for dy=1,4 do
|
||||
pos.y = pos.y+dy
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
@ -73,7 +80,7 @@ function farming:generate_tree(pos, trunk, leaves, underground, replacements)
|
||||
node.name = trunk
|
||||
for dy=0,4 do
|
||||
pos.y = pos.y+dy
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
@ -91,39 +98,39 @@ function farming:generate_tree(pos, trunk, leaves, underground, replacements)
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if dx == 0 and dz == 0 and dy==3 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:set_node(pos, node)
|
||||
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
minetest.set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif dx == 0 and dz == 0 and dy==4 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:set_node(pos, node)
|
||||
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
minetest.set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:set_node(pos, node)
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
minetest.set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:set_node(pos, node)
|
||||
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
minetest.set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -225,6 +232,50 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
end
|
||||
end)
|
||||
|
||||
function farming:place_seed(itemstack, placer, pointed_thing, plantname)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
return
|
||||
end
|
||||
if pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
local above = minetest.get_node(pt.above)
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at the top of the node
|
||||
if pt.above.y ~= pt.under.y+1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if you can replace the node above the pointed node
|
||||
if not minetest.registered_nodes[above.name].buildable_to then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at soil
|
||||
if minetest.get_item_group(under.name, "soil") <= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.add_node(pt.above, {name=plantname})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- ========= ALIASES FOR FARMING MOD BY SAPIER =========
|
||||
-- potatoe -> potatoe
|
||||
minetest.register_alias("farming:potatoe_node", "farming_plus:potatoe")
|
||||
@ -234,7 +285,7 @@ minetest.register_alias("farming:seed_potatoe", "farming_plus:potatoe_seed")
|
||||
for lvl = 1, 6, 1 do
|
||||
minetest.register_entity(":farming:potatoe_lvl"..lvl, {
|
||||
on_activate = function(self, staticdata)
|
||||
minetest.env:set_node(self.object:getpos(), {name="farming_plus:potatoe_1"})
|
||||
minetest.set_node(self.object:getpos(), {name="farming_plus:potatoe_1"})
|
||||
end
|
||||
})
|
||||
end
|
||||
@ -248,7 +299,7 @@ minetest.register_abm({
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
minetest.env:set_node(pos, {name="farming:wheat_8"})
|
||||
minetest.set_node(pos, {name="farming:wheat_8"})
|
||||
end,
|
||||
})
|
||||
|
||||
|
50
locale/de.txt
Normal file
@ -0,0 +1,50 @@
|
||||
# Translation by Xanthin
|
||||
|
||||
### bananas.lua ###
|
||||
Banana Tree Sapling = Bananenbaumsetzling
|
||||
Banana = Banane
|
||||
|
||||
### carrots.lua ###
|
||||
Carrot Seeds = Karottensamen
|
||||
Carrot = Karotte
|
||||
|
||||
### cocoa.lua ###
|
||||
Cocoa Tree Sapling = Kakaobaumsetzling
|
||||
Cocoa = Kakao
|
||||
Cocoa Bean = Kakaobohne
|
||||
|
||||
### oranges.lua ###
|
||||
Orange Seeds = Orangensamen
|
||||
Orange = Orange
|
||||
|
||||
### potatoes.lua ###
|
||||
Potato Seeds = Kartoffelsamen
|
||||
Potato = Kartoffel
|
||||
|
||||
### pumpkin.lua ###
|
||||
Pumpkin Seed = Kuerbissamen
|
||||
Pumpkin = Kuerbis
|
||||
Pumpkin Face = Kuerbislaterne
|
||||
Pumpkin Face With Light = Leuchtende Kuerbislaterne
|
||||
Big Pumpkin = Riesen-Kuerbis
|
||||
Scarecrow = Vogelscheuche
|
||||
Scarecrow With Light = Leuchtende Vogelscheuche
|
||||
Pumpkin Bread = Kuerbisbrot
|
||||
Pumpkin Flour = Kuerbismehl
|
||||
|
||||
### rhubarb.lua ###
|
||||
Rhubarb Seeds = Rhabarbersamen
|
||||
Rhubarb = Rhabarber
|
||||
|
||||
### strawberries.lua ###
|
||||
Strawberry Seeds = Erdbeersamen
|
||||
Strawberry = Erdbeere
|
||||
|
||||
### tomatoes.lua ###
|
||||
Tomato Seeds = Tomatensamen
|
||||
Tomato = Tomate
|
||||
|
||||
### init.lua ###
|
||||
|
||||
### weed.lua ###
|
||||
Weed = Unkraut
|
51
locale/template.txt
Normal file
@ -0,0 +1,51 @@
|
||||
# Template
|
||||
|
||||
### bananas.lua ###
|
||||
Banana Tree Sapling =
|
||||
Banana =
|
||||
|
||||
### carrots.lua ###
|
||||
Carrot Seeds =
|
||||
Carrot =
|
||||
|
||||
### cocoa.lua ###
|
||||
Cocoa Tree Sapling =
|
||||
Cocoa =
|
||||
Cocoa Bean =
|
||||
|
||||
### oranges.lua ###
|
||||
Orange Seeds =
|
||||
Orange =
|
||||
|
||||
### potatoes.lua ###
|
||||
Potato Seeds =
|
||||
Potato =
|
||||
|
||||
### pumpkin.lua ###
|
||||
Pumpkin Seed =
|
||||
Pumpkin =
|
||||
Pumpkin Face =
|
||||
Pumpkin Face With Light =
|
||||
Big Pumpkin =
|
||||
Scarecrow =
|
||||
Scarecrow With Light =
|
||||
Pumpkin Bread =
|
||||
Pumpkin Flour =
|
||||
|
||||
### rhubarb.lua ###
|
||||
Rhubarb Seeds =
|
||||
Rhubarb =
|
||||
|
||||
### strawberries.lua ###
|
||||
Strawberry Seeds =
|
||||
Strawberry =
|
||||
|
||||
### tomatoes.lua ###
|
||||
Tomato Seeds =
|
||||
Tomato =
|
||||
|
||||
### init.lua ###
|
||||
|
||||
### weed.lua ###
|
||||
Weed =
|
||||
|
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:orange_seed", {
|
||||
description = "Orange Seeds",
|
||||
description = S("Orange Seeds"),
|
||||
inventory_image = "farming_orange_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:orange_1")
|
||||
@ -75,7 +79,7 @@ minetest.register_node("farming_plus:orange", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:orange_item", {
|
||||
description = "Orange",
|
||||
description = S("Orange"),
|
||||
inventory_image = "farming_orange.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:potato_seed", {
|
||||
description = "Potato Seeds",
|
||||
description = ("Potato Seeds"),
|
||||
inventory_image = "farming_potato_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:potato_1")
|
||||
@ -59,7 +63,7 @@ minetest.register_node("farming_plus:potato", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:potato_item", {
|
||||
description = "Potato",
|
||||
description = S("Potato"),
|
||||
inventory_image = "farming_potato.png",
|
||||
})
|
||||
|
||||
|
78
pumpkin.lua
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem(":farming:pumpkin_seed", {
|
||||
description = "Pumpkin Seed",
|
||||
description = S("Pumpkin Seed"),
|
||||
inventory_image = "farming_pumpkin_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
|
||||
@ -51,7 +55,7 @@ minetest.register_node(":farming:pumpkin_2", {
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:pumpkin", {
|
||||
description = "Pumpkin",
|
||||
description = S("Pumpkin"),
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, plant=1},
|
||||
@ -59,9 +63,9 @@ minetest.register_node(":farming:pumpkin", {
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "default:sword_wood" or tool == "default:sword_stone" or tool == "default:sword_steel" then
|
||||
if tool and string.match(tool, "sword") then
|
||||
node.name = "farming:pumpkin_face"
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
|
||||
if math.random(1, 5) == 1 then
|
||||
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
|
||||
@ -73,7 +77,7 @@ minetest.register_node(":farming:pumpkin", {
|
||||
farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 800, 20)
|
||||
|
||||
minetest.register_node(":farming:pumpkin_face", {
|
||||
description = "Pumpkin",
|
||||
description = S("Pumpkin Face"),
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, plant=1},
|
||||
@ -81,7 +85,7 @@ minetest.register_node(":farming:pumpkin_face", {
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:pumpkin_face_light", {
|
||||
description = "Pumpkin",
|
||||
description = S("Pumpkin Face With Light"),
|
||||
paramtype2 = "facedir",
|
||||
light_source = LIGHT_MAX-2,
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"},
|
||||
@ -97,7 +101,7 @@ minetest.register_craft({
|
||||
|
||||
-- ========= BIG PUMPKIN =========
|
||||
minetest.register_node(":farming:big_pumpkin", {
|
||||
description = "Big Pumpkin",
|
||||
description = S("Big Pumpkin"),
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_big_side.png"},
|
||||
selection_box = {
|
||||
@ -117,11 +121,11 @@ minetest.register_node(":farming:big_pumpkin", {
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
if dx ~= 0 or dy ~= 0 or dz ~= 0 then
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.remove_node(pos)
|
||||
minetest.after(0.1, function(placer)
|
||||
local inv = placer:get_inventory()
|
||||
local index = placer:get_wield_index()
|
||||
@ -139,29 +143,29 @@ minetest.register_node(":farming:big_pumpkin", {
|
||||
for dy=0,1 do
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=2})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=2})
|
||||
pos.x = pos.x-1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=2})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=2})
|
||||
pos.x = pos.x+1
|
||||
pos.z = pos.z-2
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=4})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=4})
|
||||
pos.x = pos.x+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=4})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=4})
|
||||
pos.z = pos.z+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=3})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=3})
|
||||
pos.z = pos.z+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=3})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=3})
|
||||
pos.z = pos.z-1
|
||||
pos.x = pos.x-2
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=1})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=1})
|
||||
pos.z = pos.z-1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=1})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=1})
|
||||
pos.z = pos.z+1
|
||||
pos.x = pos.x+1
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_top"})
|
||||
minetest.set_node(pos, {name="farming:big_pumpkin_top"})
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
@ -171,9 +175,9 @@ minetest.register_node(":farming:big_pumpkin", {
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
local name = minetest.env:get_node(pos).name
|
||||
local name = minetest.get_node(pos).name
|
||||
if string.find(name, "farming:big_pumpkin") then
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
@ -273,7 +277,7 @@ for j,list in ipairs(box2) do
|
||||
end
|
||||
|
||||
minetest.register_node(":farming:scarecrow", {
|
||||
description = "Scarecrow",
|
||||
description = S("Scarecrow"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
@ -292,12 +296,12 @@ minetest.register_node(":farming:scarecrow", {
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.env:get_node(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local param2 = node.param2
|
||||
pos.y = pos.y+1
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
pos.y = pos.y-1
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.remove_node(pos)
|
||||
minetest.after(0.1, function(placer)
|
||||
local inv = placer:get_inventory()
|
||||
local index = placer:get_wield_index()
|
||||
@ -305,16 +309,16 @@ minetest.register_node(":farming:scarecrow", {
|
||||
end, placer)
|
||||
return
|
||||
end
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
pos.y = pos.y-1
|
||||
node.name = "farming:scarecrow_bottom"
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y-1
|
||||
if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then
|
||||
minetest.env:remove_node(pos)
|
||||
if minetest.get_node(pos).name == "farming:scarecrow_bottom" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
@ -348,7 +352,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:scarecrow_light", {
|
||||
description = "Scarecrow",
|
||||
description = S("Scarecrow With light"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
@ -368,12 +372,12 @@ minetest.register_node(":farming:scarecrow_light", {
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.env:get_node(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local param2 = node.param2
|
||||
pos.y = pos.y+1
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
pos.y = pos.y-1
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.remove_node(pos)
|
||||
minetest.after(0.1, function(placer)
|
||||
local inv = placer:get_inventory()
|
||||
local index = placer:get_wield_index()
|
||||
@ -381,16 +385,16 @@ minetest.register_node(":farming:scarecrow_light", {
|
||||
end, placer)
|
||||
return
|
||||
end
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
pos.y = pos.y-1
|
||||
node.name = "farming:scarecrow_bottom"
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y-1
|
||||
if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then
|
||||
minetest.env:remove_node(pos)
|
||||
if minetest.get_node(pos).name == "farming:scarecrow_bottom" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
@ -406,7 +410,7 @@ minetest.register_craft({
|
||||
|
||||
--===============
|
||||
minetest.register_craftitem(":farming:pumpkin_bread", {
|
||||
description = "Pumpkin Bread",
|
||||
description = S("Pumpkin Bread"),
|
||||
inventory_image = "farming_bread_pumpkin.png",
|
||||
stack_max = 1,
|
||||
on_use = minetest.item_eat(8)
|
||||
|
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:rhubarb_seed", {
|
||||
description = "Rhubarb Seeds",
|
||||
description = S("Rhubarb Seeds"),
|
||||
inventory_image = "farming_rhubarb_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:rhubarb_1")
|
||||
@ -59,7 +63,7 @@ minetest.register_node("farming_plus:rhubarb", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:rhubarb_item", {
|
||||
description = "Rhubarb",
|
||||
description = S("Rhubarb"),
|
||||
inventory_image = "farming_rhubarb.png",
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:strawberry_seed", {
|
||||
description = "Strawberry Seeds",
|
||||
description = S("Strawberry Seeds"),
|
||||
inventory_image = "farming_strawberry_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:strawberry_1")
|
||||
@ -75,7 +79,7 @@ minetest.register_node("farming_plus:strawberry", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:strawberry_item", {
|
||||
description = "Strawberry",
|
||||
description = S("Strawberry"),
|
||||
inventory_image = "farming_strawberry.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 405 B |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 460 B |
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 493 B |
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 415 B |
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:tomato_seed", {
|
||||
description = "Tomato Seeds",
|
||||
description = S("Tomato Seeds"),
|
||||
inventory_image = "farming_tomato_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:tomato_1")
|
||||
@ -75,7 +79,7 @@ minetest.register_node("farming_plus:tomato", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:tomato_item", {
|
||||
description = "Tomato",
|
||||
description = S("Tomato"),
|
||||
inventory_image = "farming_tomato.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
12
weed.lua
@ -1,5 +1,9 @@
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
S = farming.S
|
||||
|
||||
minetest.register_node(":farming:weed", {
|
||||
description = "Weed",
|
||||
description = S("Weed"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
@ -21,13 +25,13 @@ minetest.register_abm({
|
||||
interval = 500,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.env:find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
|
||||
if minetest.find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
node.name = "farming:weed"
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
end
|
||||
})
|
||||
|