summaryrefslogtreecommitdiff
path: root/farming
diff options
context:
space:
mode:
Diffstat (limited to 'farming')
-rw-r--r--farming/README.txt7
-rw-r--r--farming/beanpole.lua81
-rw-r--r--farming/compatibility.lua14
-rw-r--r--farming/corn.lua14
-rw-r--r--farming/cucumber.lua2
-rw-r--r--farming/farming.conf_example27
-rw-r--r--farming/hemp.lua213
-rw-r--r--farming/init.lua153
-rw-r--r--farming/locale/de.txt2
-rw-r--r--farming/locale/template.txt2
-rw-r--r--farming/lucky_block.lua1
-rw-r--r--farming/mapgen.lua88
-rw-r--r--farming/pumpkin.lua2
-rw-r--r--farming/textures/farming_hemp_1.pngbin0 -> 115 bytes
-rw-r--r--farming/textures/farming_hemp_2.pngbin0 -> 122 bytes
-rw-r--r--farming/textures/farming_hemp_3.pngbin0 -> 129 bytes
-rw-r--r--farming/textures/farming_hemp_4.pngbin0 -> 132 bytes
-rw-r--r--farming/textures/farming_hemp_5.pngbin0 -> 142 bytes
-rw-r--r--farming/textures/farming_hemp_6.pngbin0 -> 148 bytes
-rw-r--r--farming/textures/farming_hemp_7.pngbin0 -> 169 bytes
-rw-r--r--farming/textures/farming_hemp_8.pngbin0 -> 174 bytes
-rw-r--r--farming/textures/farming_hemp_fibre.pngbin0 -> 144 bytes
-rw-r--r--farming/textures/farming_hemp_leaf.pngbin0 -> 172 bytes
-rw-r--r--farming/textures/farming_hemp_oil.pngbin0 -> 164 bytes
-rw-r--r--farming/textures/farming_hemp_rope.pngbin0 -> 122 bytes
-rw-r--r--farming/textures/farming_hemp_seed.pngbin0 -> 147 bytes
26 files changed, 442 insertions, 164 deletions
diff --git a/farming/README.txt b/farming/README.txt
index 811a535..95c8154 100644
--- a/farming/README.txt
+++ b/farming/README.txt
@@ -13,6 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
Changelog:
+1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder)
+1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil.
1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also.
1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks).
1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs
@@ -45,7 +47,7 @@ Changelog:
0.1 - Fixed growing bug
0.0 - Initial release
-Lucky Blocks: 10 (plus 3 for default farming items)
+Lucky Blocks: 11 (plus 3 for default farming items)
License of media (textures):
@@ -150,4 +152,5 @@ Created by TenPlus1
farming_rhubarb_2.png
farming_rhubarb_3.png
farming_rhubarb.png
- farming_rhubarb_pie.png \ No newline at end of file
+ farming_rhubarb_pie.png
+ farming_hemp*.png
diff --git a/farming/beanpole.lua b/farming/beanpole.lua
index f06aea5..fd93383 100644
--- a/farming/beanpole.lua
+++ b/farming/beanpole.lua
@@ -6,46 +6,69 @@
local S = farming.intllib
--- beans
-minetest.register_craftitem("farming:beans", {
- description = S("Green Beans"),
- inventory_image = "farming_beans.png",
- on_use = minetest.item_eat(1),
+-- place beans
+function place_beans(itemstack, placer, pointed_thing, plantname)
- on_place = function(itemstack, placer, pointed_thing)
+ local pt = pointed_thing
- if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
- return
- end
+ -- check if pointing at a node
+ if not pt or pt.type ~= "node" then
- local nodename = minetest.get_node(pointed_thing.under).name
+ return
+ end
- if nodename == "farming:beanpole" then
- minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"})
+ local under = minetest.get_node(pt.under)
- minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0})
- else
- return
- end
+ -- return if any of the nodes are not registered
+ if not minetest.registered_nodes[under.name] then
+ return
+ end
- if not minetest.setting_getbool("creative_mode") then
+ -- am I right-clicking on something that has a custom on_place set?
+ -- thanks to Krock for helping with this issue :)
+ local def = minetest.registered_nodes[under.name]
+ if def and def.on_rightclick then
+ return def.on_rightclick(pt.under, under, placer, itemstack)
+ end
- itemstack:take_item()
+ -- check if pointing at bean pole
+ if under.name ~= "farming:beanpole" then
+ return
+ end
- -- check for refill
- if itemstack:get_count() == 0 then
+ -- add the node and remove 1 item from the itemstack
+ minetest.set_node(pt.under, {name = plantname})
- minetest.after(0.20,
- farming.refill_plant,
- placer,
- "farming:beans",
- placer:get_wield_index()
- )
- end
- end
+ minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0})
- return itemstack
+ if not minetest.setting_getbool("creative_mode") then
+
+ itemstack:take_item()
+
+ -- check for refill
+ if itemstack:get_count() == 0 then
+
+ minetest.after(0.20,
+ farming.refill_plant,
+ placer,
+ "farming:beans",
+ placer:get_wield_index()
+ )
+ end
end
+
+ return itemstack
+end
+
+-- beans
+minetest.register_craftitem("farming:beans", {
+ description = S("Green Beans"),
+ inventory_image = "farming_beans.png",
+ on_use = minetest.item_eat(1),
+
+ on_place = function(itemstack, placer, pointed_thing)
+ return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")
+ end,
})
-- beans can be used for green dye
diff --git a/farming/compatibility.lua b/farming/compatibility.lua
index 4354e60..b7c906c 100644
--- a/farming/compatibility.lua
+++ b/farming/compatibility.lua
@@ -140,3 +140,17 @@ minetest.register_alias("farming_plus:tomato", "farming:tomato_8")
-- Weed
minetest.register_alias("farming:weed", "default:grass_2")
+
+-- Classic Bushes compatibility
+if minetest.get_modpath("bushes_classic") then
+
+ if eth then
+ minetest.register_alias("bushes:strawberry", "farming:strawberry")
+ else
+ minetest.register_alias("bushes:strawberry", "farming:raspberries")
+ end
+
+ minetest.register_alias("bushes:blueberry", "farming:blueberries")
+ minetest.register_alias("bushes:raspberry", "farming:raspberries")
+
+end \ No newline at end of file
diff --git a/farming/corn.lua b/farming/corn.lua
index 3c27ea3..402ec82 100644
--- a/farming/corn.lua
+++ b/farming/corn.lua
@@ -31,9 +31,21 @@ minetest.register_craft({
})
-- ethanol (thanks to JKMurray for this idea)
-minetest.register_craftitem("farming:bottle_ethanol", {
+minetest.register_node("farming:bottle_ethanol", {
description = S("Bottle of Ethanol"),
+ drawtype = "plantlike",
+ tiles = {"farming_bottle_ethanol.png"},
inventory_image = "farming_bottle_ethanol.png",
+ wield_image = "farming_bottle_ethanol.png",
+ paramtype = "light",
+ is_ground_content = false,
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
+ },
+ groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
+ sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft( {
diff --git a/farming/cucumber.lua b/farming/cucumber.lua
index 8e29215..eb29347 100644
--- a/farming/cucumber.lua
+++ b/farming/cucumber.lua
@@ -48,7 +48,7 @@ crop_def.tiles = {"farming_cucumber_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
- {items = {'farming:cucumber'}, rarity = 1},
+ {items = {'farming:cucumber 2'}, rarity = 1},
{items = {'farming:cucumber 2'}, rarity = 2},
}
}
diff --git a/farming/farming.conf_example b/farming/farming.conf_example
new file mode 100644
index 0000000..696d007
--- /dev/null
+++ b/farming/farming.conf_example
@@ -0,0 +1,27 @@
+
+--[[
+ Farming settings can be changed here and kept inside mod folder
+ even after the mod has been updated, or you can place inside
+ world folder for map specific settings.
+--]]
+
+-- true to enable crop/food in-game and on mapgen
+farming.carrot = true
+farming.potato = true
+farming.tomato = true
+farming.cucumber = true
+farming.corn = true
+farming.coffee = true
+farming.coffee = true
+farming.melon = true
+farming.sugar = true
+farming.pumpkin = true
+farming.cocoa = true
+farming.raspberry = true
+farming.blueberry = true
+farming.rhubarb = true
+farming.beans = true
+farming.grapes = true
+farming.barley = true
+farming.hemp = true
+farming.donuts = true
diff --git a/farming/hemp.lua b/farming/hemp.lua
new file mode 100644
index 0000000..29b6a42
--- /dev/null
+++ b/farming/hemp.lua
@@ -0,0 +1,213 @@
+
+local S = farming.intllib
+
+-- hemp seeds
+minetest.register_node("farming:seed_hemp", {
+ description = S("Hemp Seed"),
+ tiles = {"farming_hemp_seed.png"},
+ inventory_image = "farming_hemp_seed.png",
+ wield_image = "farming_hemp_seed.png",
+ drawtype = "signlike",
+ groups = {seed = 1, snappy = 3, attached_node = 1},
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ walkable = false,
+ sunlight_propagates = true,
+ selection_box = farming.select,
+ on_place = function(itemstack, placer, pointed_thing)
+ return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1")
+ end,
+})
+
+-- harvested hemp
+minetest.register_craftitem("farming:hemp_leaf", {
+ description = S("Hemp Leaf"),
+ inventory_image = "farming_hemp_leaf.png",
+})
+
+-- hemp oil
+minetest.register_node("farming:hemp_oil", {
+ description = S("Bottle of Hemp Oil"),
+ drawtype = "plantlike",
+ tiles = {"farming_hemp_oil.png"},
+ inventory_image = "farming_hemp_oil.png",
+ wield_image = "farming_hemp_oil.png",
+ paramtype = "light",
+ is_ground_content = false,
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
+ },
+ groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_craft( {
+ output = "farming:hemp_oil",
+ recipe = {
+ {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
+ {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
+ {"", "vessels:glass_bottle", ""}
+ }
+})
+
+minetest.register_craft( {
+ output = "farming:hemp_oil",
+ recipe = {
+ {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
+ {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
+ {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"}
+ }
+})
+
+minetest.register_craft({
+ type = "fuel",
+ recipe = "farming:hemp_oil",
+ burntime = 20,
+ replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}}
+})
+
+-- hemp fibre
+minetest.register_craftitem("farming:hemp_fibre", {
+ description = S("Hemp Fibre"),
+ inventory_image = "farming_hemp_fibre.png",
+})
+
+minetest.register_craft( {
+ output = "farming:hemp_fibre 8",
+ recipe = {
+ {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
+ {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"},
+ {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
+ },
+ replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
+})
+
+minetest.register_craft( {
+ output = "farming:hemp_fibre 8",
+ recipe = {
+ {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
+ {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"},
+ {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
+ },
+ replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}}
+})
+
+-- paper
+minetest.register_craft( {
+ output = "default:paper",
+ recipe = {
+ {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
+ }
+})
+
+-- string
+minetest.register_craft( {
+ output = "farming:cotton",
+ recipe = {
+ {"farming:hemp_fibre"},
+ {"farming:hemp_fibre"},
+ {"farming:hemp_fibre"},
+ }
+})
+
+-- hemp rope
+minetest.register_node("farming:hemp_rope", {
+ description = S("Hemp Rope"),
+ walkable = false,
+ climbable = true,
+ sunlight_propagates = true,
+ paramtype = "light",
+ tiles = {"farming_hemp_rope.png"},
+ wield_image = "farming_hemp_rope.png",
+ inventory_image = "farming_hemp_rope.png",
+ drawtype = "plantlike",
+ groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3},
+ sounds = default.node_sound_leaves_defaults(),
+ selection_box = {
+ type = "fixed",
+ fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
+ },
+})
+
+-- string
+minetest.register_craft( {
+ output = "farming:hemp_rope 6",
+ recipe = {
+ {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
+ {"farming:cotton", "farming:cotton", "farming:cotton"},
+ {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
+ }
+})
+
+-- hemp definition
+local crop_def = {
+ drawtype = "plantlike",
+ tiles = {"farming_hemp_1.png"},
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ buildable_to = true,
+ drop = "",
+ selection_box = farming.select,
+ groups = {
+ snappy = 3, flammable = 2, plant = 1, attached_node = 1,
+ not_in_creative_inventory = 1, growing = 1
+ },
+ sounds = default.node_sound_leaves_defaults()
+}
+
+-- stage 1
+minetest.register_node("farming:hemp_1", table.copy(crop_def))
+
+-- stage 2
+crop_def.tiles = {"farming_hemp_2.png"}
+minetest.register_node("farming:hemp_2", table.copy(crop_def))
+
+-- stage 3
+crop_def.tiles = {"farming_hemp_3.png"}
+minetest.register_node("farming:hemp_3", table.copy(crop_def))
+
+-- stage 4
+crop_def.tiles = {"farming_hemp_4.png"}
+minetest.register_node("farming:hemp_4", table.copy(crop_def))
+
+-- stage 5
+crop_def.tiles = {"farming_hemp_5.png"}
+minetest.register_node("farming:hemp_5", table.copy(crop_def))
+
+-- stage 6
+crop_def.tiles = {"farming_hemp_6.png"}
+crop_def.drop = {
+ items = {
+ {items = {'farming:hemp_leaf'}, rarity = 2},
+ {items = {'farming:seed_hemp'}, rarity = 1},
+ }
+}
+minetest.register_node("farming:hemp_6", table.copy(crop_def))
+
+-- stage 7
+crop_def.tiles = {"farming_hemp_7.png"}
+crop_def.drop = {
+ items = {
+ {items = {'farming:hemp_leaf'}, rarity = 1},
+ {items = {'farming:hemp_leaf'}, rarity = 3},
+ {items = {'farming:seed_hemp'}, rarity = 1},
+ {items = {'farming:seed_hemp'}, rarity = 3},
+ }
+}
+minetest.register_node("farming:hemp_7", table.copy(crop_def))
+
+-- stage 8 (final)
+crop_def.tiles = {"farming_hemp_8.png"}
+crop_def.groups.growing = 0
+crop_def.drop = {
+ items = {
+ {items = {'farming:hemp_leaf 2'}, rarity = 1},
+ {items = {'farming:hemp_leaf'}, rarity = 2},
+ {items = {'farming:seed_hemp'}, rarity = 1},
+ {items = {'farming:seed_hemp'}, rarity = 2},
+ }
+}
+minetest.register_node("farming:hemp_8", table.copy(crop_def))
diff --git a/farming/init.lua b/farming/init.lua
index 2d64f61..07e935c 100644
--- a/farming/init.lua
+++ b/farming/init.lua
@@ -1,5 +1,5 @@
--[[
- Minetest Farming Redo Mod 1.23 (12th November 2016)
+ Farming Redo Mod 1.25 (6th May 2017)
by TenPlus1
NEW growing routine by prestidigitator
auto-refill by crabman77
@@ -14,38 +14,6 @@ farming.select = {
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
}
-farming.DEBUG = false
--- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions
-
-local DEBUG_abm_runs = 0
-local DEBUG_abm_time = 0
-local DEBUG_timer_runs = 0
-local DEBUG_timer_time = 0
-
-if farming.DEBUG then
-
- function farming.DEBUG.reset_times()
- DEBUG_abm_runs = 0
- DEBUG_abm_time = 0
- DEBUG_timer_runs = 0
- DEBUG_timer_time = 0
- end
-
- function farming.DEBUG.report_times()
-
- local abm_n = DEBUG_abm_runs
- local abm_dt = DEBUG_abm_time
- local abm_avg = (abm_n > 0 and abm_dt / abm_n) or 0
- local timer_n = DEBUG_timer_runs
- local timer_dt = DEBUG_timer_time
- local timer_avg = (timer_n > 0 and timer_dt / timer_n) or 0
- local dt = abm_dt + timer_dt
-
- print("ABM ran for "..abm_dt.."µs over "..abm_n.." runs: "..abm_avg.."µs/run")
- print("Timer ran for "..timer_dt.."µs over "..timer_n.." runs: "..timer_avg.."µs/run")
- print("Total farming time: "..dt.."µs")
- end
-end
local statistics = dofile(farming.path.."/statistics.lua")
@@ -353,23 +321,6 @@ end)
local abm_func = farming.handle_growth
-if farming.DEBUG then
-
- local normal_abm_func = abm_func
-
- abm_func = function(...)
-
- local t0 = minetest.get_us_time()
- local r = { normal_abm_func(...) }
- local t1 = minetest.get_us_time()
-
- DEBUG_abm_runs = DEBUG_abm_runs + 1
- DEBUG_abm_time = DEBUG_abm_time + (t1 - t0)
-
- return unpack(r)
- end
-end
-
-- Just in case a growing type or added node is missed (also catches existing
-- nodes added to map before timers were incorporated).
@@ -399,8 +350,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
if stages.plant_name == "farming:cocoa" then
- if not minetest.find_node_near(pos, 1,
- {"default:jungletree", "moretrees:jungletree_leaves_green"}) then
+ if not minetest.find_node_near(pos, 1, {"default:jungletree"}) then
return true
end
@@ -465,23 +415,6 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
return growth ~= max_growth
end
-if farming.DEBUG then
-
- local timer_func = farming.plant_growth_timer;
-
- farming.plant_growth_timer = function(pos, elapsed, node_name)
-
- local t0 = minetest.get_us_time()
- local r = { timer_func(pos, elapsed, node_name) }
- local t1 = minetest.get_us_time()
-
- DEBUG_timer_runs = DEBUG_timer_runs + 1
- DEBUG_timer_time = DEBUG_timer_time + (t1 - t0)
-
- return unpack(r)
- end
-end
-
-- refill placed plant by crabman (26/08/2015)
local can_refill_plant = {
["farming:blueberry_1"] = "farming:blueberries",
@@ -502,6 +435,7 @@ local can_refill_plant = {
["farming:rhubarb_1"] = "farming:rhubarb",
["farming:cocoa_1"] = "farming:cocoa_beans",
["farming:barley_1"] = "farming:seed_barley",
+ ["farming:hemp_1"] = "farming:seed_hemp",
}
function farming.refill_plant(player, plantname, index)
@@ -595,7 +529,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
end
end
--- Function to register plants (for compatibility)
+-- Function to register plants (default farming compatibility)
farming.register_plant = function(name, def)
@@ -680,7 +614,7 @@ farming.register_plant = function(name, def)
sounds = default.node_sound_leaves_defaults(),
})
--- register_plant_node(node_name)
+ register_plant_node(node_name)
end
-- Return info
@@ -688,30 +622,71 @@ farming.register_plant = function(name, def)
return r
end
--- load crops
+-- default settings
+farming.carrot = true
+farming.potato = true
+farming.tomato = true
+farming.cucumber = true
+farming.corn = true
+farming.coffee = true
+farming.coffee = true
+farming.melon = true
+farming.sugar = true
+farming.pumpkin = true
+farming.cocoa = true
+farming.raspberry = true
+farming.blueberry = true
+farming.rhubarb = true
+farming.beans = true
+farming.grapes = true
+farming.barley = true
+farming.hemp = true
+farming.donuts = true
+
+
+-- Load new global settings if found inside mod folder
+local input = io.open(farming.path.."/farming.conf", "r")
+if input then
+ dofile(farming.path .. "/farming.conf")
+ input:close()
+ input = nil
+end
+
+-- load new world-specific settings if found inside world folder
+local worldpath = minetest.get_worldpath()
+local input = io.open(worldpath.."/farming.conf", "r")
+if input then
+ dofile(worldpath .. "/farming.conf")
+ input:close()
+ input = nil
+end
+
+
+-- load crops
dofile(farming.path.."/soil.lua")
dofile(farming.path.."/hoes.lua")
dofile(farming.path.."/grass.lua")
dofile(farming.path.."/wheat.lua")
dofile(farming.path.."/cotton.lua")
-dofile(farming.path.."/carrot.lua")
-dofile(farming.path.."/potato.lua")
-dofile(farming.path.."/tomato.lua")
-dofile(farming.path.."/cucumber.lua")
-dofile(farming.path.."/corn.lua")
-dofile(farming.path.."/coffee.lua")
-dofile(farming.path.."/melon.lua")
-dofile(farming.path.."/sugar.lua")
-dofile(farming.path.."/pumpkin.lua")
-dofile(farming.path.."/cocoa.lua")
-dofile(farming.path.."/raspberry.lua")
-dofile(farming.path.."/blueberry.lua")
-dofile(farming.path.."/rhubarb.lua")
-dofile(farming.path.."/beanpole.lua")
-dofile(farming.path.."/grapes.lua")
-dofile(farming.path.."/barley.lua")
-dofile(farming.path.."/donut.lua")
+if farming.carrot then dofile(farming.path.."/carrot.lua") end
+if farming.potato then dofile(farming.path.."/potato.lua") end
+if farming.tomato then dofile(farming.path.."/tomato.lua") end
+if farming.cucumber then dofile(farming.path.."/cucumber.lua") end
+if farming.corn then dofile(farming.path.."/corn.lua") end
+if farming.coffee then dofile(farming.path.."/coffee.lua") end
+if farming.melon then dofile(farming.path.."/melon.lua") end
+if farming.sugar then dofile(farming.path.."/sugar.lua") end
+if farming.pumpkin then dofile(farming.path.."/pumpkin.lua") end
+if farming.cocoa then dofile(farming.path.."/cocoa.lua") end
+if farming.raspberry then dofile(farming.path.."/raspberry.lua") end
+if farming.blueberry then dofile(farming.path.."/blueberry.lua") end
+if farming.rhubarb then dofile(farming.path.."/rhubarb.lua") end
+if farming.beans then dofile(farming.path.."/beanpole.lua") end
+if farming.grapes then dofile(farming.path.."/grapes.lua") end
+if farming.barley then dofile(farming.path.."/barley.lua") end
+if farming.hemp then dofile(farming.path.."/hemp.lua") end
+if farming.donuts then dofile(farming.path.."/donut.lua") end
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility
dofile(farming.path.."/lucky_block.lua")
diff --git a/farming/locale/de.txt b/farming/locale/de.txt
index 82cee4f..9b85a04 100644
--- a/farming/locale/de.txt
+++ b/farming/locale/de.txt
@@ -74,7 +74,7 @@ Baked Potato = Ofenkartoffel
#pumpkin.lua
Pumpkin = Kürbis
Pumpkin Slice = Kürbisscheibe
-Jack 'O Lantern = Kürbislaterne
+Jack 'O Lantern (punch to turn on and off) = Kürbislaterne (Punch zum Ein- und Ausschalten)
Pumpkin Bread = Kürbisbrot
Pumpkin Dough = Kürbisteig
diff --git a/farming/locale/template.txt b/farming/locale/template.txt
index 6d067f5..3f52730 100644
--- a/farming/locale/template.txt
+++ b/farming/locale/template.txt
@@ -72,7 +72,7 @@ Baked Potato =
#pumpkin.lua
Pumpkin =
Pumpkin Slice =
-Jack 'O Lantern =
+Jack 'O Lantern (punch to turn on and off) =
Pumpkin Bread =
Pumpkin Dough =
diff --git a/farming/lucky_block.lua b/farming/lucky_block.lua
index df5c54f..94d7d36 100644
--- a/farming/lucky_block.lua
+++ b/farming/lucky_block.lua
@@ -14,5 +14,6 @@ if minetest.get_modpath("lucky_block") then
{"dro", {"farming:bottle_ethanol"}, 1},
{"nod", "farming:melon", 0},
{"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5},
+ {"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 5},
})
end
diff --git a/farming/mapgen.lua b/farming/mapgen.lua
index 36d4792..090c193 100644
--- a/farming/mapgen.lua
+++ b/farming/mapgen.lua
@@ -1,5 +1,11 @@
+
-- decoration function
-local function register_plant(name, min, max, spawnby, num)
+local function register_plant(name, min, max, spawnby, num, enabled)
+
+ if enabled ~= true then
+ return
+ end
+
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
@@ -20,46 +26,50 @@ local function register_plant(name, min, max, spawnby, num)
})
end
-function farming.register_mgv6_decorations()
- register_plant("potato_3", 15, 40, "", -1)
- register_plant("tomato_7", 5, 20, "", -1)
- register_plant("carrot_8", 1, 30, "group:water", 1)
- register_plant("cucumber_4", 1, 20, "group:water", 1)
- register_plant("corn_7", 12, 22, "", -1)
- register_plant("corn_8", 10, 20, "", -1)
- register_plant("coffee_5", 20, 45, "", -1)
- register_plant("melon_8", 1, 20, "group:water", 1)
- register_plant("pumpkin_8", 1, 20, "group:water", 1)
- register_plant("raspberry_4", 3, 10, "", -1)
- register_plant("rhubarb_3", 3, 15, "", -1)
- register_plant("blueberry_4", 3, 10, "", -1)
- register_plant("beanbush", 18, 35, "", -1)
- register_plant("grapebush", 25, 45, "", -1)
-end
--- v7 maps have a beach so plants growing near water is limited to 6 high
-function farming.register_mgv7_decorations()
- register_plant("potato_3", 15, 40, "", -1)
- register_plant("tomato_7", 5, 20, "", -1)
- register_plant("carrot_8", 1, 6, "", -1)
- register_plant("cucumber_4", 1, 6, "", -1)
- register_plant("corn_7", 12, 22, "", -1)
- register_plant("corn_8", 10, 20, "", -1)
- register_plant("coffee_5", 20, 45, "", -1)
- register_plant("melon_8", 1, 6, "", -1)
- register_plant("pumpkin_8", 1, 6, "", -1)
- register_plant("raspberry_4", 3, 10, "", -1)
- register_plant("rhubarb_3", 3, 15, "", -1)
- register_plant("blueberry_4", 3, 10, "", -1)
- register_plant("beanbush", 18, 35, "", -1)
- register_plant("grapebush", 25, 45, "", -1)
-end
+-- add crops to mapgen
+register_plant("potato_3", 15, 40, "", -1, farming.potato)
+register_plant("tomato_7", 5, 20, "", -1, farming.tomato)
+register_plant("corn_7", 12, 22, "", -1, farming.corn)
+register_plant("coffee_5", 20, 45, "", -1, farming.coffee)
+register_plant("raspberry_4", 3, 10, "", -1, farming.raspberry)
+register_plant("rhubarb_3", 3, 15, "", -1, farming.rhubarb)
+register_plant("blueberry_4", 3, 10, "", -1, farming.blueberry)
+register_plant("beanbush", 18, 35, "", -1, farming.beans)
+register_plant("grapebush", 25, 45, "", -1, farming.grapes)
+
--- detect mapgen
-local mg_name = minetest.get_mapgen_params().mgname
+if minetest.get_mapgen_params().mgname == "v6" then
-if mg_name == "v6" then
- farming.register_mgv6_decorations()
+ register_plant("carrot_8", 1, 30, "group:water", 1, farming.carrot)
+ register_plant("cucumber_4", 1, 20, "group:water", 1, farming.cucumber)
+ register_plant("melon_8", 1, 20, "group:water", 1, farming.melon)
+ register_plant("pumpkin_8", 1, 20, "group:water", 1, farming.pumpkin)
else
- farming.register_mgv7_decorations()
+ -- v7 maps have a beach so plants growing near water is limited to 6 high
+ register_plant("carrot_8", 1, 6, "", -1, farming.carrot)
+ register_plant("cucumber_4", 1, 6, "", -1, farming.cucumber)
+ register_plant("melon_8", 1, 6, "", -1, farming.melon)
+ register_plant("pumpkin_8", 1, 6, "", -1, farming.pumpkin)
+end
+
+if farming.hemp then
+minetest.register_decoration({
+ deco_type = "simple",
+ place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
+ sidelen = 16,
+ noise_params = {
+ offset = 0,
+ scale = 0.06,
+ spread = {x = 100, y = 100, z = 100},
+ seed = 420,
+ octaves = 3,
+ persist = 0.6
+ },
+ y_min = 5,
+ y_max = 35,
+ decoration = "farming:hemp_7",
+ spawn_by = "group:tree",
+ num_spawn_by = 1,
+})
end
diff --git a/farming/pumpkin.lua b/farming/pumpkin.lua
index 4be0bf4..8bff778 100644
--- a/farming/pumpkin.lua
+++ b/farming/pumpkin.lua
@@ -53,7 +53,7 @@ minetest.register_craft({
-- jack 'o lantern
minetest.register_node("farming:jackolantern", {
- description = S("Jack 'O Lantern"),
+ description = S("Jack 'O Lantern (punch to turn on and off)"),
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
diff --git a/farming/textures/farming_hemp_1.png b/farming/textures/farming_hemp_1.png
new file mode 100644
index 0000000..6fb4510
--- /dev/null
+++ b/farming/textures/farming_hemp_1.png
Binary files differ
diff --git a/farming/textures/farming_hemp_2.png b/farming/textures/farming_hemp_2.png
new file mode 100644
index 0000000..a676173
--- /dev/null
+++ b/farming/textures/farming_hemp_2.png
Binary files differ
diff --git a/farming/textures/farming_hemp_3.png b/farming/textures/farming_hemp_3.png
new file mode 100644
index 0000000..57136d5
--- /dev/null
+++ b/farming/textures/farming_hemp_3.png
Binary files differ
diff --git a/farming/textures/farming_hemp_4.png b/farming/textures/farming_hemp_4.png
new file mode 100644
index 0000000..b375cf3
--- /dev/null
+++ b/farming/textures/farming_hemp_4.png
Binary files differ
diff --git a/farming/textures/farming_hemp_5.png b/farming/textures/farming_hemp_5.png
new file mode 100644
index 0000000..890a3d2
--- /dev/null
+++ b/farming/textures/farming_hemp_5.png
Binary files differ
diff --git a/farming/textures/farming_hemp_6.png b/farming/textures/farming_hemp_6.png
new file mode 100644
index 0000000..258d4e3
--- /dev/null
+++ b/farming/textures/farming_hemp_6.png
Binary files differ
diff --git a/farming/textures/farming_hemp_7.png b/farming/textures/farming_hemp_7.png
new file mode 100644
index 0000000..1ce3a8d
--- /dev/null
+++ b/farming/textures/farming_hemp_7.png
Binary files differ
diff --git a/farming/textures/farming_hemp_8.png b/farming/textures/farming_hemp_8.png
new file mode 100644
index 0000000..8d2143f
--- /dev/null
+++ b/farming/textures/farming_hemp_8.png
Binary files differ
diff --git a/farming/textures/farming_hemp_fibre.png b/farming/textures/farming_hemp_fibre.png
new file mode 100644
index 0000000..fe3c918
--- /dev/null
+++ b/farming/textures/farming_hemp_fibre.png
Binary files differ
diff --git a/farming/textures/farming_hemp_leaf.png b/farming/textures/farming_hemp_leaf.png
new file mode 100644
index 0000000..997c8f0
--- /dev/null
+++ b/farming/textures/farming_hemp_leaf.png
Binary files differ
diff --git a/farming/textures/farming_hemp_oil.png b/farming/textures/farming_hemp_oil.png
new file mode 100644
index 0000000..fa8afe2
--- /dev/null
+++ b/farming/textures/farming_hemp_oil.png
Binary files differ
diff --git a/farming/textures/farming_hemp_rope.png b/farming/textures/farming_hemp_rope.png
new file mode 100644
index 0000000..03a7082
--- /dev/null
+++ b/farming/textures/farming_hemp_rope.png
Binary files differ
diff --git a/farming/textures/farming_hemp_seed.png b/farming/textures/farming_hemp_seed.png
new file mode 100644
index 0000000..6be42c8
--- /dev/null
+++ b/farming/textures/farming_hemp_seed.png
Binary files differ