tons of farming/plant changes and added flowers
This commit is contained in:
parent
16d8a18f52
commit
bfc9d084dd
@ -512,6 +512,16 @@ minetest.register_craft(
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = "default:fertilizer 3",
|
||||
recipe = {
|
||||
{"", "default:fiber", ""},
|
||||
{"default:fern", "default:fern", "default:fern"},
|
||||
{"default:fern", "default:fern", "default:fern"},
|
||||
},
|
||||
})
|
||||
|
||||
--
|
||||
-- Tool repair
|
||||
--
|
||||
@ -607,6 +617,13 @@ minetest.register_craft(
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
type = "fuel",
|
||||
recipe = "default:fern",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
type = "fuel",
|
||||
@ -656,6 +673,13 @@ minetest.register_craft(
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
type = "fuel",
|
||||
recipe = "default:fertilizer",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
type = "fuel",
|
||||
|
@ -90,45 +90,6 @@ minetest.register_craftitem(
|
||||
inventory_image = "default_flint.png",
|
||||
})
|
||||
|
||||
minetest.register_tool(
|
||||
"default:flint_and_steel",
|
||||
{
|
||||
description = "Flint and Steel",
|
||||
inventory_image = "default_flint_and_steel.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing == nil then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local nodename = node.name
|
||||
|
||||
if nodename == "default:torch_weak" then
|
||||
minetest.set_node(pos, {name = "default:torch", param = node.param, param2 = node.param2})
|
||||
itemstack:add_wear(800)
|
||||
elseif nodename == "default:torch_dead" then
|
||||
minetest.set_node(pos, {name = "default:torch_weak", param = node.param, param2 = node.param2})
|
||||
itemstack:add_wear(800)
|
||||
elseif nodename == "tnt:tnt" then
|
||||
local y = minetest.registered_nodes["tnt:tnt"]
|
||||
if y ~= nil then
|
||||
y.on_punch(pos, node, user)
|
||||
|
||||
itemstack:add_wear(800)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool(
|
||||
"default:shears",
|
||||
{
|
||||
description = "Steel Shears (Right-click to shear)",
|
||||
inventory_image = "default_shears.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_water",
|
||||
{
|
||||
@ -290,4 +251,32 @@ minetest.register_craftitem(
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:fertilizer",
|
||||
{
|
||||
description = "Fertilizer",
|
||||
inventory_image = "default_fertilizer_inventory.png",
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
|
||||
local underdef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if underdef.groups then
|
||||
if underdef.groups.plantable_soil then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pointed_thing.under, {name = "default:fertilized_dirt"})
|
||||
elseif underdef.groups.plantable_sandy then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pointed_thing.under, {name = "default:fertilized_sand"})
|
||||
end
|
||||
end
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
default.log("craftitems", "loaded")
|
@ -125,7 +125,7 @@ minetest.register_biome(
|
||||
node_top = "default:dirt_with_grass",
|
||||
node_filler = "default:dirt",
|
||||
|
||||
depth_filler = 4,
|
||||
depth_filler = 6,
|
||||
depth_top = 1,
|
||||
|
||||
y_min = 3,
|
||||
@ -142,7 +142,7 @@ minetest.register_biome(
|
||||
node_top = "default:dirt_with_grass",
|
||||
node_filler = "default:dirt",
|
||||
|
||||
depth_filler = 3,
|
||||
depth_filler = 4,
|
||||
depth_top = 1,
|
||||
|
||||
y_min = 3,
|
||||
@ -405,6 +405,20 @@ minetest.register_decoration(
|
||||
y_max = 31000,
|
||||
})
|
||||
|
||||
-- Flowers
|
||||
|
||||
minetest.register_decoration(
|
||||
{
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_grass",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.04,
|
||||
biomes = {"Grassland", "Wilderness"},
|
||||
decoration = {"default:flower"},
|
||||
y_min = -32000,
|
||||
y_max = 32000,
|
||||
})
|
||||
|
||||
-- Grasses
|
||||
|
||||
minetest.register_decoration(
|
||||
|
@ -109,6 +109,24 @@ minetest.register_node(
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"default:fertilized_dirt",
|
||||
{
|
||||
description = "Fertilized Dirt",
|
||||
tiles ={"default_dirt.png^default_fertilizer.png", "default_dirt.png", "default_dirt.png"},
|
||||
groups = {
|
||||
crumbly=3,
|
||||
soil=1,
|
||||
plantable_soil = 1,
|
||||
plantable_fertilizer = 1,
|
||||
fall_damage_add_percent=-5,
|
||||
not_in_craftingguide = 1,
|
||||
},
|
||||
drop = "default:dirt",
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"default:dirt_with_dry_grass",
|
||||
{
|
||||
@ -252,6 +270,25 @@ minetest.register_node(
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"default:fertilized_sand",
|
||||
{
|
||||
description = "Fertilized Sand",
|
||||
tiles = {"default_sand.png^default_fertilizer.png", "default_sand.png", "default_sand.png"},
|
||||
groups = {
|
||||
crumbly = 3,
|
||||
falling_node = 1,
|
||||
sand = 1,
|
||||
plantable_sandy = 1,
|
||||
plantable_fertilizer = 1,
|
||||
fall_damage_add_percent = -10,
|
||||
not_in_craftingguide = 1,
|
||||
},
|
||||
drop = "default:sand",
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"default:sandstone",
|
||||
{
|
||||
@ -1198,6 +1235,26 @@ minetest.register_node(
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"default:flower",
|
||||
{
|
||||
description = "Flower",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5 + (1 / 16), 0.5}
|
||||
},
|
||||
tiles = {"default_flowers.png"},
|
||||
inventory_image = "default_flowers_inventory.png",
|
||||
wield_image = "default_flowers_inventory.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
groups = {snappy = 2, dig_immediate = 3, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"default:swamp_grass",
|
||||
{
|
||||
|
BIN
mods/default/textures/default_fertilizer.png
Normal file
BIN
mods/default/textures/default_fertilizer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 673 B |
BIN
mods/default/textures/default_fertilizer.xcf
Normal file
BIN
mods/default/textures/default_fertilizer.xcf
Normal file
Binary file not shown.
BIN
mods/default/textures/default_fertilizer_inventory.png
Normal file
BIN
mods/default/textures/default_fertilizer_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 596 B |
BIN
mods/default/textures/default_fertilizer_inventory.xcf
Normal file
BIN
mods/default/textures/default_fertilizer_inventory.xcf
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 537 B |
Binary file not shown.
BIN
mods/default/textures/default_flowers_inventory.png
Normal file
BIN
mods/default/textures/default_flowers_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 619 B |
BIN
mods/default/textures/default_flowers_inventory.xcf
Normal file
BIN
mods/default/textures/default_flowers_inventory.xcf
Normal file
Binary file not shown.
@ -333,4 +333,44 @@ minetest.register_tool(
|
||||
}
|
||||
})
|
||||
|
||||
-- Other
|
||||
minetest.register_tool(
|
||||
"default:shears",
|
||||
{
|
||||
description = "Steel Shears (Right-click to shear animals)",
|
||||
inventory_image = "default_shears.png",
|
||||
})
|
||||
|
||||
minetest.register_tool(
|
||||
"default:flint_and_steel",
|
||||
{
|
||||
description = "Flint and Steel",
|
||||
inventory_image = "default_flint_and_steel.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing == nil then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local nodename = node.name
|
||||
|
||||
if nodename == "default:torch_weak" then
|
||||
minetest.set_node(pos, {name = "default:torch", param = node.param, param2 = node.param2})
|
||||
itemstack:add_wear(800)
|
||||
elseif nodename == "default:torch_dead" then
|
||||
minetest.set_node(pos, {name = "default:torch_weak", param = node.param, param2 = node.param2})
|
||||
itemstack:add_wear(800)
|
||||
elseif nodename == "tnt:tnt" then
|
||||
local y = minetest.registered_nodes["tnt:tnt"]
|
||||
if y ~= nil then
|
||||
y.on_punch(pos, node, user)
|
||||
|
||||
itemstack:add_wear(800)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
default.log("tools", "loaded")
|
@ -3,23 +3,23 @@
|
||||
-- By Kaadmy, for Pixture
|
||||
--
|
||||
|
||||
farming={}
|
||||
farming = {}
|
||||
|
||||
grow_plant=function(pos, name, plant)
|
||||
function farming.grow_plant(pos, name, plant)
|
||||
local my_node = minetest.get_node(pos)
|
||||
|
||||
if minetest.find_node_near(pos, plant.growing_distance, plant.grows_near) == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local light=minetest.get_node_light(pos)
|
||||
if minetest.find_node_near(pos, plant.growing_distance, plant.grows_near) == nil then return end
|
||||
|
||||
local light = minetest.get_node_light(pos)
|
||||
if light ~= nil and (light < plant.light_min or light > plant.light_max) then return end
|
||||
|
||||
local on_node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
for _,can_grow_on in ipairs(plant.grows_on) do
|
||||
if on_node.name == can_grow_on then
|
||||
local on_node = minetest.get_node({x = pos.x, y = pos.y-1, z = pos.z})
|
||||
local on_nodedef = minetest.registered_nodes[on_node.name]
|
||||
|
||||
for _, can_grow_on in ipairs(plant.grows_on) do
|
||||
local group = string.match(can_grow_on, "group:(.*)")
|
||||
|
||||
if (group ~= nil and on_nodedef.groups[group]) or (on_node.name == can_grow_on) then
|
||||
if my_node.name == "farming:"..name.."_1" then
|
||||
minetest.set_node(pos, {name = "farming:"..name.."_2"})
|
||||
elseif my_node.name == "farming:"..name.."_2" then
|
||||
@ -33,29 +33,38 @@ grow_plant=function(pos, name, plant)
|
||||
end
|
||||
end
|
||||
|
||||
farming.register_plant=function(name, plant)
|
||||
-- note: you'll have to register 4
|
||||
-- plant growing nodes before calling this!
|
||||
--
|
||||
-- format: "farming:[plant name]_[stage from 1-4]"
|
||||
minetest.register_abm(
|
||||
{
|
||||
nodenames = {
|
||||
"farming:"..name.."_1",
|
||||
"farming:"..name.."_2",
|
||||
"farming:"..name.."_3",
|
||||
},
|
||||
neighbors = plant.grows_on,
|
||||
interval = 1,
|
||||
chance = plant.grow_time/4,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
grow_plant(pos, name, plant)
|
||||
if weather.weather == "storm" then
|
||||
grow_plant(pos, name, plant)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
function farming.register_plant(name, plant)
|
||||
-- note: you'll have to register 4
|
||||
-- plant growing nodes before calling this!
|
||||
--
|
||||
-- format: "farming:[plant name]_[stage from 1-4]"
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
nodenames = {
|
||||
"farming:"..name.."_1",
|
||||
"farming:"..name.."_2",
|
||||
"farming:"..name.."_3",
|
||||
},
|
||||
neighbors = plant.grows_on, -- checked later anyway, but also check neighbors in C++ code for performance
|
||||
interval = 1,
|
||||
chance = plant.grow_time / 4,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
farming.grow_plant(pos, name, plant)
|
||||
|
||||
local underdef = minetest.registered_nodes[minetest.get_node({x = pos.x, y = pos.y-1, z = pos.z}).name]
|
||||
|
||||
if under.groups and under.groups.plantable_fertilizer then
|
||||
print("Fertilizer!")
|
||||
farming.grow_plant(pos, name, plant)
|
||||
end
|
||||
|
||||
if weather.weather == "storm" then
|
||||
farming.grow_plant(pos, name, plant)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("farming").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("farming").."/plants.lua")
|
||||
|
@ -15,7 +15,7 @@ farming.register_plant(
|
||||
grow_time = 1440,
|
||||
grows_near = {"group:water"},
|
||||
growing_distance = 4,
|
||||
grows_on = {"group:plantable_soil"},
|
||||
grows_on = {"group:plantable_sandy", "group:plantable_soil"},
|
||||
light_min = 12,
|
||||
light_max = 15,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user