code:
local S = minetest.get_translator(minetest.get_current_modname())

local function deep_copy(table_in)
	local table_out = {}
	for index, value in pairs(table_in) do
		if type(value) == "table" then
			table_out[index] = deep_copy(value)
		else
			table_out[index] = value
		end
	end
	return table_out
end

local config = df_dependencies.config

local lowest_elevation = config.sunless_sea_min
if config.enable_oil_sea then
	lowest_elevation = config.oil_sea_level
end
if config.enable_lava_sea then
	lowest_elevation = config.lava_sea_level
end
if config.enable_underworld then
	lowest_elevation = config.underworld_level
end
if config.enable_primordial then
	lowest_elevation = config.primordial_min
end
lowest_elevation = lowest_elevation - 193 -- add a little buffer space

df_dependencies.mods_required.mcl_init = true
df_dependencies.mods_required.mcl_worlds = true
df_dependencies.mods_required.mcl_strongholds = true
df_dependencies.mods_required.mcl_compatibility = true
df_dependencies.mods_required.mcl_mapgen = true

local old_overworld_min

local ores_extended = false
local extend_ores = function()
	if ores_extended then return end -- should only do this once.
	ores_extended = true
	local ores_registered = {}
	for key, val in pairs(minetest.registered_ores) do
		ores_registered[val.ore] = true
	end

	local wherein_stonelike = {"mcl_core:stone"}
	local localseed = 12345

	local stone_blobs = {
		wherein = wherein_stonelike,
		clust_scarcity = 1000,
		clust_size = 7,
		y_min = lowest_elevation,
		y_max = old_overworld_min,
		ore_type = "blob",
		clust_num_ores = 58,
		noise_params = {
			octaves = 3,
			seed = 12345,
			lacunarity = 2,
			spread = {
				y = 250,
				x = 250,
				z = 250
			},
			persist = 0.6,
			flags = "defaults",
			offset = 0,
			scale = 1
		},
	}

	local register_blob = function(ore, cluster_size, cluster_scarcity_cuberoot, ymin, ymax)
		localseed = localseed + 1 -- increment this every time it's called to ensure different distributions
		local blob_copy = deep_copy(stone_blobs)
		blob_copy.ore = ore
		blob_copy.clust_num_ores = cluster_size
		blob_copy.clust_size = math.ceil(math.sqrt(cluster_size))
		blob_copy.clust_scarcity = cluster_scarcity_cuberoot*cluster_scarcity_cuberoot*cluster_scarcity_cuberoot
		blob_copy.seed = localseed
		blob_copy.y_min = ymin or stone_blobs.y_min
		blob_copy.y_max = ymax or stone_blobs.y_max
		--minetest.debug(dump(blob_copy))
		minetest.register_ore(blob_copy)
	end

	local scattered_ore = {
		wherein        = wherein_stonelike,
		ore_type       = "scatter",
		--ore            = "mcl_core:stone_with_coal",
		clust_scarcity = 525*3,
		clust_num_ores = 5,
		clust_size     = 3,
		y_min = lowest_elevation,
		y_max = old_overworld_min,
		noise_params   = deep_copy(stone_blobs.noise_params), -- since there's so much volume to scatter ore in, using noise to make some regions "rich" and others "poor" for variety
		noise_threshold= 0,
	}

	local register_scattered_internal = function(ore, cluster_size, cluster_scarcity_cuberoot, threshold, ymin, ymax, wherein)
		local scattered_copy = deep_copy(scattered_ore)
		scattered_copy.ore = ore
		scattered_copy.clust_size = cluster_size*cluster_size*cluster_size
		scattered_copy.clust_scarcity = cluster_scarcity_cuberoot*cluster_scarcity_cuberoot*cluster_scarcity_cuberoot
		scattered_copy.clust_num_ores = math.ceil(scattered_copy.clust_size/3)
		scattered_copy.seed = localseed
		scattered_copy.threshold = threshold
		scattered_copy.y_min = ymin or scattered_ore.y_min
		scattered_copy.y_max = ymax or scattered_ore.y_max
		scattered_copy.wherein = wherein or scattered_ore.wherein
		--minetest.debug(dump(scattered_copy))
		minetest.register_ore(scattered_copy)
	end
	local register_scattered = function(ore, cluster_size, cluster_scarcity_cuberoot, ymin, ymax, wherein)
		assert(not (ymin and ymax) or ymin < ymax, "Elevation parameter error for register_scattered")
		localseed = localseed + 1 -- increment this every time it's called to ensure different distributions
		-- same seed makes the noise patterns overlap.
		-- one produces widespread smaller clusters, other produces larger clusters at the peaks of the noise in addition to the smaller ones
		register_scattered_internal(ore, cluster_size, cluster_scarcity_cuberoot, 0, ymin, ymax, wherein)
		register_scattered_internal(ore, cluster_size*2, cluster_scarcity_cuberoot, 0.25, ymin, ymax, wherein)
	end

	if ores_registered["mcl_core:diorite"] then
		register_blob("mcl_core:diorite", 58, 10)
		register_blob("mcl_core:diorite", 33, 15)
		table.insert(wherein_stonelike, "mcl_core:diorite")
	end
	if ores_registered["mcl_core:andesite"] then
		register_blob("mcl_core:andesite", 58, 10)
		register_blob("mcl_core:andesite", 33, 15)
		table.insert(wherein_stonelike, "mcl_core:andesite")
	end
	if ores_registered["mcl_core:granite"] then
		register_blob("mcl_core:granite", 58, 10)
		register_blob("mcl_core:granite", 33, 15)
		table.insert(wherein_stonelike, "mcl_core:granite")
	end
	if ores_registered["mcl_core:dirt"] then
		register_blob("mcl_core:dirt", 33, 15, config.sunless_sea_min)
		if config.enable_primordial then
			register_blob("mcl_core:dirt", 33, 15, config.primordial_min, config.primoridal_max)
		end
	end
	if ores_registered["mcl_core:gravel"] then
		register_blob("mcl_core:gravel", 33, 14)
	end

	if ores_registered["mcl_core:stone_with_iron"] then
		register_scattered("mcl_core:stone_with_iron", 3, 12)
	end
	if ores_registered["mcl_core:stone_with_coal"] then
		register_scattered("mcl_core:stone_with_coal", 3, 12)
		if config.enable_oil_sea then
			register_blob("mcl_core:stone_with_coal", 80, 10, config.oil_sea_level-200, config.oil_sea_level+200) -- tons of coal in the oil sea
		end
	end

	if ores_registered["mcl_core:stone_with_lapis"] then
		register_scattered("mcl_core:stone_with_lapis", 3, 25, config.sunless_sea_min, config.level3_min) -- Lapis is an ocean gem, I decided
		if config.enable_primordial then
			register_scattered("mcl_core:stone_with_lapis", 3, 25, config.primordial_min, config.primordial_max)
		end
	end

	if ores_registered["mcl_core:stone_with_redstone"] then
		register_scattered("mcl_core:stone_with_redstone", 3, 15, config.level3_min, config.level2_min) -- Level 3 is the most magical, scatter redstone there
		if config.enable_lava_sea then
			register_scattered("mcl_core:stone_with_redstone", 4, 15, config.lava_sea_level-200, config.lava_sea_level+100) -- and of course plenty of redstone in the lava sea
		end
	end

	if ores_registered["mcl_core:stone_with_diamond"] then
		register_scattered("mcl_core:stone_with_diamond", 2, 18, config.sunless_sea_min, config.level2_min)
		if config.enable_oil_sea then
			register_scattered("mcl_core:stone_with_diamond", 3, 18, config.oil_sea_level-200, config.oil_sea_level+200)
		end
		if config.enable_primordial then
			register_scattered("mcl_core:stone_with_diamond", 3, 15, config.primordial_min, config.primordial_max)
		end
	end

	if ores_registered["mcl_core:stone_with_gold"] then
		register_scattered("mcl_core:stone_with_gold", 2, 18)
		if config.enable_primordial then
			register_scattered("mcl_core:stone_with_gold", 3, 15, config.primordial_min, config.primordial_max)
		end
	end

	if ores_registered["mcl_core:stone_with_copper"] then
		register_scattered("mcl_core:stone_with_copper", 3, 18)
	end

	if ores_registered["mcl_deepslate:deepslate"] then
		register_blob("mcl_deepslate:deepslate", 33, 15, lowest_elevation, config.sunless_sea_min) -- it's called deepslate, so put it deep
	end
	if ores_registered["mcl_deepslate:tuff"] then
		register_blob("mcl_deepslate:tuff", 33, 15, lowest_elevation, config.sunless_sea_min)
	end

	if ores_registered["mcl_deepslate:deepslate_with_emerald"] then
		register_scattered("mcl_deepslate:deepslate_with_emerald", 1, 25, lowest_elevation, config.sunless_sea_min, "mcl_deepslate:deepslate")
	end
	if ores_registered["mcl_core:stone_with_emerald"] then
		register_scattered("mcl_core:stone_with_emerald", 1, 25, lowest_elevation, config.sunless_sea_min)
	end

end

if minetest.get_modpath("mcl_init") then -- Mineclone 2

	old_overworld_min = mcl_vars.mg_overworld_min -- remember this for weather control

	mcl_vars.mg_overworld_min = lowest_elevation
	mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
	mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
	mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000

	-- shouldn't need to worry about the setting, extend_ores checks if the ores
	-- have already been registered.
	--if minetest.settings:get_bool("mcl_generate_ores", true) then
		extend_ores()
	--end

	df_dependencies.mods_required.mcl_structures = true
	-- never mind - add dependency on mcl_strongholds and these will get generated before overworld_min gets changed.
	--if minetest.get_modpath("mcl_structures") and minetest.get_modpath("mcl_strongholds") then
	--	local elevation_delta = old_overworld_min - lowest_elevation
	--	local strongholds = mcl_structures.get_structure_data("stronghold")
	--	mcl_structures.register_structure_data("stronghold", strongholds)
	--end
end
if minetest.get_modpath("mcl_compatibility") then -- Mineclone 5
	old_overworld_min = mcl_vars.mg_overworld_min -- remember this for weather control

	mcl_vars.mg_overworld_min = lowest_elevation
	mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
	mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_overworld_min+4
	mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min+6
	mcl_vars.mg_lava = false
	mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
	mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max
	mcl_vars.mg_realm_barrier_overworld_end_min = mcl_vars.mg_end_max-11
end
if minetest.get_modpath("mcl_mapgen") then -- Mineclone 5
	old_overworld_min = mcl_mapgen.overworld.min -- remember this for weather control

	mcl_mapgen.overworld.min = lowest_elevation
	mcl_mapgen.overworld.bedrock_min = mcl_mapgen.overworld.min
	mcl_mapgen.overworld.bedrock_max = mcl_mapgen.overworld.bedrock_min + (mcl_mapgen.bedrock_is_rough and 4 or 0)
	mcl_mapgen.overworld.lava_max = mcl_mapgen.overworld.min+6
	mcl_mapgen.overworld.railcorridors_height_min = -50
	mcl_mapgen.overworld.railcorridors_height_max = -2

	mcl_mapgen.end_.max = mcl_mapgen.overworld.min - 2000
	mcl_mapgen.realm_barrier_overworld_end_max = mcl_mapgen.end_.max
	mcl_mapgen.realm_barrier_overworld_end_min = mcl_mapgen.end_.max - 11

	if mcl_mapgen.on_settings_changed then
		mcl_mapgen.on_settings_changed()
	else
		minetest.log("error", "The installed version of the mcl_mapgen mod (part of Mineclone 5) "
		.."does not have an mcl_mapgen.on_settings_changed method. This will likely result in "
		.."altitudes below the original bedrock being inaccessible to players.")
	end

	extend_ores()
end
if minetest.get_modpath("mcl_worlds") then
	local old_has_weather = mcl_worlds.has_weather
	mcl_worlds.has_weather = function(pos)
		-- No weather in the deep caverns
		if pos.y >= lowest_elevation and pos.y <= old_overworld_min then
			return false
		end
		return old_has_weather(pos)
	end
end


code:
local S = minetest.get_translator(minetest.get_current_modname())

local select_required = df_dependencies.select_required
local select_optional = df_dependencies.select_optional

df_dependencies.mods_required.farming = true

-- If the farming mod is installed, add the "straw" group to farming straw.
-- This way goblin caps just need to check for group:straw to get cave straw as well
local straw_def = minetest.registered_items["farming:straw"]
if straw_def then
	local new_groups = {}
	for group, val in pairs(straw_def.groups) do
		new_groups[group] = val
	end
	new_groups.straw = 1
	minetest.override_item("farming:straw", {
		groups = new_groups
	})
end

-- used to determine colour of spindlestem caps
if minetest.get_modpath("default") then
	df_dependencies.data_iron_containing_nodes = {"default:stone_with_iron", "default:steelblock"}
	df_dependencies.data_copper_containing_nodes = {"default:stone_with_copper", "default:copperblock"}
	df_dependencies.data_mese_containing_nodes = {"default:stone_with_mese", "default:mese"}
elseif minetest.get_modpath("mcl_core") then
	df_dependencies.data_iron_containing_nodes = {}
	minetest.after(0, function()
		for nodename, _ in pairs(minetest.registered_nodes) do
			if string.find(nodename, "iron") then
				table.insert(df_dependencies.data_iron_containing_nodes, nodename)
			end
		end
	end)
	df_dependencies.data_copper_containing_nodes = {}
	minetest.after(0, function()
		for nodename, _ in pairs(minetest.registered_nodes) do
			if string.find(nodename, "copper") then
				table.insert(df_dependencies.data_copper_containing_nodes, nodename)
			end
		end
	end)
	df_dependencies.data_mese_containing_nodes = {"mcl_deepslate:deepslate_with_redstone", "mcl_deepslate:deepslate_with_redstone_lit",
		"mcl_core:stone_with_redstone", "mcl_core:stone_with_redstone_lit", "group:mesecon_conductor_craftable", "group:mesecon", "group:mesecon_effector_off"}
end

-- common nodes that can be found next to pit plasma, triggering matter degradation
-- don't trigger on air, that's for sparkle generation
df_dependencies.abm_pit_plasma_neighbors = {"group:stone", "group:lava", "group:water", "group:material_stone"}

df_dependencies.texture_cobble = select_required({{"default", "default_cobble.png"}, {"mcl_core", "default_cobble.png"}})
df_dependencies.texture_coral_skeleton = select_required({{"default", "default_coral_skeleton.png"}, {"mcl_ocean", "mcl_ocean_dead_horn_coral_block.png"}})
df_dependencies.texture_dirt = select_required({{"default", "default_dirt.png"}, {"mcl_core", "default_dirt.png"}})
df_dependencies.texture_gold_block = select_required({{"default", "default_gold_block.png"}, {"mcl_core", "default_gold_block.png"}})
df_dependencies.texture_ice = select_required({{"default", "default_ice.png"}, {"mcl_core", "default_ice.png"}})
df_dependencies.texture_sand = select_required({{"default", "default_sand.png"}, {"mcl_core", "default_sand.png"}})
df_dependencies.texture_stone = select_required({{"default", "default_stone.png"}, {"mcl_core", "default_stone.png"}})
df_dependencies.texture_wood = select_required({{"default", "default_wood.png"}, {"mcl_core", "default_wood.png"}})
df_dependencies.texture_mineral_coal = select_required({{"default", "default_mineral_coal.png"}, {"mcl_core", "mcl_core_coal_ore.png"}}) -- MCL's coal texture isn't transparent, but is only used with gas seeps and should work fine that way
df_dependencies.texture_glass_bottle = select_required({{"vessels", "vessels_glass_bottle.png"}, {"mcl_potions", "mcl_potions_potion_bottle.png"}})
df_dependencies.texture_meselamp = "dfcaverns_glow_mese.png"

df_dependencies.texture_tool_steelhoe = select_required({{"default", "farming_tool_steelhoe.png"}, {"mcl_farming", "farming_tool_steelhoe.png"}})
df_dependencies.texture_tool_steelpick = select_required({{"default", "default_tool_steelpick.png"}, {"mcl_farming", "default_tool_steelpick.png"}})
df_dependencies.texture_tool_steelshovel = select_required({{"default", "default_tool_steelshovel.png"}, {"mcl_farming", "default_tool_steelshovel.png"}})
df_dependencies.texture_farming_soil = select_required({{"default", "(default_dirt.png^farming_soil.png)"}, {"mcl_farming", "mcl_farming_farmland_dry.png"}})

df_dependencies.texture_mapping_kit = select_required({{"default", "map_mapping_kit.png"}, {"mcl_maps", "mcl_maps_map_filled.png"}})

df_dependencies.nethercap_name = S("Nethercap")
if minetest.get_modpath("mcl_mapgen_core") then
	-- since there's a whole layer called the Nether in Mineclone and it has its own mushrooms, rename
	-- nethercaps when that's present to avoid confusion.
	df_dependencies.nethercap_name = S("Icecap")
end

repo_name: korkut/MeseCraft

license: mit


code:
name = df_dependencies
description = A utility mod for df_caverns that gathers all dependencies on minetest_game in one place, to ease cross-compatibility efforts with Minetest Game, MineClone2 and MineClone5.
depends =
optional_depends = mesecraft_beds, mesecraft_bucket, default, doors, farming, fireflies, mcl_beds, mcl_buckets, mcl_chests, mcl_compatibility, mcl_copper, mcl_core, mcl_doors, mcl_explosions, mcl_farming, mcl_fences, mcl_formspec, mcl_furnaces, mcl_init, mcl_mapgen, mcl_maps, mcl_mobitems, mcl_ocean, mcl_potions, mcl_sounds, mcl_stairs, mcl_strongholds, mcl_tnt, mcl_torches, mcl_wool, mcl_worlds, mclx_core, mesecons, moreblocks, stairs, tnt, vessels, wool
supported_games = minetest_game, MineClone2


code:
local S = minetest.get_translator(minetest.get_current_modname())

local required_nodes = {}
local function select_required(def)
	local newdef = {}
	for _, node in ipairs(def) do
		table.insert(newdef, {string.match(node, "(.-):"), node})
	end
	local ret = df_dependencies.select_required(newdef)
	table.insert(required_nodes, ret)
	return ret
end

local function select_optional(def)
	local newdef = {}
	for _, node in ipairs(def) do
		table.insert(newdef, {string.match(node, "(.-):"), node})
	end
	local ret = df_dependencies.select_optional(newdef)
	table.insert(required_nodes, ret)
	return ret
end

minetest.after(0, function()
	-- "after" needs to be used here because some of these nodes actually get registered in DF Caverns itself
	-- stair nodes, for example, depend on the stairs mod but get registered from here. Kind of weird but
	-- one goes to war with the mods one has.
	local problem_nodes = {}
	for _, node_name in pairs(required_nodes) do
		if minetest.registered_items[node_name] == nil then
			table.insert(problem_nodes, node_name)
		end
	end

	assert(#problem_nodes == 0, "Nodes " .. table.concat(problem_nodes, ", ") .. " were returned by a selection call but are not registered.")
end)

df_dependencies.node_name_apple = select_required({"default:apple", "mcl_core:apple"})
df_dependencies.node_name_chest = select_required({"default:chest", "mcl_chests:chest"})
df_dependencies.node_name_coalblock = select_required({"default:coalblock", "mcl_core:coalblock"})
df_dependencies.node_name_coal_lump = select_required({"default:coal_lump", "mcl_core:coal_lump"})
df_dependencies.node_name_cobble = select_required({"default:cobble", "mcl_core:cobble"})
df_dependencies.node_name_coral_skeleton = select_required({"default:coral_skeleton", "mcl_ocean:dead_horn_coral_block"})
df_dependencies.node_name_desert_sand = select_required({"default:desert_sand", "mcl_core:redsand"})
df_dependencies.node_name_dirt = select_required({"default:dirt", "mcl_core:dirt"})
df_dependencies.node_name_dry_grass_3 = select_required({"default:dry_grass_3", "mcl_core:deadbush"})  -- There doesn't seem to be an MCL equivalent of this
df_dependencies.node_name_dry_grass_4 = select_required({"default:dry_grass_4", "mcl_core:deadbush"}) -- There doesn't seem to be an MCL equivalent of this
df_dependencies.node_name_dry_shrub = select_required({"default:dry_shrub", "mcl_core:deadbush"})
df_dependencies.node_name_furnace = select_required({"default:furnace", "mcl_furnaces:furnace"})
df_dependencies.node_name_gold_ingot = select_required({"default:gold_ingot", "mcl_core:gold_ingot"})
df_dependencies.node_name_gravel = select_required({"default:gravel", "mcl_core:gravel"})
df_dependencies.node_name_ice = select_required({"default:ice", "mcl_core:ice"})
df_dependencies.node_name_junglewood = select_required({"default:junglewood", "mcl_core:junglewood"})
df_dependencies.node_name_lava_source = select_required({"default:lava_source", "mcl_core:lava_source"})
df_dependencies.node_name_mese_crystal = select_required({"mesecons:wire_00000000_off", "default:mese_crystal"}) --make sure default:mese_crystal is second, so that default will take priority if mesecons is also installed.
df_dependencies.node_name_mossycobble = select_required({"default:mossycobble", "mcl_core:mossycobble"})
df_dependencies.node_name_obsidian = select_required({"default:obsidian", "mcl_core:obsidian"})
df_dependencies.node_name_paper = select_required({"default:paper", "mcl_core:paper"})
df_dependencies.node_name_river_water_flowing = select_required({"default:river_water_flowing", "mclx_core:river_water_flowing"})
df_dependencies.node_name_river_water_source = select_required({"default:river_water_source", "mclx_core:river_water_source"})
df_dependencies.node_name_sand = select_required({"default:sand", "mcl_core:sand"})
df_dependencies.node_name_silver_sand = select_required({"default:silver_sand", "mcl_core:sand"}) -- There doesn't seem to be an MCL equivalent of this
df_dependencies.node_name_snow = select_required({"default:snow", "mcl_core:snow"})
df_dependencies.node_name_stone = select_required({"default:stone", "mcl_core:stone"})
df_dependencies.node_name_stone_with_coal = select_required({"default:stone_with_coal", "mcl_core:stone_with_coal"})
df_dependencies.node_name_stone_with_mese = select_required({"default:stone_with_mese", "mcl_core:stone_with_redstone"})
df_dependencies.node_name_torch = select_required({"default:torch", "mcl_torches:torch"})
df_dependencies.node_name_torch_wall = select_required({"default:torch_wall", "mcl_torches:torch_wall"})
df_dependencies.node_name_water_flowing = select_required({"default:water_flowing", "mcl_core:water_flowing"})
df_dependencies.node_name_water_source = select_required({"default:water_source", "mcl_core:water_source"})
df_dependencies.node_name_stone_with_iron = select_required({"default:stone_with_iron", "mcl_core:stone_with_iron"})
df_dependencies.node_name_steelblock = select_required({"default:steelblock", "mcl_core:ironblock"})
df_dependencies.node_name_stone_with_copper = select_required({"default:stone_with_copper", "mcl_copper:stone_with_copper"})
df_dependencies.node_name_copperblock = select_required({"default:copperblock", "mcl_copper:block_raw"})

df_dependencies.node_name_dirt_furrowed = select_required({"farming:soil", "mcl_farming:soil"})
df_dependencies.node_name_dirt_wet = select_required({"farming:soil_wet", "mcl_farming:soil_wet"})
--df_dependencies.node_name_mortar_pestle = select_optional({"farming:mortar_pestle"}) -- TODO where did this go?
df_dependencies.node_name_string = select_required({"farming:string", "mcl_mobitems:string"})

df_dependencies.node_name_bucket_empty = select_required({"mesecraft_bucket:bucket_empty", "mcl_buckets:bucket_empty"})
df_dependencies.node_name_bucket_lava = select_required({"mesecraft_bucket:bucket_lava", "mcl_buckets:bucket_lava"})

-- from "wool"

df_dependencies.node_name_wool_white = select_required({"wool:white", "mcl_wool:white"})

-- from "fireflies"
df_dependencies.node_name_fireflies = select_optional({"fireflies:firefly"})

-- from "vessels"
df_dependencies.node_name_glass_bottle = select_required({"vessels:glass_bottle", "mcl_potions:glass_bottle"})
df_dependencies.node_name_shelf = select_optional({"vessels:shelf"})

-- from "mesecraft_beds"
df_dependencies.node_name_bed_bottom = select_required({"mesecraft_beds:bed_red_bottom", "mcl_beds:bed_red_bottom"})
df_dependencies.node_name_bed_top = select_required({"mesecraft_beds:bed_red_top", "mcl_beds:bed_red_top"})

-- from "doors"
df_dependencies.node_name_door_wood_a = select_required({"doors:door_wood_a", "mcl_doors:wooden_door_b_1"})
df_dependencies.node_name_door_hidden = select_required({"doors:hidden", "mcl_doors:wooden_door_t_1"})

-- from "stairs"

df_dependencies.node_name_slab_goblin_cap_stem_wood = select_required({"stairs:slab_goblin_cap_stem_wood", "mcl_stairs:slab_goblin_cap_stem_wood"})
df_dependencies.node_name_slab_slade_brick = select_required({"stairs:slab_slade_brick", "mcl_stairs:slab_slade_brick"})
df_dependencies.node_name_stair_goblin_cap_stem_wood = select_required({"stairs:stair_goblin_cap_stem_wood", "mcl_stairs:stair_goblin_cap_stem_wood"})
df_dependencies.node_name_stair_inner_slade_brick = select_required({"stairs:stair_inner_slade_brick", "mcl_stairs:stair_slade_brick_inner"})
df_dependencies.node_name_stair_outer_slade_brick = select_required({"stairs:stair_outer_slade_brick", "mcl_stairs:stair_slade_brick_outer"})
df_dependencies.node_name_stair_slade_block = select_required({"stairs:stair_slade_block", "mcl_stairs:stair_slade_block"})
df_dependencies.node_name_slab_slade_block = select_required({"stairs:slab_slade_block", "mcl_stairs:slab_slade_block"})
df_dependencies.node_name_stair_slade_brick = select_required({"stairs:stair_slade_brick", "mcl_stairs:stair_slade_brick"})
df_dependencies.node_name_slab_slade_block_top = select_optional({"mcl_stairs:slab_slade_block_top"})

-- from "tnt"

df_dependencies.node_name_gunpowder = select_optional({"tnt:gunpowder", "mcl_mobitems:gunpowder"})

local modpath = minetest.get_modpath(minetest.get_current_modname())

if not df_dependencies.node_name_fireflies then
	dofile(modpath.."/fireflies.lua")
	df_dependencies.node_name_fireflies = "df_dependencies:firefly"
end


code:
[Cavern dimensions]

#Note that this doesn't guarantee caverns of this setting's size. This setting
#affects the scale of features in the perlin noise that is used to build caverns.
#Most caverns will be smaller than this (and a few might be larger)
dfcaverns_vertical_cavern_scale (Vertical cavern dimension scale) float 256
#Note that this doesn't guarantee caverns of this setting's size. This setting
#affects the scale of features in the perlin noise that is used to build caverns.
#Most caverns will be smaller than this (and a few might be larger)
dfcaverns_horizontal_cavern_scale (Horizontal cavern dimension scale) float 256
#Determines threshold for cave generation. Higher number means sparser, smaller caverns
dfcaverns_cavern_threshold (Cavern threshold) float 0.5 0.0 1.0
#Determines threshold for lower sea cave generation. Higher number means sparser, smaller caverns
dfcaverns_sunless_sea_threshold (Cavern threshold for sunless sea) float 0.4 0.0 1.0
#Determines how far out water extends into tunnels below the 'sea level' of from flooded
#caverns. Lower numbers give more flooded tunnel. If this number equals the cavern
#threshold tunnels will not be flooded at all, if it is 0 then half the tunnels will be flooded.
dfcaverns_tunnel_flooding_threshold (Tunnel flooding threshold) float 0.25 0.0 1.0

[Cavern depth borders]

#maximum boundary for cavern depths are most efficient when they fit the formula (x*80-32-1)
#where x is an integer. That way you don't get map blocks that straddle two cavern layers.
dfcaverns_ymax (Upper limit of level 1) int -193
#minimum boundaries for cavern depths are most efficient when they fit the formula (x*80-32)
#where x is an integer. that way you don't get map blocks that straddle two cavern layers.
dfcaverns_level1_min (Upper limit of level 2) int -832
dfcaverns_level2_min (Upper limit of level 3) int -1472
dfcaverns_level3_min (Upper limit of the sunless sea) int -2112
dfcaverns_sunless_sea_min (Lower limit of the sunless sea) int -2512

[Lower Levels]

dfcaverns_enable_oil_sea (Generate oil sea) bool true
dfcaverns_oil_sea_level (Oil sea level) int -2700

dfcaverns_enable_lava_sea (Generate magma sea) bool true
dfcaverns_lava_sea_level (Lava sea level) int -2900

dfcaverns_enable_underworld (Generate underworld) bool true
dfcaverns_underworld_level (Underworld level) int -3200
#Set this to 0 to disable glowing pit generation entirely.
dfcaverns_underworld_glowing_pit_mapblocks(Average pit spacing measured in mapblocks) int 8

[Underworld feature HUD]

dfcaverns_underworld_hud_requires_item (Require an item to view waypoints) bool true
#Players can still discover the locations of volcanoes without this, but waypoints
#will only be visible in their hud if they have this item in their inventory. You can also
#specify "group:groupname" here. Leave it blank to default to map:mapping_kit.
dfcaverns_underworld_hud_item_required (Specify the item or group required) string map:mapping_kit

dfcaverns_show_pits_in_hud (Show pit locations in HUD) bool true
dfcaverns_pit_discovery_range (Pit discovery range) int 60
dfcaverns_pit_visibility_range (Pit visibility range) int 500

dfcaverns_show_seals_in_hud (Seal locations in HUD) bool true
dfcaverns_seal_discovery_range (Seal discovery range) int 10
dfcaverns_seal_visibility_range (Seal visibility range) int 200

dfcaverns_show_ruins_in_hud (Ruin locations visible in HUD) bool true
dfcaverns_ruin_discovery_range (Ruin discovery range) int 40
dfcaverns_ruin_visibility_range (Ruin visibility range) int 250

[Primordial]

dfcaverns_enable_primordial (Generate primordial caverns) bool true
dfcaverns_primordial_max (Upper limit of primordial caverns) int -3393
dfcaverns_primordial_min (Lower limit of primordial caverns) int -4032

# This setting is pretty technical, it spreads out the
# construction of giant mycelium networks on mapgen
# over this many seconds. If you're experiencing lag spikes
# during mapgen of Primordial cavern layer mushroom caverns
# then increasing this number may help.
dcaverns_giant_mycelium_timer_spread (Giant Mycelium mapgen timer spread) int 10

[Plant growth restrictions]

dfcaverns_restrict_trees_to_biomes (Restrict underground tree growth to their home biomes) bool false
dfcaverns_restrict_farmables_to_biomes (Restrict underground farmable plant growth to their home biomes) bool false


code:
local S = minetest.get_translator(minetest.get_current_modname())

local select_required = df_dependencies.select_required
local select_optional = df_dependencies.select_optional

df_dependencies.mods_required.mcl_sounds = true

if minetest.get_modpath("default") then
	df_dependencies.sound_dirt = default.node_sound_dirt_defaults
	df_dependencies.sound_glass = default.node_sound_glass_defaults
	df_dependencies.sound_gravel = default.node_sound_gravel_defaults
	df_dependencies.sound_leaves = default.node_sound_leaves_defaults
	df_dependencies.sound_sand = default.node_sound_sand_defaults
	df_dependencies.sound_stone = default.node_sound_stone_defaults
	df_dependencies.sound_water = default.node_sound_water_defaults
	df_dependencies.sound_wood = default.node_sound_wood_defaults
elseif minetest.get_modpath("mcl_sounds") then
	df_dependencies.sound_dirt = mcl_sounds.node_sound_dirt_defaults
	df_dependencies.sound_glass = mcl_sounds.node_sound_glass_defaults
	df_dependencies.sound_gravel = function(table)
		table = table or {}
		table.footstep = table.footstep or {name="default_gravel_footstep", gain=0.45}
		return mcl_sounds.node_sound_dirt_defaults(table)
	end
	df_dependencies.sound_leaves = mcl_sounds.node_sound_leaves_defaults
	df_dependencies.sound_sand = mcl_sounds.node_sound_sand_defaults
	df_dependencies.sound_stone = mcl_sounds.node_sound_stone_defaults
	df_dependencies.sound_water = mcl_sounds.node_sound_water_defaults
	df_dependencies.sound_wood = mcl_sounds.node_sound_wood_defaults
else
	assert(false, "One of [default] or [mcl_sounds] must be active")
end

df_dependencies.soundfile_grass_footstep = select_required({{"default", "default_grass_footstep"}, {"mcl_sounds", "default_grass_footstep"}})
df_dependencies.soundfile_snow_footstep = select_required({{"default", "default_snow_footstep"}, {"mcl_sounds", "pedology_snow_soft_footstep"}})
df_dependencies.soundfile_gravel_footstep = select_required({{"default", "default_gravel_footstep"}, {"mcl_sounds", "default_gravel_footstep"}})
df_dependencies.soundfile_cool_lava = select_required({{"default", "default_cool_lava"}, {"mcl_sounds", "default_cool_lava"}})
df_dependencies.soundfile_tnt_ignite = select_required({{"default", "tnt_ignite"}, {"mcl_tnt", "tnt_ignite"}})


code:
minetest.register_alias("dfcaverns:cave_wheat"           , "df_farming:cave_wheat"           )
minetest.register_alias("dfcaverns:cave_flour"           , "df_farming:cave_flour"           )
minetest.register_alias("dfcaverns:cave_bread"           , "df_farming:cave_bread"           )
minetest.register_alias("dfcaverns:pig_tail_thread"      , "df_farming:pig_tail_thread"      )
minetest.register_alias("dfcaverns:quarry_bush_leaves"   , "df_farming:quarry_bush_leaves"   )
minetest.register_alias("dfcaverns:sweet_pods"           , "df_farming:sweet_pods"           )
minetest.register_alias("dfcaverns:sugar"                , "df_farming:sugar"                )
minetest.register_alias("dfcaverns:dead_fungus"          , "df_farming:dead_fungus"          )
minetest.register_alias("dfcaverns:cavern_fungi"         , "df_farming:cavern_fungi"         )
minetest.register_alias("dfcaverns:plump_helmet_spawn"   , "df_farming:plump_helmet_spawn"   )
minetest.register_alias("dfcaverns:plump_helmet_1"       , "df_farming:plump_helmet_1"       )
minetest.register_alias("dfcaverns:plump_helmet_2"       , "df_farming:plump_helmet_2"       )
minetest.register_alias("dfcaverns:plump_helmet_3"       , "df_farming:plump_helmet_3"       )
minetest.register_alias("dfcaverns:plump_helmet_4"       , "df_farming:plump_helmet_4"       )
minetest.register_alias("dfcaverns:plump_helmet_4_picked", "df_farming:plump_helmet_4_picked")
minetest.register_alias("dfcaverns:cave_wheat_1"         , "df_farming:cave_wheat_1"         )
minetest.register_alias("dfcaverns:cave_wheat_2"         , "df_farming:cave_wheat_2"         )
minetest.register_alias("dfcaverns:cave_wheat_3"         , "df_farming:cave_wheat_3"         )
minetest.register_alias("dfcaverns:cave_wheat_4"         , "df_farming:cave_wheat_4"         )
minetest.register_alias("dfcaverns:cave_wheat_5"         , "df_farming:cave_wheat_5"         )
minetest.register_alias("dfcaverns:cave_wheat_6"         , "df_farming:cave_wheat_6"         )
minetest.register_alias("dfcaverns:cave_wheat_7"         , "df_farming:cave_wheat_7"         )
minetest.register_alias("dfcaverns:cave_wheat_8"         , "df_farming:cave_wheat_8"         )
minetest.register_alias("dfcaverns:cave_wheat_seed"      , "df_farming:cave_wheat_seed"      )
minetest.register_alias("dfcaverns:dimple_cup_1"         , "df_farming:dimple_cup_1"         )
minetest.register_alias("dfcaverns:dimple_cup_2"         , "df_farming:dimple_cup_2"         )
minetest.register_alias("dfcaverns:dimple_cup_3"         , "df_farming:dimple_cup_3"         )
minetest.register_alias("dfcaverns:dimple_cup_4"         , "df_farming:dimple_cup_4"         )
minetest.register_alias("dfcaverns:dimple_cup_seed"      , "df_farming:dimple_cup_seed"      )
minetest.register_alias("dfcaverns:pig_tail_1"           , "df_farming:pig_tail_1"           )
minetest.register_alias("dfcaverns:pig_tail_2"           , "df_farming:pig_tail_2"           )
minetest.register_alias("dfcaverns:pig_tail_3"           , "df_farming:pig_tail_3"           )
minetest.register_alias("dfcaverns:pig_tail_4"           , "df_farming:pig_tail_4"           )
minetest.register_alias("dfcaverns:pig_tail_5"           , "df_farming:pig_tail_5"           )
minetest.register_alias("dfcaverns:pig_tail_6"           , "df_farming:pig_tail_6"           )
minetest.register_alias("dfcaverns:pig_tail_7"           , "df_farming:pig_tail_7"           )
minetest.register_alias("dfcaverns:pig_tail_8"           , "df_farming:pig_tail_8"           )
minetest.register_alias("dfcaverns:pig_tail_seed"        , "df_farming:pig_tail_seed"        )
minetest.register_alias("dfcaverns:quarry_bush_1"        , "df_farming:quarry_bush_1"        )
minetest.register_alias("dfcaverns:quarry_bush_2"        , "df_farming:quarry_bush_2"        )
minetest.register_alias("dfcaverns:quarry_bush_3"        , "df_farming:quarry_bush_3"        )
minetest.register_alias("dfcaverns:quarry_bush_4"        , "df_farming:quarry_bush_4"        )
minetest.register_alias("dfcaverns:quarry_bush_5"        , "df_farming:quarry_bush_5"        )
minetest.register_alias("dfcaverns:quarry_bush_seed"     , "df_farming:quarry_bush_seed"     )
minetest.register_alias("dfcaverns:sweet_pod_1"          , "df_farming:sweet_pod_1"          )
minetest.register_alias("dfcaverns:sweet_pod_2"          , "df_farming:sweet_pod_2"          )
minetest.register_alias("dfcaverns:sweet_pod_3"          , "df_farming:sweet_pod_3"          )
minetest.register_alias("dfcaverns:sweet_pod_4"          , "df_farming:sweet_pod_4"          )
minetest.register_alias("dfcaverns:sweet_pod_5"          , "df_farming:sweet_pod_5"          )
minetest.register_alias("dfcaverns:sweet_pod_6"          , "df_farming:sweet_pod_6"          )
minetest.register_alias("dfcaverns:sweet_pod_seed"       , "df_farming:sweet_pod_seed"       )
minetest.register_alias("dfcaverns:dwarven_syrup_source" , "df_farming:dwarven_syrup_source" )
minetest.register_alias("dfcaverns:dwarven_syrup_flowing", "df_farming:dwarven_syrup_flowing")
minetest.register_alias("dfcaverns:dwarven_syrup_bucket" , "df_farming:dwarven_syrup_bucket" )


code:
local S = minetest.get_translator(minetest.get_current_modname())

local wheat_grow_time = df_farming.config.plant_growth_time * df_farming.config.cave_wheat_delay_multiplier / 8

local register_cave_wheat = function(number)
	local name = "df_farming:cave_wheat_"..tostring(number)
	local def = {
		description = S("Cave Wheat"),
		_doc_items_longdesc = df_farming.doc.cave_wheat_desc,
		_doc_items_usagehelp = df_farming.doc.cave_wheat_usage,
		drawtype = "plantlike",
		paramtype2 = "meshoptions",
		place_param2 = 3,
		tiles = {"dfcaverns_cave_wheat_"..tostring(number)..".png"},
		inventory_image = "dfcaverns_cave_wheat_"..tostring(number)..".png",
		paramtype = "light",
		walkable = false,
		is_ground_content = false,
		buildable_to = true,
		floodable = true,
		groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, handy=1, swordy=1, hoey=1, destroy_by_lava_flow=1,dig_by_piston=1},
		sounds = df_dependencies.sound_leaves(),
        selection_box = {
            type = "fixed",
            fixed = {
                {-8/16, -8/16, -8/16, 8/16, -8/16 + 2*number/16, 8/16},
            },
        },

		on_timer = function(pos, elapsed)
			df_farming.grow_underground_plant(pos, name, elapsed)
		end,

		drop = {
			max_items = 1,
			items = {
				{
					items = {'df_farming:cave_wheat_seed 2', 'df_farming:cave_wheat'},
					rarity = 9-number,
				},
				{
					items = {'df_farming:cave_wheat_seed 1', 'df_farming:cave_wheat'},
					rarity = 9-number,
				},
				{
					items = {'df_farming:cave_wheat_seed'},
					rarity = 9-number,
				},
			},
		},

		_mcl_blast_resistance = 0.2,
		_mcl_hardness = 0.2,
	}

	if number < 8 then
		def._dfcaverns_next_stage_time = wheat_grow_time
		def._dfcaverns_next_stage = "df_farming:cave_wheat_"..tostring(number+1)
	end

	minetest.register_node(name, def)
end

for i = 1,8 do
	register_cave_wheat(i)
end

local place_list = {
	minetest.get_content_id("df_farming:cave_wheat_1"),
	minetest.get_content_id("df_farming:cave_wheat_2"),
	minetest.get_content_id("df_farming:cave_wheat_3"),
	minetest.get_content_id("df_farming:cave_wheat_4"),
	minetest.get_content_id("df_farming:cave_wheat_5"),
	minetest.get_content_id("df_farming:cave_wheat_6"),
	minetest.get_content_id("df_farming:cave_wheat_7"),
	minetest.get_content_id("df_farming:cave_wheat_8"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_cave_wheat_vm = function(vi, area, data, param2_data)
	data[vi] = place_list[math.random(1,8)]
	param2_data[vi] = 3
end

df_farming.register_seed(
	"cave_wheat_seed",
	S("Cave Wheat Seed"),
	"dfcaverns_cave_wheat_seed.png",
	"df_farming:cave_wheat_1",
	wheat_grow_time,
	df_farming.doc.cave_wheat_desc,
	df_farming.doc.cave_wheat_usage)

minetest.register_craftitem("df_farming:cave_wheat", {
	description = S("Cave Wheat"),
	_doc_items_longdesc = df_farming.doc.cave_wheat_desc,
	_doc_items_usagehelp = df_farming.doc.cave_wheat_usage,
	inventory_image = "dfcaverns_cave_wheat.png",
	stack_max = 99,
})
minetest.register_craft({
	type = "fuel",
	recipe = "df_farming:cave_wheat",
	burntime = 2
})

-------------
--- Flour and bread

minetest.register_craftitem("df_farming:cave_flour", {
	description = S("Cave Wheat Flour"),
	_doc_items_longdesc = df_farming.doc.cave_flour_desc,
	_doc_items_usagehelp = df_farming.doc.cave_flour_usage,
	inventory_image = "dfcaverns_flour.png",
	groups = {flammable = 1, dfcaverns_cookable = 1, food_flour = 1},
})

minetest.register_craftitem("df_farming:cave_bread", {
	description = S("Dwarven Bread"),
	_doc_items_longdesc = df_farming.doc.cave_bread_desc,
	_doc_items_usagehelp = df_farming.doc.cave_bread_usage,
	inventory_image = "dfcaverns_prepared_food13x16.png",
	sound = {eat = {name = "df_farming_chomp_crunch", gain = 1.0}},
	on_use = minetest.item_eat(5),
	_hunger_ng = {satiates = 5},
	_mcl_saturation = 3,
	groups = {flammable = 2, food = 5, eatable=5},
})

local recipe_registered = false
if minetest.get_modpath("cottages") then
	cottages.handmill_product["df_farming:cave_wheat"] = "df_farming:cave_flour";
	recipe_registered = true
end

if minetest.registered_items[df_dependencies.node_name_mortar_pestle] ~= nil then
	minetest.register_craft({
		type = "shapeless",
		output = "df_farming:cave_flour",
		recipe = {
			"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat",
			"df_farming:cave_wheat", df_dependencies.node_name_mortar_pestle
		},
		replacements = {{"group:food_mortar_pestle", df_dependencies.node_name_mortar_pestle}},
	})
	recipe_registered = true
end

if not recipe_registered then
	minetest.register_craft({
		type = "shapeless",
		output = "df_farming:cave_flour",
		recipe = {"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat"}
	})
end

minetest.register_craft({
	type = "cooking",
	cooktime = 15,
	output = "df_farming:cave_bread",
	recipe = "df_farming:cave_flour"
})

--------
-- Straw

minetest.register_node("df_farming:cave_straw", {
	description = S("Cave Straw"),
	tiles = {"dfcaverns_cave_straw.png"},
	is_ground_content = false,
	groups = {snappy=3, flammable=4, straw=1, handy=1,hoey=1, compostability=85, flammable=2, fire_encouragement=60, fire_flammability=20, building_block=1, fall_damage_add_percent=-80, enderman_takable=1},
	sounds = df_dependencies.sound_leaves(),
	_mcl_blast_resistance = 0.5,
	_mcl_hardness = 0.5,
})

minetest.register_craft({
	output = "df_farming:cave_straw 3",
	recipe = {
		{"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat"},
		{"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat"},
		{"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat"},
	}
})

minetest.register_craft({
	output = "df_farming:cave_wheat 3",
	recipe = {
		{"df_farming:cave_straw"},
	}
})

---------
-- Trample support

if minetest.get_modpath("footprints") then
	minetest.register_node("df_farming:wheat_trampled", {
		description = S("Flattened Cave Wheat"),
		tiles = {"dfcaverns_cave_wheat_flattened.png"},
		inventory_image = "dfcaverns_cave_wheat_flattened.png",
		drawtype = "nodebox",
		paramtype = "light",
		paramtype2 = "facedir",
		buildable_to = true,
		node_box = {
			type = "fixed",
			fixed = {
				{-0.5, -0.5, -0.5, 0.5, -3 / 8, 0.5}
			},
		},
		groups = {snappy = 3, flammable = 2, attached_node = 1, handy=1, hoey=1, compostability=85, fire_encouragement=60, fire_flammability=20, fall_damage_add_percent=-30, destroy_by_lava_flow=1,dig_by_piston=1},
		drop = "",
		sounds = df_dependencies.sound_leaves(),
		_mcl_blast_resistance = 0.5,
		_mcl_hardness = 0.5,
	})

	footprints.register_trample_node("df_farming:cave_wheat_5", {
		trampled_node_name = "df_farming:wheat_trampled",
		randomize_trampled_param2 = true,
	})
	footprints.register_trample_node("df_farming:cave_wheat_6", {
		trampled_node_name = "df_farming:wheat_trampled",
		randomize_trampled_param2 = true,
	})
	footprints.register_trample_node("df_farming:cave_wheat_7", {
		trampled_node_name = "df_farming:wheat_trampled",
		randomize_trampled_param2 = true,
	})
	footprints.register_trample_node("df_farming:cave_wheat_8", {
		trampled_node_name = "df_farming:wheat_trampled",
		randomize_trampled_param2 = true,
	})
end


code:
local CONFIG_FILE_PREFIX = "dfcaverns_"

df_farming.config = {}

local print_settingtypes = false

local function setting(stype, name, default, description)
	local value
	if stype == "bool" then
		value = minetest.settings:get_bool(CONFIG_FILE_PREFIX..name, default)
	elseif stype == "string" then
		value = minetest.settings:get(CONFIG_FILE_PREFIX..name)
	elseif stype == "int" or stype == "float" then
		value = tonumber(minetest.settings:get(CONFIG_FILE_PREFIX..name))
	end
	if value == nil then
		value = default
	end
	df_farming.config[name] = value

	if print_settingtypes then
		minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
	end
end

local plants = {
	{name="cave_wheat", delay_multiplier=1},
	{name="dimple_cup", delay_multiplier=3},
	{name="pig_tail", delay_multiplier=1},
	{name="plump_helmet", delay_multiplier=3},
	{name="quarry_bush", delay_multiplier=2},
	{name="sweet_pod", delay_multiplier=2},
}

--Plants

setting("int", "plant_growth_time", 3600, "Base plant growth time") -- 60 minutes

for _, plant in pairs(plants) do
	setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
end

setting("bool", "light_kills_fungus", true, "Light kills fungus")


code:
local S = minetest.get_translator(minetest.get_current_modname())

local bucket_empty = df_dependencies.node_name_bucket_empty

local chomp = {eat = {name = "df_farming_chomp_crunch", gain = 1.0}}
local crisp = {eat = {name = "df_farming_crisp_chew", gain = 1.0}}
local gummy = {eat = {name = "df_farming_gummy_chew", gain = 1.0}}
local mushy = {eat = {name = "df_farming_mushy_chew", gain = 1.0}}
local soft = {eat = {name = "df_farming_soft_chew", gain = 1.0}}

local recipes = {
{recipe = {"df_farming:cave_flour", "df_farming:cave_wheat_seed"}, name=S("Cave Wheat Flour Biscuit"), image="dfcaverns_prepared_food08x16.png", sound = crisp},
{recipe = {"df_farming:cave_flour", "df_farming:cave_wheat_seed", "group:sugar"}, name=S("Cave Wheat Flour Bun"), image="dfcaverns_prepared_food11x16.png", sound = mushy},
{recipe = {"df_farming:cave_flour", "group:food_flour", "df_farming:cave_wheat_seed", "df_farming:plump_helmet_spawn"}, name=S("Cave Wheat Flour Pancake"), image="dfcaverns_prepared_food07x16.png", sound = mushy},
{recipe = {"df_farming:cave_wheat_seed", "group:plump_helmet"}, name=S("Cave Wheat Seed Loaf"), image="dfcaverns_prepared_food17x16.png", sound = crisp},
{recipe = {"df_farming:cave_wheat_seed", "df_farming:cave_wheat_seed", "group:sugar"}, name=S("Cave Wheat Seed Puffs"), image="dfcaverns_prepared_food33x16.png", sound = soft},
{recipe = {"df_farming:cave_wheat_seed", "df_farming:cave_wheat_seed", "df_farming:pig_tail_seed", "df_farming:plump_helmet_spawn"}, name=S("Cave Wheat Seed Risotto"), image="dfcaverns_prepared_food14x16.png", sound = gummy},
{recipe = {"df_farming:sweet_pod_seed", "group:food_flour"}, name=S("Sweet Pod Spore Dumplings"), image="dfcaverns_prepared_food09x16.png", sound = mushy},
{recipe = {"df_farming:sweet_pod_seed", "group:food_flour", "group:sugar"}, name=S("Sweet Pod Spore Single Crust Pie"), image="dfcaverns_prepared_food05x16.png", sound = mushy},
{recipe = {"df_farming:sweet_pod_seed", "group:sugar", "group:food_flour", "df_farming:dwarven_syrup_bucket"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Sweet Pod Spore Brule"), image="dfcaverns_prepared_food22x16.png", sound = soft},
{recipe = {"df_farming:sugar", "group:food_flour"}, name=S("Sweet Pod Sugar Cookie"), image="dfcaverns_prepared_food02x16.png", sound = crisp},
{recipe = {"df_farming:sugar", "group:food_flour", "df_farming:quarry_bush_leaves"}, name=S("Sweet Pod Sugar Gingerbread"), image="dfcaverns_prepared_food21x16.png", sound = chomp},
{recipe = {"df_farming:sugar", "group:sugar", "group:food_flour", "group:food_flour"}, name=S("Sweet Pod Sugar Roll"), image="dfcaverns_prepared_food25x16.png", sound = crisp},
{recipe = {"group:plump_helmet", "group:plump_helmet"}, name=S("Plump Helmet Mince"), image="dfcaverns_prepared_food15x16.png", sound = mushy},
{recipe = {"group:plump_helmet", "group:plump_helmet", "df_farming:quarry_bush_leaves"}, name=S("Plump Helmet Stalk Sausage"), image="dfcaverns_prepared_food18x16.png", sound = gummy},
{recipe = {"group:plump_helmet", "group:food_flour", "df_farming:plump_helmet_spawn", "df_farming:quarry_bush_leaves"}, name=S("Plump Helmet Roast"), image="dfcaverns_prepared_food04x16.png", sound = mushy},
{recipe = {"df_farming:plump_helmet_spawn", "group:plump_helmet"}, name=S("Plump Helmet Spawn Soup"), image="dfcaverns_prepared_food10x16.png", sound = gummy},
{recipe = {"df_farming:plump_helmet_spawn", "df_farming:quarry_bush_seed", "group:plump_helmet"}, name=S("Plump Helmet Spawn Jambalaya"), image="dfcaverns_prepared_food01x16.png", sound = soft},
{recipe = {"df_farming:plump_helmet_spawn", "df_farming:plump_helmet_spawn", "group:plump_helmet", "group:plump_helmet"}, name=S("Plump Helmet Sprout Stew"), image="dfcaverns_prepared_food26x16.png", sound = gummy},
{recipe = {"df_farming:quarry_bush_leaves", "df_farming:cave_bread"}, name=S("Quarry Bush Leaf Spicy Bun"), image="dfcaverns_prepared_food23x16.png", sound = soft},
{recipe = {"df_farming:quarry_bush_leaves", "group:food_flour", "group:plump_helmet"}, name=S("Quarry Bush Leaf Croissant"), image="dfcaverns_prepared_food29x16.png", sound = soft},
{recipe = {"df_farming:quarry_bush_leaves", "group:plump_helmet", "group:plump_helmet", "group:plump_helmet"}, name=S("Stuffed Quarry Bush Leaf"), image="dfcaverns_prepared_food27x16.png", sound = chomp},
{recipe = {"df_farming:quarry_bush_seed", "df_farming:cave_bread"}, name=S("Rock Nut Bread"), image="dfcaverns_prepared_food16x16.png", sound = soft},
{recipe = {"df_farming:quarry_bush_seed", "group:food_flour", "group:sugar"}, name=S("Rock Nut Cookie"), image="dfcaverns_prepared_food07x16.png", sound = chomp},
{recipe = {"df_farming:quarry_bush_seed", "group:sugar", "df_farming:sweet_pod_seed", "group:food_flour"}, name=S("Rock Nut Cake"), image="dfcaverns_prepared_food03x16.png", sound = soft},
{recipe = {"df_farming:dimple_cup_seed", "group:food_flour"}, name=S("Dimple Cup Spore Flatbread"), image="dfcaverns_prepared_food12x16.png", sound = crisp},
{recipe = {"df_farming:dimple_cup_seed", "group:food_flour", "group:sugar"}, name=S("Dimple Cup Spore Scone"), image="dfcaverns_prepared_food32x16.png", sound = chomp},
{recipe = {"df_farming:dimple_cup_seed", "df_farming:sweet_pod_seed", "df_farming:quarry_bush_seed", "group:food_flour"}, name=S("Dimple Cup Spore Roll"), image="dfcaverns_prepared_food31x16.png", sound = soft},
{recipe = {"df_farming:pig_tail_seed", "df_farming:cave_bread"}, name=S("Pig Tail Spore Sandwich"), image="dfcaverns_prepared_food20x16.png", sound = soft},
{recipe = {"df_farming:pig_tail_seed", "df_farming:pig_tail_seed", "df_farming:dwarven_syrup_bucket"}, name=S("Pig Tail Spore Tofu"), replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, image="dfcaverns_prepared_food30x16.png", sound = gummy},
{recipe = {"df_farming:pig_tail_seed", "df_farming:sweet_pod_seed", "group:food_flour", "group:food_flour"}, name=S("Pig Tail Spore Casserole"), image="dfcaverns_prepared_food34x16.png", sound = mushy},
{recipe = {"df_farming:dwarven_syrup_bucket", "df_farming:dwarven_syrup_bucket"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}, {"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Dwarven Syrup Taffy"), image="dfcaverns_prepared_food19x16.png", sound = gummy},
{recipe = {"df_farming:dwarven_syrup_bucket", "group:sugar", "group:plump_helmet"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Dwarven Syrup Jellies"), image="dfcaverns_prepared_food06x16.png", sound = gummy},
{recipe = {"df_farming:dwarven_syrup_bucket", "group:food_flour", "group:sugar", "df_farming:quarry_bush_seed"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Dwarven Syrup Delight"), image="dfcaverns_prepared_food24x16.png", sound = mushy},
}

local complexity = {[2]={name="simple", value=4}, [3]={name="medium", value=6}, [4]={name="complex", value=8}}
local alias_items = {}

-- validate the recipes.
for index1 = 1, table.getn(recipes)-1 do
	for index2 = index1+1, table.getn(recipes) do
		local recipe1 = recipes[index1].recipe
		local recipe2 = recipes[index2].recipe
		local recipe1count = {}
		local recipe2count = {}
		for _, item in pairs(recipe1) do
			recipe1count[item] = (recipe1count[item] or 0) + 1
		end
		for _, item in pairs(recipe2) do
			recipe2count[item] = (recipe2count[item] or 0) + 1
		end
		local identical = true
		for key, val in pairs(recipe1count) do
			if recipe2count[key] ~= val then
				identical = false
				break
			end
		end
		for key, val in pairs(recipe2count) do
			if recipe1count[key] ~= val then
				identical = false
				break
			end
		end
		assert(not identical, "recipes " .. recipes[index1].name .. " and " .. recipes[index2].name .. " have identical ingredients!")
	end
end
local ingredient_count = {}
--for _, recipe_entry in pairs(recipes) do
--	for _, item in pairs(recipe_entry.recipe) do
--		ingredient_count[item] = (ingredient_count[item] or 0) + 1
--	end
--end
--minetest.debug(dump(ingredient_count))

for _, def in pairs(recipes) do
	local recipe_type = complexity[table.getn(def.recipe)]
	local _, item_name = string.match(def.recipe[1], "(.*):(.*)")
	local output = "df_farming:"..item_name.."_"..recipe_type.name.."_meal"
	alias_items[item_name] = true

	minetest.register_craftitem(output, {
		description = def.name,
		_doc_items_longdesc = df_farming.doc[recipe_type.name.."_meal_desc"],
		_doc_items_usagehelp = df_farming.doc[recipe_type.name.."_meal_usage"],
		inventory_image = def.image,
		sound = def.sound,
		on_use = minetest.item_eat(recipe_type.value),
		groups = {food = recipe_type.value, eatable=recipe_type.value},
		_hunger_ng = {satiates = recipe_type.value},
		_mcl_saturation = recipe_type.value, -- TODO: make this more interesting
	})

	minetest.register_craft({
		type = "shapeless",
		output = output,
		recipe = def.recipe,
		replacements = def.replacements
	})
end

for item, _ in pairs(alias_items) do
	minetest.register_alias("dfcaverns:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
	minetest.register_alias("dfcaverns:"..item.."_stew", "df_farming:"..item.."_medium_meal")
	minetest.register_alias("dfcaverns:"..item.."_roast", "df_farming:"..item.."_complex_meal")
	minetest.register_alias("df_farming:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
	minetest.register_alias("df_farming:"..item.."_stew", "df_farming:"..item.."_medium_meal")
	minetest.register_alias("df_farming:"..item.."_roast", "df_farming:"..item.."_complex_meal")
end

-- dfcaverns_prepared_food28 is currently unused
-- dfcaverns_prepared_food13 is used for dwarven bread


code:
local S = minetest.get_translator(minetest.get_current_modname())

local dimple_grow_time = df_farming.config.plant_growth_time * df_farming.config.dimple_cup_delay_multiplier / 4

local dimple_cup_groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, flower = 1, fire_encouragement=60,fire_flammability=100, compostability=70, handy=1,shearsy=1,hoey=1}

local register_dimple_cup = function(number)
	local name = "df_farming:dimple_cup_"..tostring(number)
	local def = {
		description = S("Dimple Cup"),
		_doc_items_longdesc = df_farming.doc.dimple_cup_desc,
		_doc_items_usagehelp = df_farming.doc.dimple_cup_usage,
		drawtype = "plantlike",
		tiles = {"dfcaverns_dimple_cup_"..tostring(number)..".png"},
		inventory_image = "dfcaverns_dimple_cup_"..tostring(number)..".png",
		paramtype = "light",
		walkable = false,
		floodable = true,
		is_ground_content = false,
		buildable_to = true,
		groups = dimple_cup_groups,
		sounds = df_dependencies.sound_leaves(),
        selection_box = {
            type = "fixed",
            fixed = {
                {-8/16, -8/16, -8/16, 8/16, -8/16 + 4*number/16, 8/16},
            },
        },

		on_timer = function(pos, elapsed)
			df_farming.grow_underground_plant(pos, name, elapsed)
		end,

		drop = {
			max_items = 1,
			items = {
				{
					items = {'df_farming:dimple_cup_seed 2', 'df_farming:dimple_cup_harvested'},
					rarity = 7-number,
				},
				{
					items = {'df_farming:dimple_cup_seed 1', 'df_farming:dimple_cup_harvested'},
					rarity = 5-number,
				},
			},
		},
		_mcl_blast_resistance = 0.2,
		_mcl_hardness = 0.2,
	}

	if number < 4 then
		def._dfcaverns_next_stage_time = dimple_grow_time
		def._dfcaverns_next_stage = "df_farming:dimple_cup_"..tostring(number+1)
	end

	minetest.register_node(name, def)
end

for i = 1,4 do
	register_dimple_cup(i)
end

local dimple_cup_groups_harvested = {}
for group, val in pairs(dimple_cup_groups) do
	dimple_cup_groups_harvested[group] = val
end
dimple_cup_groups_harvested.color_blue = 1
dimple_cup_groups_harvested.basecolor_blue = 1
dimple_cup_groups_harvested.excolor_blue = 1

local name = "df_farming:dimple_cup_harvested"
local def = {
	description = S("Dimple Cup"),
	_doc_items_longdesc = df_farming.doc.dimple_cup_desc,
	_doc_items_usagehelp = df_farming.doc.dimple_cup_usage,
	drawtype = "plantlike",
	tiles = {"dfcaverns_dimple_cup_4.png"},
	inventory_image = "dfcaverns_dimple_cup_4.png",
	paramtype = "light",
	walkable = false,
	floodable = true,
	is_ground_content = false,
	buildable_to = true,
	groups = dimple_cup_groups_harvested,
	sounds = df_dependencies.sound_leaves(),
    selection_box = {
        type = "fixed",
        fixed = {
            {-8/16, -8/16, -8/16, 8/16, -8/16 + 4*4/16, 8/16},
        },
    },
	_mcl_blast_resistance = 0.2,
	_mcl_hardness = 0.2,
}
minetest.register_node(name, def)

local place_list = {
	minetest.get_content_id("df_farming:dimple_cup_1"),
	minetest.get_content_id("df_farming:dimple_cup_2"),
	minetest.get_content_id("df_farming:dimple_cup_3"),
	minetest.get_content_id("df_farming:dimple_cup_4"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_dimple_cup_vm = function(vi, area, data, param2_data)
	data[vi] = place_list[math.random(1,4)]
	param2_data[vi] = 0
end

df_farming.register_seed(
	"dimple_cup_seed",
	S("Dimple Cup Spores"),
	"dfcaverns_dimple_cup_seed.png",
	"df_farming:dimple_cup_1",
	dimple_grow_time,
	df_farming.doc.dimple_cup_desc,
	df_farming.doc.dimple_cup_usage)


code:
df_farming.doc = {}

if not minetest.get_modpath("doc") then
	return
end

local S = minetest.get_translator(minetest.get_current_modname())

df_farming.doc.simple_meal_desc = S("A meal made from the admixture of two ingredients, it keeps well but are not a rich source of nutrients.")
df_farming.doc.simple_meal_usage = nil
df_farming.doc.medium_meal_desc = S("A meal made from three ingredients mixed together. They're more wholesome, packing more nutrition into a single serving.")
df_farming.doc.medium_meal_usage = nil
df_farming.doc.complex_meal_desc = S("Four finely minced ingredients combine into a fine, full meal.")
df_farming.doc.complex_meal_usage = nil

-- Plants

df_farming.doc.dead_fungus_desc = S("Whatever this fungus was in life, it is now dead.")
df_farming.doc.dead_fungus_usage = S("Dead fungus quickly decays into an unrecognizable mess. It can be used as weak fuel or terrible decor.")

df_farming.doc.cavern_fungi_desc = S("A species of lavender mushroom ubiquitous in caves that is most notable for the soft bioluminescence it produces.")
df_farming.doc.cavern_fungi_usage = S("This mushroom is inedible but continues producing modest levels of light long after it's picked.")

df_farming.doc.cave_wheat_desc = S("Cave wheat is literally a breed of grain-producing grass that somehow lost its ability to photosynthesize and adapted to a more fungal style of life.")
df_farming.doc.cave_wheat_usage = S("Like its surface cousin, cave wheat produces grain that can be ground into a form of flour.")
df_farming.doc.cave_flour_desc = S("Cave wheat seed ground into a powder suitable for cooking.")
df_farming.doc.cave_flour_usage = S("When baked alone it forms an edible bread, but it combines well with other more flavorful ingredients.")
df_farming.doc.cave_bread_desc = S("Bread baked from cave wheat flour is tough and durable. A useful ration for long expeditions.")
df_farming.doc.cave_bread_usage = S("It's not tasty, but it keeps you going.")

df_farming.doc.dimple_cup_desc = S("The distinctive midnight-blue caps of these mushrooms are inverted, exposing their gills to any breeze that might pass, and have dimpled edges that give them their name.")
df_farming.doc.dimple_cup_usage = S("Dimple cups can be dried, ground, and processed to extract a deep blue dye.")

df_farming.doc.pig_tail_desc = S("Pig tails are a fibrous fungal growth that's most notable for its twisting stalks. In a mature stand of pig tails the helical stalks intertwine into a dense mesh.")
df_farming.doc.pig_tail_usage = S("Pig tail stalks can be processed to extract fibers useful as thread.")
df_farming.doc.pig_tail_thread_desc = S("Threads of pig tail fiber.")
df_farming.doc.pig_tail_thread_usage = S("A crafting item that can be woven into textiles and other similar items.")

df_farming.doc.plump_helmet_desc = S("Plump helmets are a thick, fleshy mushroom that's edible picked straight from the ground. They form a staple diet for both lost cave explorers and the fauna that preys on them.")
df_farming.doc.plump_helmet_usage = S("While they can be eaten fresh, they can be monotonous fare and are perhaps better appreciated as part of a more complex prepared dish.")

df_farming.doc.quarry_bush_desc = S("A rare breed of fungus from deep underground that produces a bushy cluster of rumpled gray 'blades'. The biological function of these blades is not known, as quarry bushes reproduce via hard-shelled nodules that grow down at the blade's base.")
df_farming.doc.quarry_bush_usage = S("Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are edible with processing.")
df_farming.doc.quarry_bush_leaves_desc = S("The dried blades of a quarry bush add a welcome zing to recipes containing otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten on their own.")
df_farming.doc.quarry_bush_leaves_usage = S("Quarry bush leaves can be used as an ingredient in foodstuffs.")

df_farming.doc.sweet_pod_desc = S("Sweet pods grow in rich soil, and once they reach maturity they draw that supply of nutrients up to concentrate it in their fruiting bodies. They turn bright red when ripe and can be processed in a variety of ways to extract the sugars they contain.")

if minetest.get_modpath("cottages") then
	df_farming.doc.sweet_pod_usage = S("When milled, sweet pods produce a granular sugary substance.")
else
	df_farming.doc.sweet_pod_usage = S("When dried in an oven, sweet pods produce a granular sugary substance.")
end
df_farming.doc.sweet_pod_usage = df_farming.doc.sweet_pod_usage .. " " .. S("Crushing them in a bucket squeezes out a flavorful syrup.")

df_farming.doc.sweet_pod_sugar_desc = S("Sweet pod sugar has a pink tint to it.")
df_farming.doc.sweet_pod_sugar_usage = S("Too sweet to be eaten directly, it makes an excellent ingredient in food recipes.")
df_farming.doc.sweet_pod_syrup_desc = S("Sweet pod syrup is thick and flavorful.")
df_farming.doc.sweet_pod_syrup_usage = S("Too strong and thick to drink straight, sweet pod syrup is useful in food recipes.")


code:
df_farming.growth_permitted = {}

local growable = {[df_dependencies.node_name_dirt_wet] = true, [df_dependencies.node_name_dirt] = true}
local check_farm_plant_soil = function(pos)
	return growable[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name]
end

df_farming.growth_permitted["df_farming:cave_wheat_seed"] = check_farm_plant_soil
df_farming.growth_permitted["df_farming:dimple_cup_seed"] = check_farm_plant_soil
df_farming.growth_permitted["df_farming:pig_tail_seed"] = check_farm_plant_soil
df_farming.growth_permitted["df_farming:quarry_bush_seed"] = check_farm_plant_soil
df_farming.growth_permitted["df_farming:sweet_pod_seed"] = check_farm_plant_soil
df_farming.growth_permitted["df_farming:plump_helmet_spawn"] = check_farm_plant_soil


code:
df_farming = {}

local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)

--load companion lua files
dofile(modpath.."/config.lua")
dofile(modpath.."/doc.lua")
dofile(modpath.."/aliases.lua")

dofile(modpath.."/plants.lua") -- general functions
dofile(modpath.."/cave_wheat.lua")
dofile(modpath.."/dimple_cup.lua")
dofile(modpath.."/pig_tail.lua")
dofile(modpath.."/plump_helmet.lua")
dofile(modpath.."/quarry_bush.lua")
dofile(modpath.."/sweet_pod.lua")
dofile(modpath.."/cooking.lua")
dofile(modpath.."/growth_conditions.lua")


code:
# textdomain: df_farming

### cave_wheat.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Straw=Höhlenstroh
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat=Höhlenweizen
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat Flour=Höhlenweizenmehl
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat Seed=Höhlenweizensamen
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dwarven Bread=Zwergenbrot
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Flattened Cave Wheat=Abgeflachter Höhlenweizen

### cooking.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat Flour Biscuit=Höhlenweizenmehlkeks
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat Flour Bun=Höhlenweizenmehlbrötchen
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat Flour Pancake=Höhlenweizenmehlpfannkuchen
Cave Wheat Seed Loaf=
Cave Wheat Seed Puffs=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave Wheat Seed Risotto=Höhlenweizensamen-Risotto
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dimple Cup Spore Flatbread=Dimple Cup Spore Fladenbrot
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dimple Cup Spore Roll=Dimple Cup Sporenrolle
Dimple Cup Spore Scone=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dwarven Syrup Delight=Zwergensirup-Freude
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dwarven Syrup Jellies=Zwergsirupgelees
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dwarven Syrup Taffy=Zwergensirup Taffy
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig Tail Spore Casserole=Schweineschwanz-Sporenauflauf
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig Tail Spore Sandwich=Schweineschwanz-Sporensandwich
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig Tail Spore Tofu=Schweineschwanzsporentofu
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Mince=Pralles Helmhackfleisch
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Roast=Praller Helmbraten
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Spawn Jambalaya=Praller Helmlaich Jambalaya
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Spawn Soup=Pralle Helmlaichsuppe
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Sprout Stew=Praller Helmsprosseneintopf
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Stalk Sausage=Pralle Helmstielwurst
Quarry Bush Leaf Croissant=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry Bush Leaf Spicy Bun=Steinbruch Bush Leaf Spicy Bun
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Rock Nut Bread=Steinnussbrot
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Rock Nut Cake=Steinnusskuchen
Rock Nut Cookie=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Stuffed Quarry Bush Leaf=Gefülltes Steinbruch-Buschblatt
Sweet Pod Spore Brule=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet Pod Spore Dumplings=Sweet Pod Sporenknödel
Sweet Pod Spore Single Crust Pie=
Sweet Pod Sugar Cookie=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet Pod Sugar Gingerbread=Sweet Pod Sugar Lebkuchen
Sweet Pod Sugar Roll=

### dimple_cup.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dimple Cup=Grübchen Tasse
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dimple Cup Spores=Grübchen Cup Sporen

### doc.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A crafting item that can be woven into textiles and other similar items.=Ein Handwerksgegenstand, der in Textilien und ähnliche Gegenstände eingewebt werden kann.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A meal made from the admixture of two ingredients, it keeps well but are not a rich source of nutrients.=Eine Mahlzeit, die aus der Beimischung von zwei Zutaten hergestellt wird. Sie ist gut haltbar, aber keine reichhaltige Nährstoffquelle.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A meal made from three ingredients mixed together. They're more wholesome, packing more nutrition into a single serving.=Eine Mahlzeit aus drei Zutaten gemischt. Sie sind gesünder und verpacken mehr Nahrung in einer einzigen Portion.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A rare breed of fungus from deep underground that produces a bushy cluster of rumpled gray 'blades'. The biological function of these blades is not known, as quarry bushes reproduce via hard-shelled nodules that grow down at the blade's base.=Eine seltene Pilzrasse aus dem tiefen Untergrund, die eine buschige Ansammlung zerknitterter grauer "Klingen" erzeugt. Die biologische Funktion dieser Klingen ist nicht bekannt, da sich Steinbruchbüsche über hartschalige Knötchen vermehren, die an der Klingenbasis nachwachsen.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A species of lavender mushroom ubiquitous in caves that is most notable for the soft bioluminescence it produces.=Eine in Höhlen allgegenwärtige Lavendelpilzart, die sich vor allem durch ihre weiche Biolumineszenz auszeichnet.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Bread baked from cave wheat flour is tough and durable. A useful ration for long expeditions.=Aus Höhlenweizenmehl gebackenes Brot ist zäh und haltbar. Ein nützliches Verhältnis für lange Expeditionen.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave wheat is literally a breed of grain-producing grass that somehow lost its ability to photosynthesize and adapted to a more fungal style of life.=Höhlenweizen ist buchstäblich eine Rasse von Getreide produzierendem Gras, das irgendwie seine Fähigkeit zur Photosynthese verloren hat und sich an einen eher pilzartigen Lebensstil anpasst.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave wheat seed ground into a powder suitable for cooking.=Den gemahlenen Weizensamen zu einem zum Kochen geeigneten Pulver aushöhlen.
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Crushing them in a bucket squeezes out a flavorful syrup.=Wenn man sie in einem Eimer zerquetscht, wird ein aromatischer Sirup herausgedrückt.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dead fungus quickly decays into an unrecognizable mess. It can be used as weak fuel or terrible decor.=Toter Pilz zerfällt schnell in ein nicht wiederzuerkennendes Chaos. Es kann als schwacher Kraftstoff oder schreckliches Dekor verwendet werden.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dimple cups can be dried, ground, and processed to extract a deep blue dye.=Grübchenbecher können getrocknet, gemahlen und verarbeitet werden, um einen tiefblauen Farbstoff zu extrahieren.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Four finely minced ingredients combine into a fine, full meal.=Vier fein gehackte Zutaten ergeben eine feine, vollständige Mahlzeit.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
It's not tasty, but it keeps you going.=Es ist nicht lecker, aber es hält dich am Laufen.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Like its surface cousin, cave wheat produces grain that can be ground into a form of flour.=Höhlenweizen produziert wie sein Cousin an der Oberfläche Getreide, das zu Mehl gemahlen werden kann.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig tail stalks can be processed to extract fibers useful as thread.=Schweineschwanzstiele können verarbeitet werden, um Fasern zu extrahieren, die als Faden nützlich sind.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig tails are a fibrous fungal growth that's most notable for its twisting stalks. In a mature stand of pig tails the helical stalks intertwine into a dense mesh.=Schweineschwänze sind ein faseriges Pilzwachstum, das sich vor allem durch seine verdrehten Stiele auszeichnet. In einem ausgewachsenen Schweineschwanzbestand verflechten sich die helikalen Stiele zu einem dichten Netz.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump helmets are a thick, fleshy mushroom that's edible picked straight from the ground. They form a staple diet for both lost cave explorers and the fauna that preys on them.=Pralle Helme sind dicke, fleischige Pilze, die essbar direkt vom Boden gepflückt werden. Sie bilden eine Grundnahrungsmittel sowohl für verlorene Höhlenforscher als auch für die Fauna, die ihnen nachjagt.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are edible with processing.=Steinbruchbuschblätter und Knötchen (sogenannte Steinnüsse) können geerntet werden und sind bei der Verarbeitung essbar.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry bush leaves can be used as an ingredient in foodstuffs.=Steinbruch Buschblätter können als Zutat in Lebensmitteln verwendet werden.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet pod sugar has a pink tint to it.=Süßer Schotenzucker hat eine rosa Tönung.
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet pod syrup is thick and flavorful.=Süßer Schotensirup ist dick und aromatisch.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet pods grow in rich soil, and once they reach maturity they draw that supply of nutrients up to concentrate it in their fruiting bodies. They turn bright red when ripe and can be processed in a variety of ways to extract the sugars they contain.=Süße Schoten wachsen auf reichem Boden und sobald sie reif sind, ziehen sie diese Nährstoffversorgung auf, um sie in ihren Fruchtkörpern zu konzentrieren. Sie werden im reifen Zustand leuchtend rot und können auf verschiedene Weise verarbeitet werden, um den darin enthaltenen Zucker zu extrahieren.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
The distinctive midnight-blue caps of these mushrooms are inverted, exposing their gills to any breeze that might pass, and have dimpled edges that give them their name.=Die markanten nachtblauen Kappen dieser Pilze sind umgedreht und setzen ihre Kiemen einer Brise aus, die vorbeiziehen könnte. Sie haben Noppenkanten, die ihnen ihren Namen geben.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
The dried blades of a quarry bush add a welcome zing to recipes containing otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten on their own.=Die getrockneten Klingen eines Steinbruchstrauchs verleihen Rezepten mit ansonsten milden unterirdischen Lebensmitteln eine willkommene Note, aber sie sind zu scharf, um allein gegessen zu werden.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
This mushroom is inedible but continues producing modest levels of light long after it's picked.=Dieser Pilz ist ungenießbar, produziert aber noch lange nach seiner Ernte bescheidene Lichtmengen.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Threads of pig tail fiber.=Fäden aus Schweineschwanzfaser.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Too strong and thick to drink straight, sweet pod syrup is useful in food recipes.=Zu stark und zu dick, um gerade zu trinken, ist süßer Schotensirup in Lebensmittelrezepten nützlich.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Too sweet to be eaten directly, it makes an excellent ingredient in food recipes.=Zu süß, um direkt gegessen zu werden, ist eine hervorragende Zutat für Lebensmittelrezepte.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Whatever this fungus was in life, it is now dead.=Was auch immer dieser Pilz im Leben war, er ist jetzt tot.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
When baked alone it forms an edible bread, but it combines well with other more flavorful ingredients.=Wenn es alleine gebacken wird, bildet es ein essbares Brot, das sich jedoch gut mit anderen geschmackvolleren Zutaten kombinieren lässt.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
When dried in an oven, sweet pods produce a granular sugary substance.=Wenn süße Schoten im Ofen getrocknet werden, entsteht eine körnige zuckerhaltige Substanz.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
When milled, sweet pods produce a granular sugary substance.=Süße Schoten produzieren beim Mahlen eine körnige zuckerhaltige Substanz.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
While they can be eaten fresh, they can be monotonous fare and are perhaps better appreciated as part of a more complex prepared dish.=Während sie frisch gegessen werden können, können sie eintönig sein und werden vielleicht besser als Teil eines komplexeren zubereiteten Gerichts geschätzt.

### pig_tail.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Flattened Pig Tail=Abgeflachter Schweineschwanz
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig Tail=Schweineschwanz
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig Tail Spore=Schweineschwanzspore
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig tail thread=Schweineschwanzfaden

### plants.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cavern Fungi=Höhlenpilze
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dead Fungus=Toter Pilz

### plump_helmet.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet=Praller Helm
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump Helmet Spawn=Praller Helmlaich

### quarry_bush.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry Bush=Steinbruch Bush
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry Bush Leaves=Steinbruch Bush Blätter
Rock Nuts=

### sweet_pod.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dwarven Syrup Bucket=Zwergen-Sirup-Eimer
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dwarven Syrup Source=Zwergensirupquelle
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Flowing Dwarven Syrup=Fließender Zwergensirup
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet Pod=Süße Schote
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet Pod Spores=Süße Schotensporen
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet Pod Sugar=Süßer Schotenzucker
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet Pods=Süße Schoten


code:
# textdomain: df_farming

### cave_wheat.lua ###

Cave Straw=Grano di caverna
Cave Wheat=Grano di caverna
Cave Wheat Flour=Farina di grano di caverna
Cave Wheat Seed=Seme di grano di caverna
Dwarven Bread=Pane nanico
Flattened Cave Wheat=Grano di caverna

### cooking.lua ###

Cave Wheat Flour Biscuit=Farina di grano di caverna
Cave Wheat Flour Bun=Farina di grano di caverna
Cave Wheat Flour Pancake=Farina di grano di caverna
Cave Wheat Seed Loaf=Seme di grano di caverna
Cave Wheat Seed Puffs=Seme di grano di caverna
Cave Wheat Seed Risotto=Seme di grano di caverna
Dimple Cup Spore Flatbread=Spora di coppa increspata
Dimple Cup Spore Roll=Spora di coppa increspata
Dimple Cup Spore Scone=Spora di coppa increspata
Dwarven Syrup Delight=Secchio di sciroppo nanico
Dwarven Syrup Jellies=Sciroppo nanico
Dwarven Syrup Taffy=Sciroppo nanico
Pig Tail Spore Casserole=Spora di coda di maiale
Pig Tail Spore Sandwich=Spora di coda di maiale
Pig Tail Spore Tofu=Spora di coda di maiale
Plump Helmet Mince=Elmo rotondo
Plump Helmet Roast=Elmo rotondo
Plump Helmet Spawn Jambalaya=Prole di elmo rotondo
Plump Helmet Spawn Soup=Prole di elmo rotondo
Plump Helmet Sprout Stew=Prole di elmo rotondo
Plump Helmet Stalk Sausage=Prole di elmo rotondo
Quarry Bush Leaf Croissant=Foglia di cespuglio di cava
Quarry Bush Leaf Spicy Bun=Foglia di cespuglio di cava
Rock Nut Bread=Noce di roccia
Rock Nut Cake=Noce di roccia
Rock Nut Cookie=Noce di roccia
Stuffed Quarry Bush Leaf=Foglia di cespuglio di cava
Sweet Pod Spore Brule=Spora di baccello dolce
Sweet Pod Spore Dumplings=Spore di baccello dolce
Sweet Pod Spore Single Crust Pie=Spore di baccello dolce
Sweet Pod Sugar Cookie=Zucchero di baccello dolce
Sweet Pod Sugar Gingerbread=Zucchero di baccello dolce
Sweet Pod Sugar Roll=Zucchero di baccello dolce

### dimple_cup.lua ###

Dimple Cup=Coppa increspata
Dimple Cup Spores=Spore di coppa increspata

### doc.lua ###

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A crafting item that can be woven into textiles and other similar items.=Un oggetto di artigianato che può essere tessuto in tessuti e altri oggetti simili.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A meal made from the admixture of two ingredients, it keeps well but are not a rich source of nutrients.=Un pasto composto dalla miscela di due ingredienti, si conserva bene ma non è una ricca fonte di nutrienti.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A meal made from three ingredients mixed together. They're more wholesome, packing more nutrition into a single serving.=Un pasto composto da tre ingredienti mescolati insieme. Sono più sani e contengono più nutrimento in una singola porzione.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A rare breed of fungus from deep underground that produces a bushy cluster of rumpled gray 'blades'. The biological function of these blades is not known, as quarry bushes reproduce via hard-shelled nodules that grow down at the blade's base.=Una rara razza di fungo proveniente dal sottosuolo profondo che produce un folto gruppo di "lame" grigie spiegazzate. La funzione biologica di queste lame non è nota, poiché i cespugli di cava si riproducono tramite noduli a guscio duro che crescono alla base della lama.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A species of lavender mushroom ubiquitous in caves that is most notable for the soft bioluminescence it produces.=Una specie di fungo lavanda onnipresente nelle grotte che è più notevole per la morbida bioluminescenza che produce.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Bread baked from cave wheat flour is tough and durable. A useful ration for long expeditions.=Il pane cotto dalla farina di grano di grotta è duro e durevole. Un rapporto utile per lunghe spedizioni.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave wheat is literally a breed of grain-producing grass that somehow lost its ability to photosynthesize and adapted to a more fungal style of life.=Il grano delle caverne è letteralmente una razza di erba che produce grano che in qualche modo ha perso la sua capacità di fotosintetizzare e adattata a uno stile di vita più fungino.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Cave wheat seed ground into a powder suitable for cooking.=Semi di grano di caverna macinati in una polvere adatta alla cottura.
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Crushing them in a bucket squeezes out a flavorful syrup.=Schiacciandoli in un secchio spreme uno sciroppo saporito.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dead fungus quickly decays into an unrecognizable mess. It can be used as weak fuel or terrible decor.=Il fungo morto decade rapidamente in un pasticcio irriconoscibile. Può essere usato come combustibile debole o arredamento terribile.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Dimple cups can be dried, ground, and processed to extract a deep blue dye.=Le coppe fossette possono essere asciugate, macinate e lavorate per estrarre un colorante blu intenso.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Four finely minced ingredients combine into a fine, full meal.=Quattro ingredienti finemente tritati si combinano in un fine pasto completo.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
It's not tasty, but it keeps you going.=Non è gustoso, ma ti fa andare avanti.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Like its surface cousin, cave wheat produces grain that can be ground into a form of flour.=Come il suo cugino di superficie, il grano delle caverne produce grano che può essere macinato in una forma di farina.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig tail stalks can be processed to extract fibers useful as thread.=Gli steli della coda di maiale possono essere lavorati per estrarre fibre utili come filo.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Pig tails are a fibrous fungal growth that's most notable for its twisting stalks. In a mature stand of pig tails the helical stalks intertwine into a dense mesh.=Le code di maiale sono una crescita fungina fibrosa che è più notevole per i suoi gambi contorti. In un gruppo maturo di code di maiale, gli steli elicoidali si intrecciano in una fitta rete.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Plump helmets are a thick, fleshy mushroom that's edible picked straight from the ground. They form a staple diet for both lost cave explorers and the fauna that preys on them.=I caschi paffuti sono un fungo spesso e carnoso che è commestibile raccolto direttamente da terra. Costituiscono una dieta base sia per gli esploratori di caverne perduti che per la fauna che li preda.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are edible with processing.=Le foglie ei noduli di arbusti di cava (chiamati "noci di roccia") possono essere raccolti e sono commestibili con la lavorazione.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Quarry bush leaves can be used as an ingredient in foodstuffs.=Le foglie di cespuglio di cava possono essere utilizzate come ingrediente nei prodotti alimentari.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet pod sugar has a pink tint to it.=Lo zucchero di baccello dolce ha una sfumatura rosa.
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet pod syrup is thick and flavorful.=Lo sciroppo di baccello dolce è denso e saporito.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Sweet pods grow in rich soil, and once they reach maturity they draw that supply of nutrients up to concentrate it in their fruiting bodies. They turn bright red when ripe and can be processed in a variety of ways to extract the sugars they contain.=I baccelli dolci crescono in un terreno fertile e, una volta raggiunta la maturità, assorbono quella scorta di sostanze nutritive per concentrarla nei loro corpi fruttiferi. Diventano di un rosso brillante quando sono maturi e possono essere lavorati in vari modi per estrarre gli zuccheri che contengono.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
The distinctive midnight-blue caps of these mushrooms are inverted, exposing their gills to any breeze that might pass, and have dimpled edges that give them their name.=I caratteristici cappucci blu notte di questi funghi sono invertiti, esponendo le loro branchie a qualsiasi brezza che potrebbe passare, e hanno bordi increspati che danno loro il nome.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
The dried blades of a quarry bush add a welcome zing to recipes containing otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten on their own.=Le lame essiccate di un cespuglio di cava aggiungono un tocco di benvenuto alle ricette che contengono cibi sotterranei altrimenti blandi, ma sono troppo piccanti per essere mangiati da soli.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
This mushroom is inedible but continues producing modest levels of light long after it's picked.=Questo fungo non è commestibile ma continua a produrre livelli modesti di luce molto tempo dopo essere stato raccolto.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Threads of pig tail fiber.=Fili di fibra di coda di maiale.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Too strong and thick to drink straight, sweet pod syrup is useful in food recipes.=Troppo forte e denso per essere bevuto liscio, lo sciroppo di baccelli dolce è utile nelle ricette alimentari.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Too sweet to be eaten directly, it makes an excellent ingredient in food recipes.=Troppo dolce per essere consumato direttamente, è un ottimo ingrediente nelle ricette alimentari.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Whatever this fungus was in life, it is now dead.=Qualunque cosa fosse questo fungo in vita, ora è morto.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
When baked alone it forms an edible bread, but it combines well with other more flavorful ingredients.=Cotto da solo forma un pane commestibile, ma si abbina bene con altri ingredienti più saporiti.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
When dried in an oven, sweet pods produce a granular sugary substance.=Quando essiccati in un forno, i baccelli dolci producono una sostanza zuccherina granulare.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
When milled, sweet pods produce a granular sugary substance.=Quando vengono macinati, i baccelli dolci producono una sostanza zuccherina granulare.

#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
While they can be eaten fresh, they can be monotonous fare and are perhaps better appreciated as part of a more complex prepared dish.=Sebbene possano essere consumati freschi, possono essere piatti monotoni e forse sono meglio apprezzati come parte di un piatto preparato più complesso.

### pig_tail.lua ###

Flattened Pig Tail=Coda di maiale
Pig Tail=Coda di maiale
Pig Tail Spore=Spora di coda di maiale
Pig tail thread=Filo di coda di maiale

### plants.lua ###

Cavern Fungi=Funghi di caverna
Dead Fungus=Fungo morto

### plump_helmet.lua ###

Plump Helmet=Elmo rotondo
Plump Helmet Spawn=Prole di elmo rotondo

### quarry_bush.lua ###

Quarry Bush=Cespuglio di cava
Quarry Bush Leaves=Foglie di cespuglio di cava
Rock Nuts=Noci di roccia

### sweet_pod.lua ###

Dwarven Syrup Bucket=Secchio di sciroppo nanico
Dwarven Syrup Source=Fonte di sciroppo nanico
Flowing Dwarven Syrup=Sciroppo nanico che scorre
Sweet Pod=Baccello dolce
Sweet Pod Spores=Spore di baccello dolce
Sweet Pod Sugar=Zucchero di baccello dolce
Sweet Pods=Baccelli dolci


code:
# textdomain: df_farming

### cave_wheat.lua ###

Cave Straw=
Cave Wheat=
Cave Wheat Flour=
Cave Wheat Seed=
Dwarven Bread=
Flattened Cave Wheat=

### cooking.lua ###

Cave Wheat Flour Biscuit=
Cave Wheat Flour Bun=
Cave Wheat Flour Pancake=
Cave Wheat Seed Loaf=
Cave Wheat Seed Puffs=
Cave Wheat Seed Risotto=
Dimple Cup Spore Flatbread=
Dimple Cup Spore Roll=
Dimple Cup Spore Scone=
Dwarven Syrup Delight=
Dwarven Syrup Jellies=
Dwarven Syrup Taffy=
Pig Tail Spore Casserole=
Pig Tail Spore Sandwich=
Pig Tail Spore Tofu=
Plump Helmet Mince=
Plump Helmet Roast=
Plump Helmet Spawn Jambalaya=
Plump Helmet Spawn Soup=
Plump Helmet Sprout Stew=
Plump Helmet Stalk Sausage=
Quarry Bush Leaf Croissant=
Quarry Bush Leaf Spicy Bun=
Rock Nut Bread=
Rock Nut Cake=
Rock Nut Cookie=
Stuffed Quarry Bush Leaf=
Sweet Pod Spore Brule=
Sweet Pod Spore Dumplings=
Sweet Pod Spore Single Crust Pie=
Sweet Pod Sugar Cookie=
Sweet Pod Sugar Gingerbread=
Sweet Pod Sugar Roll=

### dimple_cup.lua ###

Dimple Cup=
Dimple Cup Spores=

### doc.lua ###

A crafting item that can be woven into textiles and other similar items.=

A meal made from the admixture of two ingredients, it keeps well but are not a rich source of nutrients.=

A meal made from three ingredients mixed together. They're more wholesome, packing more nutrition into a single serving.=

A rare breed of fungus from deep underground that produces a bushy cluster of rumpled gray 'blades'. The biological function of these blades is not known, as quarry bushes reproduce via hard-shelled nodules that grow down at the blade's base.=

A species of lavender mushroom ubiquitous in caves that is most notable for the soft bioluminescence it produces.=

Bread baked from cave wheat flour is tough and durable. A useful ration for long expeditions.=

Cave wheat is literally a breed of grain-producing grass that somehow lost its ability to photosynthesize and adapted to a more fungal style of life.=

Cave wheat seed ground into a powder suitable for cooking.=
Crushing them in a bucket squeezes out a flavorful syrup.=

Dead fungus quickly decays into an unrecognizable mess. It can be used as weak fuel or terrible decor.=

Dimple cups can be dried, ground, and processed to extract a deep blue dye.=

Four finely minced ingredients combine into a fine, full meal.=

It's not tasty, but it keeps you going.=

Like its surface cousin, cave wheat produces grain that can be ground into a form of flour.=

Pig tail stalks can be processed to extract fibers useful as thread.=

Pig tails are a fibrous fungal growth that's most notable for its twisting stalks. In a mature stand of pig tails the helical stalks intertwine into a dense mesh.=

Plump helmets are a thick, fleshy mushroom that's edible picked straight from the ground. They form a staple diet for both lost cave explorers and the fauna that preys on them.=

Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are edible with processing.=

Quarry bush leaves can be used as an ingredient in foodstuffs.=

Sweet pod sugar has a pink tint to it.=
Sweet pod syrup is thick and flavorful.=

Sweet pods grow in rich soil, and once they reach maturity they draw that supply of nutrients up to concentrate it in their fruiting bodies. They turn bright red when ripe and can be processed in a variety of ways to extract the sugars they contain.=

The distinctive midnight-blue caps of these mushrooms are inverted, exposing their gills to any breeze that might pass, and have dimpled edges that give them their name.=

The dried blades of a quarry bush add a welcome zing to recipes containing otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten on their own.=

This mushroom is inedible but continues producing modest levels of light long after it's picked.=

Threads of pig tail fiber.=

Too strong and thick to drink straight, sweet pod syrup is useful in food recipes.=

Too sweet to be eaten directly, it makes an excellent ingredient in food recipes.=

Whatever this fungus was in life, it is now dead.=

When baked alone it forms an edible bread, but it combines well with other more flavorful ingredients.=

When dried in an oven, sweet pods produce a granular sugary substance.=

When milled, sweet pods produce a granular sugary substance.=

While they can be eaten fresh, they can be monotonous fare and are perhaps better appreciated as part of a more complex prepared dish.=

### pig_tail.lua ###

Flattened Pig Tail=
Pig Tail=
Pig Tail Spore=
Pig tail thread=

### plants.lua ###

Cavern Fungi=
Dead Fungus=

### plump_helmet.lua ###

Plump Helmet=
Plump Helmet Spawn=

### quarry_bush.lua ###

Quarry Bush=
Quarry Bush Leaves=
Rock Nuts=

### sweet_pod.lua ###

Dwarven Syrup Bucket=
Dwarven Syrup Source=
Flowing Dwarven Syrup=
Sweet Pod=
Sweet Pod Spores=
Sweet Pod Sugar=
Sweet Pods=


code:
name = df_farming
description = Adds farmable underground plants that die in sunlight. Also includes various cooking reactions.
depends = df_dependencies
optional_depends = cottages, dynamic_liquid, doc, crafting, footprints, oil


code:
local S = minetest.get_translator(minetest.get_current_modname())

local pig_tail_grow_time = df_farming.config.plant_growth_time * df_farming.config.pig_tail_delay_multiplier / 8

local register_pig_tail = function(number)
	local name = "df_farming:pig_tail_"..tostring(number)
	local def = {
		description = S("Pig Tail"),
		_doc_items_longdesc = df_farming.doc.pig_tail_desc,
		_doc_items_usagehelp = df_farming.doc.pig_tail_usage,
		drawtype = "plantlike",
		paramtype2 = "meshoptions",
		place_param2 = 3,
		tiles = {"dfcaverns_pig_tail_"..tostring(number)..".png"},
		inventory_image = "dfcaverns_pig_tail_"..tostring(number)..".png",
		paramtype = "light",
		walkable = false,
		is_ground_content = false,
		floodable = true,
		buildable_to = true,
		groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, fire_encouragement=60,fire_flammability=100, compostability=70, handy=1,shearsy=1,hoey=1, destroy_by_lava_flow=1,dig_by_piston=1},
		sounds = df_dependencies.sound_leaves(),
        selection_box = {
            type = "fixed",
            fixed = {
                {-8/16, -8/16, -8/16, 8/16, -8/16 + 2*number/16, 8/16},
            },
        },

		on_timer = function(pos, elapsed)
			df_farming.grow_underground_plant(pos, name, elapsed)
		end,

		drop = {
			max_items = 1,
			items = {
				{
					items = {'df_farming:pig_tail_seed 2', 'df_farming:pig_tail_thread 3'},
					rarity = 9-number,
				},
				{
					items = {'df_farming:pig_tail_seed 1', 'df_farming:pig_tail_thread 2'},
					rarity = 9-number,
				},
				{
					items = {'df_farming:pig_tail_seed'},
					rarity = 9-number,
				},
			},
		},
		_mcl_blast_resistance = 0.2,
		_mcl_hardness = 0.2,
	}

	if number < 8 then
		def._dfcaverns_next_stage_time = pig_tail_grow_time
		def._dfcaverns_next_stage = "df_farming:pig_tail_"..tostring(number+1)
	end

	minetest.register_node(name, def)
end

for i = 1,8 do
	register_pig_tail(i)
end

local place_list = {
	minetest.get_content_id("df_farming:pig_tail_1"),
	minetest.get_content_id("df_farming:pig_tail_2"),
	minetest.get_content_id("df_farming:pig_tail_3"),
	minetest.get_content_id("df_farming:pig_tail_4"),
	minetest.get_content_id("df_farming:pig_tail_5"),
	minetest.get_content_id("df_farming:pig_tail_6"),
	minetest.get_content_id("df_farming:pig_tail_7"),
	minetest.get_content_id("df_farming:pig_tail_8"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_pig_tail_vm = function(vi, area, data, param2_data)
	data[vi] = place_list[math.random(1,8)]
	param2_data[vi] = 3
end

df_farming.register_seed(
	"pig_tail_seed",
	S("Pig Tail Spore"),
	"dfcaverns_pig_tail_seed.png",
	"df_farming:pig_tail_1",
	pig_tail_grow_time,
	df_farming.doc.pig_tail_desc,
	df_farming.doc.pig_tail_usage)

minetest.register_craftitem("df_farming:pig_tail_thread", {
	description = S("Pig tail thread"),
	_doc_items_longdesc = df_farming.doc.pig_tail_thread_desc,
	_doc_items_usagehelp = df_farming.doc.pig_tail_thread_usage,
	inventory_image = "dfcaverns_pig_tail_thread.png",
	groups = {flammable = 1, thread = 1},
})

if df_dependencies.node_name_wool_white then
	minetest.register_craft({
		output = df_dependencies.node_name_wool_white,
		recipe = {
			{"group:thread", "group:thread"},
			{"group:thread", "group:thread"},
		}
	})
end
if df_dependencies.node_name_string then
	minetest.register_craft({
		output = df_dependencies.node_name_string .. " 2",
		recipe = {
			{"group:thread"},
			{"group:thread"},
		}
	})
end

minetest.register_craft({
	type = "fuel",
	recipe = "df_farming:pig_tail_thread",
	burntime = 1,
})

if minetest.get_modpath("footprints") then
	minetest.register_node("df_farming:pig_tail_trampled", {
		description = S("Flattened Pig Tail"),
		tiles = {"dfcaverns_pig_tail_flattened.png"},
		inventory_image = "dfcaverns_pig_tail_flattened.png",
		drawtype = "nodebox",
		paramtype = "light",
		paramtype2 = "facedir",
		buildable_to = true,
		node_box = {
			type = "fixed",
			fixed = {
				{-0.5, -0.5, -0.5, 0.5, -3 / 8, 0.5}
			},
		},
		groups = {snappy = 3, flammable = 2, attached_node = 1, handy=1, hoey=1, compostability=85, fire_encouragement=60, fire_flammability=20, fall_damage_add_percent=-30, destroy_by_lava_flow=1,dig_by_piston=1},
		drop = "",
		sounds = df_dependencies.sound_leaves(),
		_mcl_blast_resistance = 0.2,
		_mcl_hardness = 0.2,
	})

	footprints.register_trample_node("df_farming:pig_tail_5", {
		trampled_node_name = "df_farming:pig_tail_trampled",
		randomize_trampled_param2 = true,
	})
	footprints.register_trample_node("df_farming:pig_tail_6", {
		trampled_node_name = "df_farming:pig_tail_trampled",
		randomize_trampled_param2 = true,
	})
	footprints.register_trample_node("df_farming:pig_tail_7", {
		trampled_node_name = "df_farming:pig_tail_trampled",
		randomize_trampled_param2 = true,
	})
	footprints.register_trample_node("df_farming:pig_tail_8", {
		trampled_node_name = "df_farming:pig_tail_trampled",
		randomize_trampled_param2 = true,
	})
end