Add bonemeal, salt, fries
|
@ -12,7 +12,7 @@
|
|||
],
|
||||
"license": "GPLv2",
|
||||
"media_license": "CC BY-SA 4.0",
|
||||
"long_description": "# Farming Addons [x_farming]\n\n Extends Minetest default farming mod with new plants and crops using only minetest_game API (except couple of functions for e.g. block farming).\n \n Adds:\n \n * Empty Soup Bowl\n * Hog Stew\n * Beetroot\n * Carrot\n * Coffee\n * Corn\n * Melon\n * Obsidian Wart\n * Potato\n * Pumpkin\n * Cocoa\n * Kiwi Tree\n * Large Cactus with Fruit\n * Strawberry\n * Pine nut tree\n * Stevia\n * Soybean\n * and more..\n \n ## Biomes\n \n **Grassland**\n \n - Melon\n - Carrot\n - Soybean\n \n **Coniferous Forest**\n \n - Strawberry\n - Pine Nut Tree\n \n **Desert**\n \n - Large Cactus with Fruit (dragon fruit)\n \n **Savanna**\n \n - Kiwi Tree\n - Coffee\n - Stevia\n \n **Rainforest**\n \n - Cocoa\n \n **Underground**\n \n - Obsidian Wart (below -1000)\n \n **Sandstone desert**\n \n - Corn\n - Pumpkin\n \n **Cold desert**\n \n - Potato\n - Beetroot\n \n **Taiga**\n \n - Pine Nut Tree\n \n \n Seeds can be found also in dungeon chests.\n \n ",
|
||||
"long_description": "# Farming Addons [x_farming]\n\n Extends Minetest default farming mod with new plants and crops using only minetest_game API (except couple of functions for e.g. block farming).\n \n Adds:\n \n * Bonemeal\n * Empty Soup Bowl\n * Hog Stew\n * Beetroot\n * Carrot\n * Coffee\n * Corn\n * Melon\n * Obsidian Wart\n * Potato\n * Pumpkin\n * Cocoa\n * Kiwi Tree\n * Large Cactus with Fruit\n * Strawberry\n * Pine nut tree\n * Stevia\n * Soybean\n * Salt\n * and more..\n \n ## Biomes\n \n **Grassland**\n \n - Melon\n - Carrot\n - Soybean\n \n **Coniferous Forest**\n \n - Strawberry\n - Pine Nut Tree\n \n **Desert**\n \n - Large Cactus with Fruit (dragon fruit)\n \n **Savanna**\n \n - Kiwi Tree\n - Coffee\n - Stevia\n \n **Rainforest**\n \n - Cocoa\n \n **Underground**\n \n - Obsidian Wart (below -1000)\n \n **Sandstone desert**\n \n - Corn\n - Pumpkin\n \n **Cold desert**\n \n - Potato\n - Beetroot\n \n **Taiga**\n \n - Pine Nut Tree\n \n \n Seeds can be found also in dungeon chests.",
|
||||
"repo": "https://bitbucket.org/minetest_gamers/x_farming/src/master",
|
||||
"issue_tracker": "https://bitbucket.org/minetest_gamers/x_farming/issues",
|
||||
"forums": "26464"
|
||||
|
|
34
README.md
|
@ -192,6 +192,10 @@ Strawberries can be found in coniferous forest. They drop seeds and strawberries
|
|||
|
||||
Allows to harvest pine nuts. Roasted pine nuts can be eaten.
|
||||
|
||||
### Salt
|
||||
|
||||
Can be farmed as ingredient to craft other food recipes.
|
||||
|
||||
## Biomes
|
||||
|
||||
**Grassland**
|
||||
|
@ -237,6 +241,14 @@ Allows to harvest pine nuts. Roasted pine nuts can be eaten.
|
|||
|
||||
- Pine Nut Tree
|
||||
|
||||
**Rainforest Swamp**
|
||||
|
||||
- Salt
|
||||
|
||||
**Savanna Shore**
|
||||
|
||||
- Salt
|
||||
|
||||
|
||||
Seeds can be found also in dungeon chests.
|
||||
|
||||
|
@ -364,6 +376,8 @@ GNU Lesser General Public License v2.1 or later (see included LICENSE file)
|
|||
- x_farming_pine_nut_tree_top.png
|
||||
- x_farming_pine_nut_wood.png
|
||||
- x_farming_sugar.png
|
||||
- x_farming_x_bonemeal_particles.png (modified by SaKeL)
|
||||
- x_farming_salt.png (modified by SaKeL)
|
||||
|
||||
**LGPL-2.1-or-later, by SaKeL**
|
||||
|
||||
|
@ -428,12 +442,23 @@ GNU Lesser General Public License v2.1 or later (see included LICENSE file)
|
|||
- x_farming_stevia_7.png
|
||||
- x_farming_stevia_8.png
|
||||
- x_farming_stevia_seed.png
|
||||
- x_farming_x_bonemeal_bonemeal.png
|
||||
- x_farming_salt_1_side.png
|
||||
- x_farming_salt_1_top.png
|
||||
- x_farming_salt_2_side.png
|
||||
- x_farming_salt_2_top.png
|
||||
- x_farming_salt_3_side.png
|
||||
- x_farming_salt_3_top.png
|
||||
- x_farming_salt_4_side.png
|
||||
- x_farming_salt_4_top.png
|
||||
- x_farming_salt_water.png
|
||||
|
||||
**MIT**
|
||||
|
||||
- x_farming_kiwi_leaves.png (MTG - modified by SaKeL)
|
||||
- x_farming_junglesapling.png (MTG - modified by SaKeL)
|
||||
- x_farming_pine_nut_sapling.png (MTG - modified by SaKeL)
|
||||
- x_farming_salt_1_bottom.png
|
||||
|
||||
**Created by GeMinecraft and edited by TenPlus1**
|
||||
|
||||
|
@ -443,6 +468,15 @@ GNU Lesser General Public License v2.1 or later (see included LICENSE file)
|
|||
|
||||
- x_farming_chocolate.png
|
||||
|
||||
**Unknown**
|
||||
|
||||
- x_farming_fries.png
|
||||
|
||||
### Sound
|
||||
|
||||
**freesound.org**
|
||||
|
||||
- x_farming_x_bonemeal_grow.ogg
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
419
api.lua
|
@ -5,7 +5,8 @@ x_farming = {
|
|||
brown = "#DEB887",
|
||||
red = "#FF8080",
|
||||
green = "#98E698"
|
||||
}
|
||||
},
|
||||
x_bonemeal = {}
|
||||
}
|
||||
|
||||
-- how often node timers for plants will tick, +/- some random value
|
||||
|
@ -63,7 +64,6 @@ function x_farming.grow_block(pos, elapsed)
|
|||
|
||||
-- check if the fruit belongs to this stem
|
||||
for side,child_pos in pairs(children) do
|
||||
-- print(side, minetest.pos_to_string(child_pos))
|
||||
|
||||
local parent_pos_from_child = x_farming.meta_get_str("parent", child_pos)
|
||||
|
||||
|
@ -173,3 +173,418 @@ function x_farming.grow_pine_nut_tree(pos)
|
|||
minetest.place_schematic({x = pos.x - 2, y = pos.y, z = pos.z - 2},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
--
|
||||
-- Bonemeal
|
||||
--
|
||||
|
||||
------------
|
||||
-- Main API for x_bonemeal Mod
|
||||
-- @author Juraj Vajda
|
||||
-- @license GNU LGPL 2.1
|
||||
----
|
||||
|
||||
--- Get creative mode setting from minetest.conf
|
||||
-- @local
|
||||
local creative_mod_cache = minetest.settings:get_bool("creative_mode")
|
||||
|
||||
--- Check if creating mode is enabled or player has creative privs
|
||||
-- @function
|
||||
-- @param name Player name
|
||||
-- @return Boolean
|
||||
function x_farming.x_bonemeal.is_creative(name)
|
||||
return creative_mod_cache or minetest.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
--- Check if node has a soil below its self
|
||||
-- @function
|
||||
-- @param under table of position
|
||||
-- @return Boolean
|
||||
function x_farming.x_bonemeal.is_on_soil(under)
|
||||
local below = minetest.get_node({x = under.x, y = under.y - 1, z = under.z})
|
||||
if minetest.get_item_group(below.name, "soil") == 0 then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Check if node has a sand below its self
|
||||
-- @function
|
||||
-- @param under table of position
|
||||
-- @return Boolean
|
||||
function x_farming.x_bonemeal.is_on_sand(under)
|
||||
local below = minetest.get_node({x = under.x, y = under.y - 1, z = under.z})
|
||||
if minetest.get_item_group(below.name, "sand") == 0 then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Growth steps for farming plants, there is no way of getting them dynamically, so they are defined in the local table variable
|
||||
-- @table farming_steps
|
||||
-- @local
|
||||
local farming_steps = {
|
||||
["farming:wheat"] = 8,
|
||||
["farming:cotton"] = 8,
|
||||
["x_farming:coffee"] = 5,
|
||||
["x_farming:corn"] = 10,
|
||||
["x_farming:obsidian_wart"] = 6,
|
||||
["x_farming:melon"] = 8,
|
||||
["x_farming:pumpkin"] = 8,
|
||||
["x_farming:carrot"] = 8,
|
||||
["x_farming:potato"] = 8,
|
||||
["x_farming:beetroot"] = 8,
|
||||
["x_farming:strawberry"] = 4,
|
||||
["x_farming:stevia"] = 8,
|
||||
["x_farming:soybean"] = 7,
|
||||
["x_farming:salt"] = 7,
|
||||
}
|
||||
|
||||
--- Particle and sound effect after the bone meal is successfully used
|
||||
-- @function
|
||||
-- @param pos table containing position
|
||||
function x_farming.x_bonemeal.particle_effect(pos)
|
||||
minetest.sound_play("x_farming_x_bonemeal_grow", {
|
||||
pos = pos,
|
||||
gain = 0.5,
|
||||
})
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 6,
|
||||
time = 3,
|
||||
minpos = {x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4},
|
||||
maxpos = {x = pos.x + 0.4, y = pos.y, z = pos.z + 0.4},
|
||||
minvel = {x = 0, y = 0, z = 0},
|
||||
maxvel = {x = 0, y = 0.1, z = 0},
|
||||
minacc = vector.new({x = 0, y = 0, z = 0}),
|
||||
maxacc = vector.new({x = 0, y = 0.1, z = 0}),
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 3,
|
||||
texture = "x_farming_x_bonemeal_particles.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 8,
|
||||
aspect_h = 8,
|
||||
length = 3,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function x_farming.x_bonemeal.tableContains(table, value)
|
||||
local found = false
|
||||
|
||||
if not table or type(table) ~= "table" then
|
||||
return found
|
||||
end
|
||||
|
||||
for k, v in ipairs(table) do
|
||||
if v == value then
|
||||
found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return found
|
||||
end
|
||||
|
||||
function x_farming.x_bonemeal.groupContains(groups, fertility, value)
|
||||
local found = false
|
||||
|
||||
if not groups or type(groups) ~= "table" then
|
||||
return found
|
||||
end
|
||||
|
||||
if groups[fertility] and groups[fertility] == value then
|
||||
found = true
|
||||
end
|
||||
|
||||
return found
|
||||
end
|
||||
|
||||
--- Handle growth of decorations based on biome
|
||||
-- @function
|
||||
function x_farming.x_bonemeal.grow_grass_and_flowers(itemstack, user, pointed_thing)
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
|
||||
if not node then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pos0 = vector.subtract(pointed_thing.under, 3)
|
||||
local pos1 = vector.add(pointed_thing.under, 3)
|
||||
local biome_data = minetest.get_biome_data(pointed_thing.under)
|
||||
local biome_name = minetest.get_biome_name(biome_data.biome)
|
||||
local random_number = math.random(2, 6)
|
||||
local registered_decorations_filtered = {}
|
||||
local returned_itemstack = ItemStack(node.name .." 1")
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
local below_water = false
|
||||
local floats_on_water = false
|
||||
local node_in_decor = false
|
||||
local positions_dirty = {}
|
||||
local positions = {}
|
||||
local decor_place_on = {}
|
||||
-- print('biome_name', biome_name)
|
||||
|
||||
-- check 1 node below pointed node (floats on water)
|
||||
local test_node = minetest.get_node({x = pointed_thing.under.x, y = pointed_thing.under.y - 1, z = pointed_thing.under.z})
|
||||
local test_node_def = minetest.registered_nodes[test_node.name]
|
||||
|
||||
if test_node_def and test_node_def.liquidtype == "source" and minetest.get_item_group(test_node_def.name, "water") > 0 then
|
||||
floats_on_water = true
|
||||
end
|
||||
|
||||
-- check 2 nodes above pointed nodes (below water)
|
||||
local water_nodes_above = 0
|
||||
for i = 1, 2 do
|
||||
local test_node = minetest.get_node({x = pointed_thing.under.x, y = pointed_thing.under.y + i, z = pointed_thing.under.z})
|
||||
local test_node_def = minetest.registered_nodes[test_node.name]
|
||||
|
||||
if test_node_def and test_node_def.liquidtype == "source" and minetest.get_item_group(test_node_def.name, "water") > 0 then
|
||||
water_nodes_above = water_nodes_above + 1
|
||||
end
|
||||
end
|
||||
|
||||
if water_nodes_above == 2 then
|
||||
below_water = true
|
||||
end
|
||||
|
||||
if below_water then
|
||||
positions_dirty = minetest.find_nodes_in_area(pos0, pos1, node.name)
|
||||
elseif floats_on_water then
|
||||
positions_dirty = minetest.find_nodes_in_area(pos0, pos1, "air")
|
||||
else
|
||||
positions_dirty = minetest.find_nodes_in_area_under_air(pos0, pos1, node.name)
|
||||
end
|
||||
|
||||
-- find suitable decorations
|
||||
for k, v in pairs(minetest.registered_decorations) do
|
||||
-- only for "simple" decoration types
|
||||
if v.deco_type == "simple" then
|
||||
local found = false
|
||||
|
||||
-- filter based on biome name in `biomes` table and node name in `place_on` table
|
||||
if x_farming.x_bonemeal.tableContains(v.biomes, biome_name) then
|
||||
table.insert(registered_decorations_filtered, v)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- clicked node is in decoration
|
||||
if v.decoration == node.name then
|
||||
node_in_decor = true
|
||||
end
|
||||
|
||||
-- all nodes on which decoration can be placed on
|
||||
-- indexed by name
|
||||
if not decor_place_on[v.place_on] then
|
||||
for k, v in ipairs(v.place_on) do
|
||||
decor_place_on[v] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- find suitable positions
|
||||
for j, pos_value in ipairs(positions_dirty) do
|
||||
local node_at_pos = minetest.get_node(pos_value)
|
||||
|
||||
if below_water then
|
||||
-- below water
|
||||
local water_nodes_above = 0
|
||||
|
||||
-- check if 2 nodes above are water
|
||||
for i = 1, 2 do
|
||||
local test_node = minetest.get_node({x = pos_value.x, y = pos_value.y + i, z = pos_value.z})
|
||||
local test_node_def = minetest.registered_nodes[test_node.name]
|
||||
|
||||
if test_node_def and test_node_def.liquidtype == "source" and minetest.get_item_group(test_node_def.name, "water") > 0 then
|
||||
water_nodes_above = water_nodes_above + 1
|
||||
end
|
||||
end
|
||||
|
||||
if water_nodes_above == 2 and decor_place_on[test_node.name] then
|
||||
table.insert(positions, pos_value)
|
||||
end
|
||||
else
|
||||
-- above water (not on water)
|
||||
if decor_place_on[node_at_pos.name] then
|
||||
table.insert(positions, pos_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- find suitable positions (float on water)
|
||||
if floats_on_water then
|
||||
for j, pos_value in ipairs(positions_dirty) do
|
||||
local node_at_pos = minetest.get_node(pos_value)
|
||||
local node_at_pos_below = minetest.get_node({x = pos_value.x, y = pos_value.y - 1, z = pos_value.z})
|
||||
local test_node_def = minetest.registered_nodes[node_at_pos_below.name]
|
||||
|
||||
if test_node_def and test_node_def.liquidtype == "source" and minetest.get_item_group(test_node_def.name, "water") > 0 then
|
||||
table.insert(positions, pos_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- place decorations on random positions
|
||||
if #positions > 0 and #registered_decorations_filtered > 0 then
|
||||
for i = 1, random_number do
|
||||
local idx = math.random(#positions)
|
||||
local random_pos = positions[idx]
|
||||
local random_decor = registered_decorations_filtered[math.random(#registered_decorations_filtered)]
|
||||
local random_decor_item = random_decor.decoration
|
||||
|
||||
if floats_on_water and node_in_decor then
|
||||
random_decor_item = node.name
|
||||
elseif type(random_decor.decoration) == "table" then
|
||||
random_decor_item = random_decor.decoration[math.random(#random_decor.decoration)]
|
||||
end
|
||||
|
||||
local random_decor_item_def = minetest.registered_nodes[random_decor_item]
|
||||
|
||||
if random_pos ~= nil then
|
||||
if random_decor_item_def.on_place ~= nil and node_def and not node_def.on_rightclick then
|
||||
-- on_place
|
||||
local pt = {
|
||||
type = "node",
|
||||
above = {
|
||||
x = random_pos.x,
|
||||
y = random_pos.y + 1,
|
||||
z = random_pos.z
|
||||
},
|
||||
under = {
|
||||
x = random_pos.x,
|
||||
y = random_pos.y,
|
||||
z = random_pos.z
|
||||
}
|
||||
}
|
||||
|
||||
if floats_on_water then
|
||||
pt.above.y = random_pos.y
|
||||
pt.under.y = random_pos.y - 1
|
||||
end
|
||||
|
||||
returned_itemstack = random_decor_item_def.on_place(ItemStack(random_decor_item), user, pt)
|
||||
if returned_itemstack and returned_itemstack:is_empty() then
|
||||
x_farming.x_bonemeal.particle_effect(pt.above)
|
||||
end
|
||||
elseif random_decor_item_def ~= nil then
|
||||
-- everything else
|
||||
local pos_y = 1
|
||||
|
||||
if random_decor.place_offset_y ~= nil then
|
||||
pos_y = random_decor.place_offset_y
|
||||
end
|
||||
|
||||
returned_itemstack = ItemStack("")
|
||||
x_farming.x_bonemeal.particle_effect(random_pos)
|
||||
minetest.set_node({x = random_pos.x, y = random_pos.y + pos_y, z = random_pos.z}, { name = random_decor_item })
|
||||
end
|
||||
|
||||
table.remove(positions, idx)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- take item
|
||||
if returned_itemstack and returned_itemstack:is_empty() and not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
--- Handle farming and farming addons plants. Needed to copy this function from minetest_game and modify it in order to ommit some checks (e.g. light..)
|
||||
-- @function
|
||||
function x_farming.x_bonemeal.grow_farming(itemstack, user, pointed_thing)
|
||||
local pos_under = pointed_thing.under
|
||||
local replace_node_name = minetest.get_node(pos_under).name
|
||||
local ndef = minetest.registered_nodes[replace_node_name]
|
||||
local take_item = false
|
||||
|
||||
if not ndef.next_plant or ndef.next_plant == "x_farming:pumpkin_fruit" or ndef.next_plant == "x_farming:melon_fruit" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pos0 = vector.subtract(pointed_thing.under, 3)
|
||||
local pos1 = vector.add(pointed_thing.under, 3)
|
||||
local positions = minetest.find_nodes_in_area(pos0, pos1, {"group:plant", "group:seed"})
|
||||
|
||||
for i, pos in ipairs(positions) do
|
||||
local isFertile = false
|
||||
replace_node_name = minetest.get_node(pos).name
|
||||
|
||||
-- check if on wet soil
|
||||
local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
local below_def = minetest.registered_nodes[below.name]
|
||||
|
||||
if minetest.get_item_group(below.name, "soil") == 3 then
|
||||
local plant = replace_node_name:split("_")[1]
|
||||
local current_step = tonumber(string.reverse(string.reverse(replace_node_name):split("_")[1]))
|
||||
local max_step = farming_steps[replace_node_name:gsub("_%d+", "", 1)]
|
||||
|
||||
-- check if seed
|
||||
-- farming:seed_wheat
|
||||
local mod_plant = replace_node_name:split(":")
|
||||
-- seed_wheat
|
||||
local seed_plant = mod_plant[2]:split("_")
|
||||
local seed_name = replace_node_name
|
||||
|
||||
if seed_plant[1] == "seed" then
|
||||
current_step = 0
|
||||
if replace_node_name == "x_farming:seed_obsidian_wart" then
|
||||
replace_node_name = mod_plant[1]..":"..seed_plant[2].."_"..seed_plant[3]
|
||||
else
|
||||
replace_node_name = mod_plant[1]..":"..seed_plant[2]
|
||||
end
|
||||
max_step = farming_steps[replace_node_name]
|
||||
replace_node_name = replace_node_name.."_"..current_step
|
||||
else
|
||||
if string.find(replace_node_name, "obsidian_wart") then
|
||||
seed_name = mod_plant[1]..":seed_"..seed_plant[1].."_"..seed_plant[2]
|
||||
else
|
||||
seed_name = mod_plant[1]..":seed_"..seed_plant[1]
|
||||
end
|
||||
end
|
||||
|
||||
-- search for fertility (again after checking soil)
|
||||
local seed_def = minetest.registered_nodes[seed_name]
|
||||
|
||||
if seed_def and below_def then
|
||||
if below_def.groups then
|
||||
for i,v in ipairs(seed_def.fertility) do
|
||||
if not isFertile then
|
||||
isFertile = x_farming.x_bonemeal.groupContains(below_def.groups, v, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if current_step ~= nil and max_step ~= nil and current_step ~= max_step and isFertile then
|
||||
local available_steps = max_step - current_step
|
||||
local new_step = max_step - available_steps + math.random(available_steps)
|
||||
local new_plant = replace_node_name:gsub("_%d+", "_"..new_step, 1)
|
||||
take_item = true
|
||||
|
||||
local placenode_def = minetest.registered_nodes[new_plant]
|
||||
|
||||
local placenode = {name = new_plant}
|
||||
if placenode_def and placenode_def.place_param2 then
|
||||
placenode.param2 = placenode_def.place_param2
|
||||
end
|
||||
x_farming.x_bonemeal.particle_effect(pos)
|
||||
minetest.swap_node(pos, placenode)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) and take_item then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
------------
|
||||
-- Bonemeal Mod for Minetest by SaKeL
|
||||
-- @author Juraj Vajda
|
||||
-- @license GNU LGPL 2.1
|
||||
----
|
||||
|
||||
--- Register craftitem definition - added to minetest.registered_items[name]
|
||||
-- @function
|
||||
minetest.register_craftitem("x_farming:bonemeal", {
|
||||
description = "Bonemeal - use it as a fertilizer for most plants",
|
||||
inventory_image = "x_farming_x_bonemeal_bonemeal.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
|
||||
if not under then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
if minetest.is_protected(under, user:get_player_name()) then return end
|
||||
|
||||
local node = minetest.get_node(under)
|
||||
|
||||
if not node then return end
|
||||
if node.name == "ignore" then return end
|
||||
|
||||
local mod = node.name:split(":")[1]
|
||||
|
||||
--
|
||||
-- Farming
|
||||
--
|
||||
|
||||
if (mod == "farming" or mod == "x_farming") and not string.find(node.name, "_sapling") and not string.find(node.name, "_seedling") then
|
||||
x_farming.x_bonemeal.grow_farming(itemstack, user, pointed_thing)
|
||||
|
||||
--
|
||||
-- Default (Trees, Bushes, Papyrus)
|
||||
--
|
||||
|
||||
-- christmas tree
|
||||
elseif node.name == "x_default:christmas_tree_sapling" then
|
||||
local chance = math.random(2)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 1 then
|
||||
if minetest.find_node_near(under, 1, {"group:snowy"}) then
|
||||
x_default.grow_snowy_christmas_tree(under)
|
||||
else
|
||||
x_default.grow_christmas_tree(under)
|
||||
end
|
||||
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- apple tree
|
||||
elseif node.name == "default:sapling" then
|
||||
local chance = math.random(2)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 1 then
|
||||
default.grow_new_apple_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- jungle tree
|
||||
elseif node.name == "default:junglesapling" then
|
||||
local chance = math.random(2)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 1 then
|
||||
default.grow_new_jungle_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- emergent jungle tree
|
||||
elseif node.name == "default:emergent_jungle_sapling" then
|
||||
local chance = math.random(2)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 1 then
|
||||
default.grow_new_emergent_jungle_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- acacia tree
|
||||
elseif node.name == "default:acacia_sapling" then
|
||||
local chance = math.random(2)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 1 then
|
||||
default.grow_new_acacia_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- aspen tree
|
||||
elseif node.name == "default:aspen_sapling" then
|
||||
local chance = math.random(2)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 1 then
|
||||
default.grow_new_aspen_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- pine tree
|
||||
elseif node.name == "default:pine_sapling" then
|
||||
local chance = math.random(4)
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
|
||||
if chance == 3 then
|
||||
default.grow_new_snowy_pine_tree(under)
|
||||
elseif chance == 1 then
|
||||
default.grow_new_pine_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Bush
|
||||
elseif node.name == "default:bush_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
default.grow_bush(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Acacia bush
|
||||
elseif node.name == "default:acacia_bush_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
default.grow_acacia_bush(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Pine bush
|
||||
elseif node.name == "default:pine_bush_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
default.grow_pine_bush(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Blueberry bush
|
||||
elseif node.name == "default:blueberry_bush_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
default.grow_blueberry_bush(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Papyrus
|
||||
elseif node.name == "default:papyrus" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_soil(under) then return end
|
||||
default.grow_papyrus(under, node)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Large Cactus
|
||||
elseif node.name == "default:large_cactus_seedling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_sand(under) then return end
|
||||
default.grow_large_cactus(under, node)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Kiwi Tree
|
||||
elseif node.name == "x_farming:kiwi_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
x_farming.grow_kiwi_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Cactus Seedling
|
||||
elseif node.name == "x_farming:large_cactus_with_fruit_seedling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
if not x_farming.x_bonemeal.is_on_sand(under) then return end
|
||||
x_farming.grow_large_cactus(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Jungle Tree with Cocoa
|
||||
elseif node.name == "x_farming:jungle_with_cocoa_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
x_farming.grow_jungle_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
-- Pine Nut Tree
|
||||
elseif node.name == "x_farming:pine_nut_sapling" then
|
||||
local chance = math.random(2)
|
||||
|
||||
if chance == 1 then
|
||||
x_farming.grow_pine_nut_tree(under)
|
||||
x_farming.x_bonemeal.particle_effect({x = under.x, y = under.y + 1, z = under.z})
|
||||
end
|
||||
-- take item if not in creative
|
||||
if not x_farming.x_bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
||||
else
|
||||
x_farming.x_bonemeal.grow_grass_and_flowers(itemstack, user, pointed_thing)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Crafting
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
output = "x_farming:bonemeal 9",
|
||||
recipe = {
|
||||
{"bones:bones"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "x_farming:bonemeal 9",
|
||||
recipe = {
|
||||
{"default:coral_skeleton"}
|
||||
}
|
||||
})
|
|
@ -58,9 +58,7 @@ minetest.register_node("x_farming:cactus_fruit", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
print('oldnode.param2', oldnode.param2)
|
||||
if oldnode.param2 == 20 then
|
||||
print('starting timer ...')
|
||||
minetest.set_node(pos, {name = "x_farming:cactus_fruit_mark"})
|
||||
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||
end
|
||||
|
|
13
crafting.lua
|
@ -159,7 +159,7 @@ minetest.register_craft( {
|
|||
output = "x_farming:corn_popcorn",
|
||||
recipe = {
|
||||
{"x_farming:corn_pop", "x_farming:corn_pop","x_farming:corn_pop"},
|
||||
{"default:paper", "","default:paper"},
|
||||
{"default:paper", "x_farming:salt","default:paper"},
|
||||
{"default:paper", "default:paper","default:paper"},
|
||||
}
|
||||
})
|
||||
|
@ -334,3 +334,14 @@ minetest.register_craft({
|
|||
output = "x_farming:donut_chocolate",
|
||||
recipe = {"x_farming:bottle_soymilk", "x_farming:sugar", "farming:flour", "x_farming:cocoa_bean"}
|
||||
})
|
||||
|
||||
-- Fries
|
||||
|
||||
minetest.register_craft({
|
||||
output = "x_farming:fries",
|
||||
recipe = {
|
||||
{"", "", "x_farming:salt"},
|
||||
{"", "x_farming:bakedpotato", ""},
|
||||
{"default:paper", "", ""}
|
||||
},
|
||||
})
|
||||
|
|
2
init.lua
|
@ -21,8 +21,10 @@ dofile(path.."/strawberry.lua")
|
|||
dofile(path.."/pine_nut.lua")
|
||||
dofile(path.."/stevia.lua")
|
||||
dofile(path.."/soybean.lua")
|
||||
dofile(path.."/salt.lua")
|
||||
dofile(path.."/nodes.lua")
|
||||
dofile(path.."/crafting.lua")
|
||||
dofile(path.."/bonemeal.lua")
|
||||
|
||||
-- hbhunger
|
||||
if x_farming.hbhunger ~= nil then
|
||||
|
|
20
nodes.lua
|
@ -1,3 +1,4 @@
|
|||
-- Donuts
|
||||
minetest.register_node("x_farming:donut", {
|
||||
description = "Donut" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 3"),
|
||||
drawtype = "plantlike",
|
||||
|
@ -33,3 +34,22 @@ minetest.register_node("x_farming:donut_chocolate", {
|
|||
sounds = default.node_sound_leaves_defaults(),
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- Fries
|
||||
minetest.register_node("x_farming:fries", {
|
||||
description = "Fries" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 6"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"x_farming_fries.png"},
|
||||
inventory_image = "x_farming_fries.png",
|
||||
wield_image = "x_farming_fries.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-7/16, -7/16, -7/16, 7/16, 7/16, 7/16}
|
||||
},
|
||||
groups = {dig_immediate = 3, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
|
@ -49,3 +49,6 @@ hbhunger.register_food("x_farming:pine_nut_roasted", 2)
|
|||
-- Donuts
|
||||
hbhunger.register_food("x_farming:donut", 3)
|
||||
hbhunger.register_food("x_farming:donut_chocolate", 4)
|
||||
|
||||
-- Fries
|
||||
hbhunger.register_food("x_farming:fries", 6)
|
||||
|
|
|
@ -0,0 +1,460 @@
|
|||
-- how often a growth failure tick is retried (e.g. too dark)
|
||||
local function tick_again(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(80, 160))
|
||||
end
|
||||
|
||||
-- SALT
|
||||
minetest.register_craftitem("x_farming:salt", {
|
||||
description = "Salt",
|
||||
tiles = {"x_farming_salt.png"},
|
||||
inventory_image = "x_farming_salt.png",
|
||||
wield_image = "x_farming_salt.png"
|
||||
})
|
||||
|
||||
minetest.register_node("x_farming:seed_salt", {
|
||||
description = "Salty Water (plant on wet soil)",
|
||||
tiles = {"x_farming_salt_water.png"},
|
||||
inventory_image = "x_farming_salt_water.png",
|
||||
wield_image = "x_farming_salt_water.png",
|
||||
fertility = {"grassland"},
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_1_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png"
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_1",
|
||||
on_timer = farming.grow_plant,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:is_player() and
|
||||
placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "x_farming:seed_salt")
|
||||
end,
|
||||
})
|
||||
|
||||
-- 1
|
||||
minetest.register_node("x_farming:salt_1", {
|
||||
description = "Salt 1",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_1_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 8},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 8},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_2",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- 2
|
||||
minetest.register_node("x_farming:salt_2", {
|
||||
description = "Salt 2",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_2_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png",
|
||||
"x_farming_salt_1_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 7},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 7},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_3",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- 3
|
||||
minetest.register_node("x_farming:salt_3", {
|
||||
description = "Salt 3",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_2_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_2_side.png",
|
||||
"x_farming_salt_2_side.png",
|
||||
"x_farming_salt_2_side.png",
|
||||
"x_farming_salt_2_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 6},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 6},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
{-0.0625, -0.5, -0.0625, 0.0625, -0.25, 0.0625},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_4",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- 4
|
||||
minetest.register_node("x_farming:salt_4", {
|
||||
description = "Salt 4",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_3_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_2_side.png",
|
||||
"x_farming_salt_2_side.png",
|
||||
"x_farming_salt_2_side.png",
|
||||
"x_farming_salt_2_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 5},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 5},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
{-0.0625, -0.5, -0.0625, 0.0625, -0.25, 0.0625},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_5",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- 5
|
||||
minetest.register_node("x_farming:salt_5", {
|
||||
description = "Salt 5",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_3_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_3_side.png",
|
||||
"x_farming_salt_3_side.png",
|
||||
"x_farming_salt_3_side.png",
|
||||
"x_farming_salt_3_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 4},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 4},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
{-0.1875, -0.375, -0.1875, 0.1875, -0.25, 0.1875},
|
||||
{-0.0625, -0.25, -0.0625, 0.0625, -0.125, 0.0625},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_6",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- 6
|
||||
minetest.register_node("x_farming:salt_6", {
|
||||
description = "Salt 6",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_4_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_3_side.png",
|
||||
"x_farming_salt_3_side.png",
|
||||
"x_farming_salt_3_side.png",
|
||||
"x_farming_salt_3_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 3},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 3},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
{-0.1875, -0.375, -0.1875, 0.1875, -0.25, 0.1875},
|
||||
{-0.0625, -0.25, -0.0625, 0.0625, -0.125, 0.0625},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = "x_farming:salt_7",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- 7
|
||||
minetest.register_node("x_farming:salt_7", {
|
||||
description = "Salt 7",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"x_farming_salt_4_top.png",
|
||||
"x_farming_salt_1_bottom.png",
|
||||
"x_farming_salt_4_side.png",
|
||||
"x_farming_salt_4_side.png",
|
||||
"x_farming_salt_4_side.png",
|
||||
"x_farming_salt_4_side.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {"x_farming:salt"}, rarity = 1},
|
||||
{items = {"x_farming:salt"}, rarity = 2},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 1},
|
||||
{items = {"x_farming:seed_salt"}, rarity = 2},
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
{-0.3125, -0.5, -0.3125, 0.3125, -0.25, 0.3125},
|
||||
{-0.1875, -0.5, -0.1875, 0.1875, -0.125, 0.1875},
|
||||
{-0.0625, -0.5, -0.0625, 0.0625, 0, 0.0625},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
minlight = 13,
|
||||
maxlight = 15
|
||||
})
|
||||
|
||||
-- replacement LBM for pre-nodetimer plants
|
||||
minetest.register_lbm({
|
||||
name = "x_farming:start_nodetimer_salt",
|
||||
nodenames = {
|
||||
"x_farming:seed_salt",
|
||||
"x_farming:salt_1",
|
||||
"x_farming:salt_2",
|
||||
"x_farming:salt_3",
|
||||
"x_farming:salt_4",
|
||||
"x_farming:salt_5",
|
||||
"x_farming:salt_6",
|
||||
},
|
||||
action = function(pos, node)
|
||||
tick_again(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "x_farming:salt_7",
|
||||
deco_type = "schematic",
|
||||
place_on = {"default:dirt", "default:dry_dirt"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = -0.3,
|
||||
scale = 0.7,
|
||||
spread = {x = 200, y = 200, z = 200},
|
||||
seed = 354,
|
||||
octaves = 3,
|
||||
persist = 0.7
|
||||
},
|
||||
biomes = {"rainforest_swamp", "savanna_shore"},
|
||||
y_max = 0,
|
||||
y_min = 0,
|
||||
schematic = minetest.get_modpath("x_farming") .. "/schematics/x_farming_salt_decor.mts",
|
||||
})
|
|
@ -438,3 +438,14 @@ mts_save("x_farming_pine_nut_tree_from_sapling", {
|
|||
_, _, _, _, _,
|
||||
}
|
||||
})
|
||||
|
||||
-- Salt
|
||||
|
||||
mts_save("x_farming_salt_decor", {
|
||||
size = {x = 1, y = 3, z = 1},
|
||||
data = {
|
||||
{name = "default:dirt", prob = 255, force_place = true},
|
||||
{name = "default:dirt", prob = 255, force_place = true},
|
||||
{name = "x_farming:salt_7", prob = 255},
|
||||
}
|
||||
})
|
BIN
screenshot.png
Before Width: | Height: | Size: 402 KiB After Width: | Height: | Size: 559 KiB |
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 216 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 175 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 348 B |
After Width: | Height: | Size: 176 B |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 391 B |
After Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 185 B |
After Width: | Height: | Size: 235 B |