diff options
Diffstat (limited to 'farming_plus')
71 files changed, 1622 insertions, 0 deletions
diff --git a/farming_plus/README.txt b/farming_plus/README.txt new file mode 100644 index 0000000..c7c6751 --- /dev/null +++ b/farming_plus/README.txt @@ -0,0 +1,23 @@ +===FARMING_PLUS MOD for MINETEST=== +by PilzAdam + +License: +Sourcecode: WTFPL (see below) +Graphics: WTFPL (see below) + +See also: +http://minetest.net/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/farming_plus/bananas.lua b/farming_plus/bananas.lua new file mode 100644 index 0000000..c5184a2 --- /dev/null +++ b/farming_plus/bananas.lua @@ -0,0 +1,71 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_node("farming_plus:banana_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(), +}) + +minetest.register_node("farming_plus:banana_leaves", { + drawtype = "allfaces_optional", + tiles = {"farming_banana_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, + drop = { + max_items = 1, + items = { + { + items = {'farming_plus:banana_sapling'}, + rarity = 20, + }, + } + }, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + nodenames = {"farming_plus:banana_sapling"}, + interval = 60, + chance = 20, + action = function(pos, node) + farming.generate_tree(pos, "default:tree", "farming_plus:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming_plus:banana"]=20}) + end +}) + +minetest.register_on_generated(function(minp, maxp, blockseed) + if math.random(1, 100) > 5 then + 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.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 = S("Banana"), + tiles = {"farming_banana.png"}, + inventory_image = "farming_banana.png", + wield_image = "farming_banana.png", + drawtype = "torchlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1}, + sounds = default.node_sound_defaults(), + + on_use = minetest.item_eat(6), +}) diff --git a/farming_plus/carrots.lua b/farming_plus/carrots.lua new file mode 100644 index 0000000..7f55644 --- /dev/null +++ b/farming_plus/carrots.lua @@ -0,0 +1,87 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem("farming_plus:carrot_seed", { + 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") + end +}) + +minetest.register_node("farming_plus:carrot_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_carrot_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:carrot_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_carrot_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:carrot_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_carrot_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:carrot", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_carrot_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming_plus:carrot_seed'} }, + { items = {'farming_plus:carrot_seed'}, rarity = 2}, + { items = {'farming_plus:carrot_seed'}, rarity = 5}, + { items = {'farming_plus:carrot_item'} }, + { items = {'farming_plus:carrot_item'}, rarity = 2 }, + { items = {'farming_plus:carrot_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming_plus:carrot_item", { + description = S("Carrot"), + inventory_image = "farming_carrot.png", + on_use = minetest.item_eat(3), +}) + +farming.add_plant("farming_plus:carrot", {"farming_plus:carrot_1", "farming_plus:carrot_2", "farming_plus:carrot_3"}, 50, 20) diff --git a/farming_plus/cocoa.lua b/farming_plus/cocoa.lua new file mode 100644 index 0000000..42a7705 --- /dev/null +++ b/farming_plus/cocoa.lua @@ -0,0 +1,81 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_node("farming_plus:cocoa_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(), +}) + +minetest.register_node("farming_plus:cocoa_leaves", { + drawtype = "allfaces_optional", + tiles = {"farming_banana_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, + drop = { + max_items = 1, + items = { + { + items = {'farming_plus:cocoa_sapling'}, + rarity = 20, + }, + } + }, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + nodenames = {"farming_plus:cocoa_sapling"}, + interval = 60, + chance = 20, + action = function(pos, node) + farming.generate_tree(pos, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20}) + end +}) + +minetest.register_on_generated(function(minp, maxp, blockseed) + if math.random(1, 100) > 5 then + 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.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 = S("Cocoa"), + tiles = {"farming_cocoa.png"}, + visual_scale = 0.5, + inventory_image = "farming_cocoa.png", + wield_image = "farming_cocoa.png", + drawtype = "torchlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craftitem("farming_plus:cocoa_bean", { + description = "Cocoa Bean", + inventory_image = "farming_cocoa_bean.png", +}) + +minetest.register_craft({ + output = "farming_plus:cocoa_bean 10", + type = "shapeless", + recipe = {"farming_plus:cocoa"}, +}) diff --git a/farming_plus/depends.txt b/farming_plus/depends.txt new file mode 100644 index 0000000..657056a --- /dev/null +++ b/farming_plus/depends.txt @@ -0,0 +1,3 @@ +default +farming +intllib? diff --git a/farming_plus/init.lua b/farming_plus/init.lua new file mode 100644 index 0000000..4f949e7 --- /dev/null +++ b/farming_plus/init.lua @@ -0,0 +1,324 @@ +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, + interval = interval, + chance = chance, + action = function(pos, node) + pos.y = pos.y-1 + if minetest.get_node(pos).name ~= "farming:soil_wet" then + return + end + pos.y = pos.y+1 + if not minetest.get_node_light(pos) then + return + end + if minetest.get_node_light(pos) < 8 then + return + end + local step = nil + for i,name in ipairs(names) do + if name == node.name then + step = i + break + end + end + if step == nil then + return + end + local new_node = {name=names[step+1]} + if new_node.name == nil then + new_node.name = full_grown + end + minetest.set_node(pos, new_node) + end + }) + + table.insert(farming.registered_plants, { + full_grown = full_grown, + names = names, + interval = interval, + chance = chance, + }) +end + +function farming.generate_tree(pos, trunk, leaves, underground, replacements) + pos.y = pos.y-1 + local nodename = minetest.get_node(pos).name + local ret = true + for _,name in ipairs(underground) do + if nodename == name then + ret = false + break + end + end + pos.y = pos.y+1 + if not minetest.get_node_light(pos) then + return + end + 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.get_node(pos).name ~= "air" then + return + end + pos.y = pos.y-dy + end + node.name = trunk + for dy=0,4 do + pos.y = pos.y+dy + minetest.set_node(pos, node) + pos.y = pos.y-dy + end + + if not replacements then + replacements = {} + end + + node.name = leaves + pos.y = pos.y+3 + for dx=-2,2 do + for dz=-2,2 do + for dy=0,3 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + + if dx == 0 and dz == 0 and dy==3 then + 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.set_node(pos, {name=name}) + end + end + end + elseif dx == 0 and dz == 0 and dy==4 then + 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.set_node(pos, {name=name}) + end + end + end + elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then + 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.set_node(pos, {name=name}) + end + end + end + else + if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then + 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.set_node(pos, {name=name}) + end + end + end + end + end + + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end +end + +farming.seeds = { + ["farming:pumpkin_seed"]=60, + ["farming_plus:strawberry_seed"]=30, + ["farming_plus:rhubarb_seed"]=30, + ["farming_plus:potatoe_seed"]=30, + ["farming_plus:tomato_seed"]=30, + ["farming_plus:orange_seed"]=30, + ["farming_plus:carrot_seed"]=30, +} + + +-- ========= GENERATE PLANTS IN THE MAP ========= +minetest.register_on_generated(function(minp, maxp, seed) + if maxp.y >= 2 and minp.y <= 0 then + -- Generate plants (code from flowers) + local perlin1 = minetest.get_perlin(974, 3, 0.6, 100) + -- Assume X and Z lengths are equal + local divlen = 16 + local divs = (maxp.x-minp.x)/divlen+1; + for divx=0,divs-1 do + for divz=0,divs-1 do + local x0 = minp.x + math.floor((divx+0)*divlen) + local z0 = minp.z + math.floor((divz+0)*divlen) + local x1 = minp.x + math.floor((divx+1)*divlen) + local z1 = minp.z + math.floor((divz+1)*divlen) + -- Determine flowers amount from perlin noise + local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9) + -- Find random positions for flowers based on this random + local pr = PseudoRandom(seed+456) + for i=0,grass_amount do + local x = pr:next(x0, x1) + local z = pr:next(z0, z1) + -- Find ground level (0...15) + local ground_y = nil + for y=30,0,-1 do + if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then + ground_y = y + break + end + end + + if ground_y then + local p = {x=x,y=ground_y+1,z=z} + local nn = minetest.get_node(p).name + -- Check if the node can be replaced + if minetest.registered_nodes[nn] and + minetest.registered_nodes[nn].buildable_to then + nn = minetest.get_node({x=x,y=ground_y,z=z}).name + if nn == "default:dirt_with_grass" then + --local plant_choice = pr:next(1, #farming.registered_plants) + local plant_choice = math.floor(perlin1:get2d({x=x,y=z})*(#farming.registered_plants)) + local plant = farming.registered_plants[plant_choice] + if plant then + minetest.set_node(p, {name=plant.full_grown}) + end + end + end + end + + end + end + end + end +end) + +function farming.place_seed(itemstack, placer, pointed_thing, plantname) + + -- Call on_rightclick if the pointed node defines it + if pointed_thing.type == "node" and placer and + not placer:get_player_control().sneak then + local n = minetest.get_node(pointed_thing.under) + local nn = n.name + if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].on_rightclick then + return minetest.registered_nodes[nn].on_rightclick(pointed_thing.under, n, + placer, itemstack, pointed_thing) or itemstack, false + end + end + + 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") < 2 then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.add_node(pt.above, {name=plantname, param2 = 1}) + 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") +--minetest.register_alias("farming:potatoe", "farming:potatoe_item") cant do this +minetest.register_alias("farming:potatoe_straw", "farming_plus:potatoe") +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.set_node(self.object:getpos(), {name="farming_plus:potatoe_1"}) + end + }) +end + + +minetest.register_alias("farming:cotton", "farming:cotton_3") +minetest.register_alias("farming:wheat_harvested", "farming:wheat") +minetest.register_alias("farming:dough", "farming:flour") +minetest.register_abm({ + nodenames = {"farming:wheat"}, + interval = 1, + chance = 1, + action = function(pos) + minetest.set_node(pos, {name="farming:wheat_8"}) + end, +}) + +-- ========= STRAWBERRIES ========= +dofile(minetest.get_modpath("farming_plus").."/strawberries.lua") + +-- ========= RHUBARB ========= +dofile(minetest.get_modpath("farming_plus").."/rhubarb.lua") + +-- ========= POTATOES ========= +dofile(minetest.get_modpath("farming_plus").."/potatoes.lua") + +-- ========= TOMATOES ========= +dofile(minetest.get_modpath("farming_plus").."/tomatoes.lua") + +-- ========= ORANGES ========= +dofile(minetest.get_modpath("farming_plus").."/oranges.lua") + +-- ========= BANANAS ========= +dofile(minetest.get_modpath("farming_plus").."/bananas.lua") + +-- ========= CARROTS ========= +dofile(minetest.get_modpath("farming_plus").."/carrots.lua") + +-- ========= COCOA ========= +dofile(minetest.get_modpath("farming_plus").."/cocoa.lua") + +-- ========= PUMPKIN ========= +dofile(minetest.get_modpath("farming_plus").."/pumpkin.lua") + +-- ========= WEED ========= +dofile(minetest.get_modpath("farming_plus").."/weed.lua") diff --git a/farming_plus/locale/de.txt b/farming_plus/locale/de.txt new file mode 100644 index 0000000..8caedde --- /dev/null +++ b/farming_plus/locale/de.txt @@ -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 diff --git a/farming_plus/locale/template.txt b/farming_plus/locale/template.txt new file mode 100644 index 0000000..9926004 --- /dev/null +++ b/farming_plus/locale/template.txt @@ -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 = + diff --git a/farming_plus/oranges.lua b/farming_plus/oranges.lua new file mode 100644 index 0000000..685ebb3 --- /dev/null +++ b/farming_plus/oranges.lua @@ -0,0 +1,87 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem("farming_plus:orange_seed", { + 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") + end +}) + +minetest.register_node("farming_plus:orange_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_orange_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:orange_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_orange_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:orange_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_orange_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:orange", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_orange_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming_plus:orange_seed'} }, + { items = {'farming_plus:orange_seed'}, rarity = 2}, + { items = {'farming_plus:orange_seed'}, rarity = 5}, + { items = {'farming_plus:orange_item'} }, + { items = {'farming_plus:orange_item'}, rarity = 2 }, + { items = {'farming_plus:orange_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming_plus:orange_item", { + description = S("Orange"), + inventory_image = "farming_orange.png", + on_use = minetest.item_eat(4), +}) + +farming.add_plant("farming_plus:orange", {"farming_plus:orange_1", "farming_plus:orange_2", "farming_plus:orange_3"}, 50, 20) diff --git a/farming_plus/potatoes.lua b/farming_plus/potatoes.lua new file mode 100644 index 0000000..794c021 --- /dev/null +++ b/farming_plus/potatoes.lua @@ -0,0 +1,77 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem("farming_plus:potato_seed", { + 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") + end +}) + +minetest.register_node("farming_plus:potato_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_potato_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:potato_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_potato_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:potato", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_potato_3.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming_plus:potato_seed'} }, + { items = {'farming_plus:potato_seed'}, rarity = 2}, + { items = {'farming_plus:potato_seed'}, rarity = 5}, + { items = {'farming_plus:potato_item'} }, + { items = {'farming_plus:potato_item'}, rarity = 2 }, + { items = {'farming_plus:potato_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming_plus:potato_item", { + description = S("Potato"), + inventory_image = "farming_potato.png", +}) + +farming.add_plant("farming_plus:potato", {"farming_plus:potato_1", "farming_plus:potato_2"}, 50, 20) + +minetest.register_alias("farming_plus:potatoe_item", "farming_plus:potato_item") +minetest.register_alias("farming_plus:potatoe_seed", "farming_plus:potato_seed") +minetest.register_alias("farming_plus:potatoe", "farming_plus:potato") +minetest.register_alias("farming_plus:potatoe_1", "farming_plus:potato_1") +minetest.register_alias("farming_plus:potatoe_2", "farming_plus:potato_2") + diff --git a/farming_plus/pumpkin.lua b/farming_plus/pumpkin.lua new file mode 100644 index 0000000..4a68b99 --- /dev/null +++ b/farming_plus/pumpkin.lua @@ -0,0 +1,480 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem(":farming: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") + end +}) + +minetest.register_node(":farming:pumpkin_1", { + paramtype = "light", + sunlight_propagates = true, + drawtype = "nodebox", + drop = "", + 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"}, + node_box = { + type = "fixed", + fixed = { + {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2} + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2} + }, + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1, plant=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node(":farming:pumpkin_2", { + paramtype = "light", + sunlight_propagates = true, + drawtype = "nodebox", + drop = "", + 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"}, + node_box = { + type = "fixed", + fixed = { + {-0.35, -0.5, -0.35, 0.35, 0.2, 0.35} + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.35, -0.5, -0.35, 0.35, 0.2, 0.35} + }, + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1, plant=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node(":farming: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}, + sounds = default.node_sound_wood_defaults(), + + on_punch = function(pos, node, puncher) + local tool = puncher:get_wielded_item():get_name() + if tool and string.match(tool, "sword") then + node.name = "farming:pumpkin_face" + 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")) + end + end + end +}) + +farming.add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20) + +minetest.register_node(":farming:pumpkin_face", { + 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}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node(":farming:pumpkin_face_light", { + 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"}, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:pumpkin_face_light", + recipe = {"farming:pumpkin_face", "default:torch"} +}) + +-- ========= BIG PUMPKIN ========= +minetest.register_node(":farming:big_pumpkin", { + description = S("Big Pumpkin"), + paramtype2 = "facedir", + tiles = {"farming_pumpkin_big_side.png"}, + selection_box = { + type = "fixed", + fixed = { + {-1, -0.5, -1, 1, 1.5, 1} + } + }, + groups = {choppy=1, oddly_breakable_by_hand=1, flammable=2}, + sounds = default.node_sound_wood_defaults(), + + after_place_node = function(pos, placer) + for dx=-1,1 do + for dy=0,1 do + for dz=-1,1 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + if dx ~= 0 or dy ~= 0 or dz ~= 0 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.remove_node(pos) + minetest.after(0.1, function(placer) + local inv = placer:get_inventory() + local index = placer:get_wield_index() + inv:set_stack("main", index, ItemStack("farming:big_pumpkin")) + end, placer) + return + end + end + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end + for dy=0,1 do + pos.y = pos.y+dy + pos.z = pos.z+1 + minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=2}) + pos.x = pos.x-1 + minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=2}) + pos.x = pos.x+1 + pos.z = pos.z-2 + minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=4}) + pos.x = pos.x+1 + minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=4}) + pos.z = pos.z+1 + minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=3}) + pos.z = pos.z+1 + minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=3}) + pos.z = pos.z-1 + pos.x = pos.x-2 + minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=1}) + pos.z = pos.z-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.set_node(pos, {name="farming:big_pumpkin_top"}) + end, + + after_destruct = function(pos, oldnode) + for dx=-1,1 do + for dy=0,1 do + for dz=-1,1 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + local name = minetest.get_node(pos).name + if string.find(name, "farming:big_pumpkin") then + minetest.remove_node(pos) + end + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end + end +}) + +minetest.register_node(":farming:big_pumpkin_side", { + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = {"farming_pumpkin_big_top_side.png", "farming_pumpkin_big_side.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0, 0.5, 0.5, 0.5} + } + }, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + }, + groups = {not_in_creative_inventory=1}, +}) +minetest.register_node(":farming:big_pumpkin_corner", { + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = {"farming_pumpkin_big_top_corner.png", "farming_pumpkin_big_side.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0, 0, 0.5, 0.5} + } + }, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + }, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_node(":farming:big_pumpkin_top", { + paramtype = "light", + sunlight_propagates = true, + tiles = {"farming_pumpkin_big_top.png"}, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + }, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:big_pumpkin", + recipe = {"bucket:bucket_water", "farming:pumpkin"}, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"} + } +}) + +-- ========= SCARECROW ========= +local box1 = { + {-1, -8, -1, 1, 8, 1}, +} + +local box2 = { + {-1, -8, -1, 1, 8, 1}, + {-12, -8, -1, 12, -7, 1}, + {-5, -2, -5, 5, 8, 5} +} + +for j,list in ipairs(box1) do + for i,int in ipairs(list) do + list[i] = int/16 + end + box1[j] = list +end + +for j,list in ipairs(box2) do + for i,int in ipairs(list) do + list[i] = int/16 + end + box2[j] = list +end + +minetest.register_node(":farming:scarecrow", { + description = S("Scarecrow"), + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = box2 + }, + selection_box = { + type = "fixed", + fixed = { + {-12/16, -1.5, -0.5, 12/16, 0.5, 0.5} + } + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + + after_place_node = function(pos, placer) + local node = minetest.get_node(pos) + local param2 = node.param2 + pos.y = pos.y+1 + if minetest.get_node(pos).name ~= "air" then + pos.y = pos.y-1 + minetest.remove_node(pos) + minetest.after(0.1, function(placer) + local inv = placer:get_inventory() + local index = placer:get_wield_index() + inv:set_stack("main", index, ItemStack("farming:scarecrow")) + end, placer) + return + end + minetest.set_node(pos, node) + pos.y = pos.y-1 + node.name = "farming:scarecrow_bottom" + minetest.set_node(pos, node) + end, + + after_destruct = function(pos, oldnode) + pos.y = pos.y-1 + if minetest.get_node(pos).name == "farming:scarecrow_bottom" then + minetest.remove_node(pos) + end + end +}) + +minetest.register_node(":farming:scarecrow_bottom", { + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = {"default_wood.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = box1 + }, + groups = {not_in_creative_inventory=1}, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + } +}) + +minetest.register_craft({ + output = "farming:scarecrow", + recipe = { + {"", "farming:pumpkin_face", "",}, + {"default:stick", "default:stick", "default:stick",}, + {"", "default:stick", "",} + } +}) + +minetest.register_node(":farming:scarecrow_light", { + description = S("Scarecrow With light"), + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + light_source = LIGHT_MAX-2, + tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front_light.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = box2 + }, + selection_box = { + type = "fixed", + fixed = { + {-12/16, -1.5, -0.5, 12/16, 0.5, 0.5} + } + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + + after_place_node = function(pos, placer) + local node = minetest.get_node(pos) + local param2 = node.param2 + pos.y = pos.y+1 + if minetest.get_node(pos).name ~= "air" then + pos.y = pos.y-1 + minetest.remove_node(pos) + minetest.after(0.1, function(placer) + local inv = placer:get_inventory() + local index = placer:get_wield_index() + inv:set_stack("main", index, ItemStack("farming:scarecrow_light")) + end, placer) + return + end + minetest.set_node(pos, node) + pos.y = pos.y-1 + node.name = "farming:scarecrow_bottom" + minetest.set_node(pos, node) + end, + + after_destruct = function(pos, oldnode) + pos.y = pos.y-1 + if minetest.get_node(pos).name == "farming:scarecrow_bottom" then + minetest.remove_node(pos) + end + end +}) + +minetest.register_craft({ + output = "farming:scarecrow_light", + recipe = { + {"", "farming:pumpkin_face_light", "",}, + {"default:stick", "default:stick", "default:stick",}, + {"", "default:stick", "",} + } +}) + +--=============== +minetest.register_craftitem(":farming:pumpkin_bread", { + description = S("Pumpkin Bread"), + inventory_image = "farming_bread_pumpkin.png", + stack_max = 1, + on_use = minetest.item_eat(8) +}) + +minetest.register_craftitem(":farming:pumpkin_flour", { + description = "Pumpkin Flour", + inventory_image = "farming_cake_mix_pumpkin.png", +}) +minetest.register_alias("farming:pumpkin_cake_mix", "farming:pumpkin_flour") + +minetest.register_craft({ + output = "farming:pumpkin_flour", + type = "shapeless", + recipe = {"farming:flour", "farming:pumpkin"} +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:pumpkin_bread", + recipe = "farming:pumpkin_flour", + cooktime = 10 +}) + + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin_seed", + burntime = 1 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin", + burntime = 5 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin_face", + burntime = 5 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin_face_light", + burntime = 7 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:big_pumpkin", + burntime = 10 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:scarecrow", + burntime = 5 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:scarecrow_light", + burntime = 5 +}) diff --git a/farming_plus/rhubarb.lua b/farming_plus/rhubarb.lua new file mode 100644 index 0000000..43c5baa --- /dev/null +++ b/farming_plus/rhubarb.lua @@ -0,0 +1,70 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem("farming_plus:rhubarb_seed", { + 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") + end +}) + +minetest.register_node("farming_plus:rhubarb_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_rhubarb_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:rhubarb_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_rhubarb_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+11/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:rhubarb", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_rhubarb_3.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming_plus:rhubarb_seed'} }, + { items = {'farming_plus:rhubarb_seed'}, rarity = 2}, + { items = {'farming_plus:rhubarb_seed'}, rarity = 5}, + { items = {'farming_plus:rhubarb_item'} }, + { items = {'farming_plus:rhubarb_item'}, rarity = 2 }, + { items = {'farming_plus:rhubarb_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming_plus:rhubarb_item", { + description = S("Rhubarb"), + inventory_image = "farming_rhubarb.png", +}) + +farming.add_plant("farming_plus:rhubarb", {"farming_plus:rhubarb_1", "farming_plus:rhubarb_2"}, 50, 20) diff --git a/farming_plus/strawberries.lua b/farming_plus/strawberries.lua new file mode 100644 index 0000000..3c5ef7b --- /dev/null +++ b/farming_plus/strawberries.lua @@ -0,0 +1,87 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem("farming_plus:strawberry_seed", { + 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") + end +}) + +minetest.register_node("farming_plus:strawberry_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_strawberry_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:strawberry_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_strawberry_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:strawberry_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_strawberry_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:strawberry", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_strawberry_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming_plus:strawberry_seed'} }, + { items = {'farming_plus:strawberry_seed'}, rarity = 2}, + { items = {'farming_plus:strawberry_seed'}, rarity = 5}, + { items = {'farming_plus:strawberry_item'} }, + { items = {'farming_plus:strawberry_item'}, rarity = 2 }, + { items = {'farming_plus:strawberry_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming_plus:strawberry_item", { + description = S("Strawberry"), + inventory_image = "farming_strawberry.png", + on_use = minetest.item_eat(2), +}) + +farming.add_plant("farming_plus:strawberry", {"farming_plus:strawberry_1", "farming_plus:strawberry_2", "farming_plus:strawberry_3"}, 50, 20) diff --git a/farming_plus/textures/farming_banana.png b/farming_plus/textures/farming_banana.png Binary files differnew file mode 100644 index 0000000..f775e14 --- /dev/null +++ b/farming_plus/textures/farming_banana.png diff --git a/farming_plus/textures/farming_banana_leaves.png b/farming_plus/textures/farming_banana_leaves.png Binary files differnew file mode 100644 index 0000000..cf8eecb --- /dev/null +++ b/farming_plus/textures/farming_banana_leaves.png diff --git a/farming_plus/textures/farming_banana_sapling.png b/farming_plus/textures/farming_banana_sapling.png Binary files differnew file mode 100644 index 0000000..821c64f --- /dev/null +++ b/farming_plus/textures/farming_banana_sapling.png diff --git a/farming_plus/textures/farming_bread_pumpkin.png b/farming_plus/textures/farming_bread_pumpkin.png Binary files differnew file mode 100644 index 0000000..44db02e --- /dev/null +++ b/farming_plus/textures/farming_bread_pumpkin.png diff --git a/farming_plus/textures/farming_cake_mix_pumpkin.png b/farming_plus/textures/farming_cake_mix_pumpkin.png Binary files differnew file mode 100644 index 0000000..171e486 --- /dev/null +++ b/farming_plus/textures/farming_cake_mix_pumpkin.png diff --git a/farming_plus/textures/farming_carrot.png b/farming_plus/textures/farming_carrot.png Binary files differnew file mode 100644 index 0000000..ae2addb --- /dev/null +++ b/farming_plus/textures/farming_carrot.png diff --git a/farming_plus/textures/farming_carrot_1.png b/farming_plus/textures/farming_carrot_1.png Binary files differnew file mode 100644 index 0000000..f1596f5 --- /dev/null +++ b/farming_plus/textures/farming_carrot_1.png diff --git a/farming_plus/textures/farming_carrot_2.png b/farming_plus/textures/farming_carrot_2.png Binary files differnew file mode 100644 index 0000000..e0a7116 --- /dev/null +++ b/farming_plus/textures/farming_carrot_2.png diff --git a/farming_plus/textures/farming_carrot_3.png b/farming_plus/textures/farming_carrot_3.png Binary files differnew file mode 100644 index 0000000..7eb2070 --- /dev/null +++ b/farming_plus/textures/farming_carrot_3.png diff --git a/farming_plus/textures/farming_carrot_4.png b/farming_plus/textures/farming_carrot_4.png Binary files differnew file mode 100644 index 0000000..6eca727 --- /dev/null +++ b/farming_plus/textures/farming_carrot_4.png diff --git a/farming_plus/textures/farming_carrot_seed.png b/farming_plus/textures/farming_carrot_seed.png Binary files differnew file mode 100644 index 0000000..69bc450 --- /dev/null +++ b/farming_plus/textures/farming_carrot_seed.png diff --git a/farming_plus/textures/farming_cocoa.png b/farming_plus/textures/farming_cocoa.png Binary files differnew file mode 100644 index 0000000..bce3db6 --- /dev/null +++ b/farming_plus/textures/farming_cocoa.png diff --git a/farming_plus/textures/farming_cocoa_bean.png b/farming_plus/textures/farming_cocoa_bean.png Binary files differnew file mode 100644 index 0000000..4ad6b35 --- /dev/null +++ b/farming_plus/textures/farming_cocoa_bean.png diff --git a/farming_plus/textures/farming_cocoa_sapling.png b/farming_plus/textures/farming_cocoa_sapling.png Binary files differnew file mode 100644 index 0000000..73c588f --- /dev/null +++ b/farming_plus/textures/farming_cocoa_sapling.png diff --git a/farming_plus/textures/farming_orange.png b/farming_plus/textures/farming_orange.png Binary files differnew file mode 100644 index 0000000..4c5e045 --- /dev/null +++ b/farming_plus/textures/farming_orange.png diff --git a/farming_plus/textures/farming_orange_1.png b/farming_plus/textures/farming_orange_1.png Binary files differnew file mode 100644 index 0000000..5a2aaa2 --- /dev/null +++ b/farming_plus/textures/farming_orange_1.png diff --git a/farming_plus/textures/farming_orange_2.png b/farming_plus/textures/farming_orange_2.png Binary files differnew file mode 100644 index 0000000..3de4623 --- /dev/null +++ b/farming_plus/textures/farming_orange_2.png diff --git a/farming_plus/textures/farming_orange_3.png b/farming_plus/textures/farming_orange_3.png Binary files differnew file mode 100644 index 0000000..851cd67 --- /dev/null +++ b/farming_plus/textures/farming_orange_3.png diff --git a/farming_plus/textures/farming_orange_4.png b/farming_plus/textures/farming_orange_4.png Binary files differnew file mode 100644 index 0000000..accb7b7 --- /dev/null +++ b/farming_plus/textures/farming_orange_4.png diff --git a/farming_plus/textures/farming_orange_seed.png b/farming_plus/textures/farming_orange_seed.png Binary files differnew file mode 100644 index 0000000..3873bad --- /dev/null +++ b/farming_plus/textures/farming_orange_seed.png diff --git a/farming_plus/textures/farming_potato.png b/farming_plus/textures/farming_potato.png Binary files differnew file mode 100644 index 0000000..8fa9442 --- /dev/null +++ b/farming_plus/textures/farming_potato.png diff --git a/farming_plus/textures/farming_potato_1.png b/farming_plus/textures/farming_potato_1.png Binary files differnew file mode 100644 index 0000000..75a3cdf --- /dev/null +++ b/farming_plus/textures/farming_potato_1.png diff --git a/farming_plus/textures/farming_potato_2.png b/farming_plus/textures/farming_potato_2.png Binary files differnew file mode 100644 index 0000000..8b7ccd4 --- /dev/null +++ b/farming_plus/textures/farming_potato_2.png diff --git a/farming_plus/textures/farming_potato_3.png b/farming_plus/textures/farming_potato_3.png Binary files differnew file mode 100644 index 0000000..cc29ef3 --- /dev/null +++ b/farming_plus/textures/farming_potato_3.png diff --git a/farming_plus/textures/farming_potato_seed.png b/farming_plus/textures/farming_potato_seed.png Binary files differnew file mode 100644 index 0000000..74e440d --- /dev/null +++ b/farming_plus/textures/farming_potato_seed.png diff --git a/farming_plus/textures/farming_pumpkin_big_side.png b/farming_plus/textures/farming_pumpkin_big_side.png Binary files differnew file mode 100644 index 0000000..2651380 --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_big_side.png diff --git a/farming_plus/textures/farming_pumpkin_big_top.png b/farming_plus/textures/farming_pumpkin_big_top.png Binary files differnew file mode 100644 index 0000000..581accc --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_big_top.png diff --git a/farming_plus/textures/farming_pumpkin_big_top_corner.png b/farming_plus/textures/farming_pumpkin_big_top_corner.png Binary files differnew file mode 100644 index 0000000..ab1de28 --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_big_top_corner.png diff --git a/farming_plus/textures/farming_pumpkin_big_top_side.png b/farming_plus/textures/farming_pumpkin_big_top_side.png Binary files differnew file mode 100644 index 0000000..e2eb1a7 --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_big_top_side.png diff --git a/farming_plus/textures/farming_pumpkin_face.png b/farming_plus/textures/farming_pumpkin_face.png Binary files differnew file mode 100644 index 0000000..90c0f8a --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_face.png diff --git a/farming_plus/textures/farming_pumpkin_face_light.png b/farming_plus/textures/farming_pumpkin_face_light.png Binary files differnew file mode 100644 index 0000000..cef4866 --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_face_light.png diff --git a/farming_plus/textures/farming_pumpkin_seed.png b/farming_plus/textures/farming_pumpkin_seed.png Binary files differnew file mode 100644 index 0000000..6933bc3 --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_seed.png diff --git a/farming_plus/textures/farming_pumpkin_side.png b/farming_plus/textures/farming_pumpkin_side.png Binary files differnew file mode 100644 index 0000000..3a3f9da --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_side.png diff --git a/farming_plus/textures/farming_pumpkin_top.png b/farming_plus/textures/farming_pumpkin_top.png Binary files differnew file mode 100644 index 0000000..edef2d9 --- /dev/null +++ b/farming_plus/textures/farming_pumpkin_top.png diff --git a/farming_plus/textures/farming_rhubarb.png b/farming_plus/textures/farming_rhubarb.png Binary files differnew file mode 100644 index 0000000..849f61b --- /dev/null +++ b/farming_plus/textures/farming_rhubarb.png diff --git a/farming_plus/textures/farming_rhubarb_1.png b/farming_plus/textures/farming_rhubarb_1.png Binary files differnew file mode 100644 index 0000000..706d8cf --- /dev/null +++ b/farming_plus/textures/farming_rhubarb_1.png diff --git a/farming_plus/textures/farming_rhubarb_2.png b/farming_plus/textures/farming_rhubarb_2.png Binary files differnew file mode 100644 index 0000000..2aadf5f --- /dev/null +++ b/farming_plus/textures/farming_rhubarb_2.png diff --git a/farming_plus/textures/farming_rhubarb_3.png b/farming_plus/textures/farming_rhubarb_3.png Binary files differnew file mode 100644 index 0000000..833f65b --- /dev/null +++ b/farming_plus/textures/farming_rhubarb_3.png diff --git a/farming_plus/textures/farming_rhubarb_seed.png b/farming_plus/textures/farming_rhubarb_seed.png Binary files differnew file mode 100644 index 0000000..c16527d --- /dev/null +++ b/farming_plus/textures/farming_rhubarb_seed.png diff --git a/farming_plus/textures/farming_scarecrow_front.png b/farming_plus/textures/farming_scarecrow_front.png Binary files differnew file mode 100644 index 0000000..364738f --- /dev/null +++ b/farming_plus/textures/farming_scarecrow_front.png diff --git a/farming_plus/textures/farming_scarecrow_front_light.png b/farming_plus/textures/farming_scarecrow_front_light.png Binary files differnew file mode 100644 index 0000000..b4b3cf2 --- /dev/null +++ b/farming_plus/textures/farming_scarecrow_front_light.png diff --git a/farming_plus/textures/farming_scarecrow_side.png b/farming_plus/textures/farming_scarecrow_side.png Binary files differnew file mode 100644 index 0000000..e22e84b --- /dev/null +++ b/farming_plus/textures/farming_scarecrow_side.png diff --git a/farming_plus/textures/farming_scarecrow_top.png b/farming_plus/textures/farming_scarecrow_top.png Binary files differnew file mode 100644 index 0000000..3a4addc --- /dev/null +++ b/farming_plus/textures/farming_scarecrow_top.png diff --git a/farming_plus/textures/farming_strawberry.png b/farming_plus/textures/farming_strawberry.png Binary files differnew file mode 100644 index 0000000..0a80f45 --- /dev/null +++ b/farming_plus/textures/farming_strawberry.png diff --git a/farming_plus/textures/farming_strawberry_1.png b/farming_plus/textures/farming_strawberry_1.png Binary files differnew file mode 100644 index 0000000..ff238f6 --- /dev/null +++ b/farming_plus/textures/farming_strawberry_1.png diff --git a/farming_plus/textures/farming_strawberry_2.png b/farming_plus/textures/farming_strawberry_2.png Binary files differnew file mode 100644 index 0000000..2912eb5 --- /dev/null +++ b/farming_plus/textures/farming_strawberry_2.png diff --git a/farming_plus/textures/farming_strawberry_3.png b/farming_plus/textures/farming_strawberry_3.png Binary files differnew file mode 100644 index 0000000..ca77389 --- /dev/null +++ b/farming_plus/textures/farming_strawberry_3.png diff --git a/farming_plus/textures/farming_strawberry_4.png b/farming_plus/textures/farming_strawberry_4.png Binary files differnew file mode 100644 index 0000000..12c6a49 --- /dev/null +++ b/farming_plus/textures/farming_strawberry_4.png diff --git a/farming_plus/textures/farming_strawberry_seed.png b/farming_plus/textures/farming_strawberry_seed.png Binary files differnew file mode 100644 index 0000000..08c958d --- /dev/null +++ b/farming_plus/textures/farming_strawberry_seed.png diff --git a/farming_plus/textures/farming_tomato.png b/farming_plus/textures/farming_tomato.png Binary files differnew file mode 100644 index 0000000..b112d48 --- /dev/null +++ b/farming_plus/textures/farming_tomato.png diff --git a/farming_plus/textures/farming_tomato_1.png b/farming_plus/textures/farming_tomato_1.png Binary files differnew file mode 100644 index 0000000..2e7c425 --- /dev/null +++ b/farming_plus/textures/farming_tomato_1.png diff --git a/farming_plus/textures/farming_tomato_2.png b/farming_plus/textures/farming_tomato_2.png Binary files differnew file mode 100644 index 0000000..6f6a451 --- /dev/null +++ b/farming_plus/textures/farming_tomato_2.png diff --git a/farming_plus/textures/farming_tomato_3.png b/farming_plus/textures/farming_tomato_3.png Binary files differnew file mode 100644 index 0000000..e01b60b --- /dev/null +++ b/farming_plus/textures/farming_tomato_3.png diff --git a/farming_plus/textures/farming_tomato_4.png b/farming_plus/textures/farming_tomato_4.png Binary files differnew file mode 100644 index 0000000..e2f5db4 --- /dev/null +++ b/farming_plus/textures/farming_tomato_4.png diff --git a/farming_plus/textures/farming_tomato_seed.png b/farming_plus/textures/farming_tomato_seed.png Binary files differnew file mode 100644 index 0000000..dbef76e --- /dev/null +++ b/farming_plus/textures/farming_tomato_seed.png diff --git a/farming_plus/textures/farming_weed.png b/farming_plus/textures/farming_weed.png Binary files differnew file mode 100644 index 0000000..4667287 --- /dev/null +++ b/farming_plus/textures/farming_weed.png diff --git a/farming_plus/tomatoes.lua b/farming_plus/tomatoes.lua new file mode 100644 index 0000000..5926dcf --- /dev/null +++ b/farming_plus/tomatoes.lua @@ -0,0 +1,87 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_craftitem("farming_plus:tomato_seed", { + 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") + end +}) + +minetest.register_node("farming_plus:tomato_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_tomato_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:tomato_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_tomato_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:tomato_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_tomato_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+13/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming_plus:tomato", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_tomato_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming_plus:tomato_seed'} }, + { items = {'farming_plus:tomato_seed'}, rarity = 2}, + { items = {'farming_plus:tomato_seed'}, rarity = 5}, + { items = {'farming_plus:tomato_item'} }, + { items = {'farming_plus:tomato_item'}, rarity = 2 }, + { items = {'farming_plus:tomato_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming_plus:tomato_item", { + description = S("Tomato"), + inventory_image = "farming_tomato.png", + on_use = minetest.item_eat(4), +}) + +farming.add_plant("farming_plus:tomato", {"farming_plus:tomato_1", "farming_plus:tomato_2", "farming_plus:tomato_3"}, 50, 20) diff --git a/farming_plus/weed.lua b/farming_plus/weed.lua new file mode 100644 index 0000000..b117870 --- /dev/null +++ b/farming_plus/weed.lua @@ -0,0 +1,44 @@ +-- main `S` code in init.lua +local S +S = farming.S + +minetest.register_node(":farming:weed", { + description = S("Weed"), + paramtype = "light", + sunlight_propagates = true, + walkable = false, + drawtype = "plantlike", + tiles = {"farming_weed.png"}, + inventory_image = "farming_weed.png", + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2,plant=1}, + sounds = default.node_sound_leaves_defaults() +}) + +minetest.register_abm({ + nodenames = {"farming:soil_wet", "farming:soil"}, + interval = 50, + chance = 10, + action = function(pos, node) + if minetest.find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then + return + end + pos.y = pos.y+1 + if minetest.get_node(pos).name == "air" then + node.name = "farming:weed" + minetest.set_node(pos, node) + end + end +}) + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:weed", + burntime = 1 +}) |