mirror of
https://codeberg.org/tenplus1/bonemeal.git
synced 2025-07-20 00:50:25 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
57a018cbe4 | |||
edeee0ffbd | |||
53aefab9a2 | |||
a5421172d7 | |||
31cf1abfcd | |||
0a9668fff1 | |||
d357709339 | |||
131024ee97 | |||
52a3856f26 | |||
52ada84c58 | |||
a920032dd5 | |||
d534523a1d | |||
acea1713b7 | |||
1a9c67b1e3 | |||
fdc62f06b0 | |||
2658577776 | |||
7c106254d2 | |||
b50f533579 | |||
2c90275687 | |||
93a46c05a6 | |||
afc6d7ef12 | |||
b604ca39da | |||
97f4b11110 | |||
7053e44ea4 | |||
43fd151357 |
228
init.lua
228
init.lua
@ -1,45 +1,50 @@
|
|||||||
|
|
||||||
-- MineClonia / VoxeLibre check
|
|
||||||
|
|
||||||
local mcl = core.get_modpath("mcl_core")
|
|
||||||
|
|
||||||
-- global
|
|
||||||
|
|
||||||
bonemeal = {
|
bonemeal = {
|
||||||
item_list = {
|
item_list = {
|
||||||
bucket_water = mcl and "mcl_buckets:bucket_water" or "bucket:bucket_water",
|
bucket_water = "bucket:bucket_water",
|
||||||
bucket_empty = mcl and "mcl_buckets:bucker_empty" or "bucket:bucket_empty",
|
bucket_empty = "bucket:bucket_empty",
|
||||||
dirt = mcl and "mcl_core:dirt" or "default:dirt",
|
dirt = "default:dirt",
|
||||||
torch = mcl and "mcl_torches:torch" or "default:torch",
|
torch = "default:torch",
|
||||||
coral = mcl and "mcl_ocean:dead_horn_coral_block" or "default:coral_skeleton"
|
coral = "default:coral_skeleton"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- translation support and vars
|
|
||||||
|
|
||||||
local S = core.get_translator("bonemeal")
|
|
||||||
local a = bonemeal.item_list
|
local a = bonemeal.item_list
|
||||||
local path = core.get_modpath("bonemeal")
|
|
||||||
local min, max, random = math.min, math.max, math.random
|
|
||||||
|
|
||||||
-- creative check helper
|
if minetest.get_modpath("mcl_core") then
|
||||||
|
|
||||||
local creative_mode_cache = core.settings:get_bool("creative_mode")
|
a.bucket_water = "mcl_buckets:bucket_water"
|
||||||
function bonemeal.is_creative(name)
|
a.bucket_empty = "mcl_buckets:bucker_empty"
|
||||||
return creative_mode_cache or core.check_player_privs(name, {creative = true})
|
a.dirt = "mcl_core:dirt"
|
||||||
|
a.torch = "mcl_torches:torch"
|
||||||
|
a.coral = "mcl_ocean:dead_horn_coral_block"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- API tables
|
|
||||||
|
local path = minetest.get_modpath("bonemeal")
|
||||||
|
local min, max, random = math.min, math.max, math.random
|
||||||
|
|
||||||
|
-- translation support
|
||||||
|
local S = minetest.get_translator("bonemeal")
|
||||||
|
|
||||||
|
-- creative check
|
||||||
|
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||||
|
function bonemeal.is_creative(name)
|
||||||
|
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
|
||||||
|
end
|
||||||
|
|
||||||
local crops = {}
|
local crops = {}
|
||||||
local saplings = {}
|
local saplings = {}
|
||||||
local deco = {}
|
local deco = {}
|
||||||
|
|
||||||
-- particle effect
|
--
|
||||||
|
-- local functions
|
||||||
|
--
|
||||||
|
|
||||||
|
-- particles
|
||||||
local function particle_effect(pos)
|
local function particle_effect(pos)
|
||||||
|
|
||||||
core.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 4,
|
amount = 4,
|
||||||
time = 0.15,
|
time = 0.15,
|
||||||
minpos = pos,
|
minpos = pos,
|
||||||
@ -57,31 +62,38 @@ local function particle_effect(pos)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- tree type check
|
|
||||||
|
|
||||||
|
-- tree type check
|
||||||
local function grow_tree(pos, object)
|
local function grow_tree(pos, object)
|
||||||
|
|
||||||
if type(object) == "table" and object.axiom then
|
if type(object) == "table" and object.axiom then
|
||||||
|
|
||||||
core.remove_node(pos)
|
-- grow L-system tree
|
||||||
core.spawn_tree(pos, object) -- grow L-system tree
|
minetest.remove_node(pos)
|
||||||
|
minetest.spawn_tree(pos, object)
|
||||||
|
|
||||||
elseif type(object) == "string" and core.registered_nodes[object] then
|
elseif type(object) == "string" and minetest.registered_nodes[object] then
|
||||||
|
|
||||||
core.set_node(pos, {name = object}) -- place node
|
-- place node
|
||||||
|
minetest.set_node(pos, {name = object})
|
||||||
|
|
||||||
elseif type(object) == "function" then
|
elseif type(object) == "function" then
|
||||||
|
|
||||||
object(pos) -- execute function
|
-- function
|
||||||
|
object(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- sapling check
|
-- sapling check
|
||||||
|
|
||||||
local function check_sapling(pos, sapling_node, strength, light_ok)
|
local function check_sapling(pos, sapling_node, strength, light_ok)
|
||||||
|
|
||||||
-- what is sapling placed on?
|
-- what is sapling placed on?
|
||||||
local under = core.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
local under = minetest.get_node({
|
||||||
|
x = pos.x,
|
||||||
|
y = pos.y - 1,
|
||||||
|
z = pos.z
|
||||||
|
})
|
||||||
|
|
||||||
local can_grow, grow_on
|
local can_grow, grow_on
|
||||||
|
|
||||||
@ -102,7 +114,7 @@ local function check_sapling(pos, sapling_node, strength, light_ok)
|
|||||||
|
|
||||||
local group = grow_on:split(":")[2]
|
local group = grow_on:split(":")[2]
|
||||||
|
|
||||||
if core.get_item_group(under.name, group) > 0 then
|
if minetest.get_item_group(under.name, group) > 0 then
|
||||||
can_grow = true
|
can_grow = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -126,8 +138,8 @@ local function check_sapling(pos, sapling_node, strength, light_ok)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- crops check
|
|
||||||
|
|
||||||
|
-- crops check
|
||||||
local function check_crops(pos, nodename, strength, light_ok)
|
local function check_crops(pos, nodename, strength, light_ok)
|
||||||
|
|
||||||
local mod, crop, stage, nod, def
|
local mod, crop, stage, nod, def
|
||||||
@ -157,7 +169,7 @@ local function check_crops(pos, nodename, strength, light_ok)
|
|||||||
|
|
||||||
-- check for place_param setting
|
-- check for place_param setting
|
||||||
nod = crops[n][1] .. stage
|
nod = crops[n][1] .. stage
|
||||||
def = core.registered_nodes[nod]
|
def = minetest.registered_nodes[nod]
|
||||||
|
|
||||||
-- make sure crop exists or isn't fully grown already
|
-- make sure crop exists or isn't fully grown already
|
||||||
if not def or nod == nodename then
|
if not def or nod == nodename then
|
||||||
@ -166,19 +178,19 @@ local function check_crops(pos, nodename, strength, light_ok)
|
|||||||
|
|
||||||
def = def and def.place_param2 or 0
|
def = def and def.place_param2 or 0
|
||||||
|
|
||||||
core.set_node(pos, {name = nod, param2 = def})
|
minetest.set_node(pos, {name = nod, param2 = def})
|
||||||
|
|
||||||
particle_effect(pos)
|
particle_effect(pos)
|
||||||
|
|
||||||
core.get_node_timer(pos):start(10) -- restart any timers
|
minetest.get_node_timer(pos):start(10) -- restart any timers
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check soil for specific decoration placement
|
|
||||||
|
|
||||||
|
-- check soil for specific decoration placement
|
||||||
local function check_soil(pos, nodename, strength)
|
local function check_soil(pos, nodename, strength)
|
||||||
|
|
||||||
-- set radius according to strength
|
-- set radius according to strength
|
||||||
@ -186,7 +198,7 @@ local function check_soil(pos, nodename, strength)
|
|||||||
local tall = max(strength - 2, 0)
|
local tall = max(strength - 2, 0)
|
||||||
|
|
||||||
-- get area of land with free space above
|
-- get area of land with free space above
|
||||||
local dirt = core.find_nodes_in_area_under_air(
|
local dirt = minetest.find_nodes_in_area_under_air(
|
||||||
{x = pos.x - side, y = pos.y - tall, z = pos.z - side},
|
{x = pos.x - side, y = pos.y - tall, z = pos.z - side},
|
||||||
{x = pos.x + side, y = pos.y + tall, z = pos.z + side}, {nodename})
|
{x = pos.x + side, y = pos.y + tall, z = pos.z + side}, {nodename})
|
||||||
|
|
||||||
@ -235,39 +247,43 @@ local function check_soil(pos, nodename, strength)
|
|||||||
if nod and nod ~= "" then
|
if nod and nod ~= "" then
|
||||||
|
|
||||||
-- get crop param2 value
|
-- get crop param2 value
|
||||||
def = core.registered_nodes[nod]
|
def = minetest.registered_nodes[nod]
|
||||||
def = def and def.place_param2
|
def = def and def.place_param2
|
||||||
|
|
||||||
-- if param2 not preset then get from existing node
|
-- if param2 not preset then get from existing node
|
||||||
if not def then
|
if not def then
|
||||||
|
|
||||||
local node = core.get_node_or_nil(pos2)
|
local node = minetest.get_node_or_nil(pos2)
|
||||||
|
|
||||||
def = node and node.param2 or 0
|
def = node and node.param2 or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
core.set_node(pos2, {name = nod, param2 = def})
|
minetest.set_node(pos2, {name = nod, param2 = def})
|
||||||
end
|
end
|
||||||
|
|
||||||
particle_effect(pos2)
|
particle_effect(pos2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- helper function
|
|
||||||
|
|
||||||
|
-- helper function
|
||||||
local function use_checks(user, pointed_thing)
|
local function use_checks(user, pointed_thing)
|
||||||
|
|
||||||
-- make sure we use on node
|
-- make sure we use on node
|
||||||
if pointed_thing.type ~= "node" then return false end
|
if pointed_thing.type ~= "node" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- get position and node info
|
-- get position and node info
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
local node = core.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local def = core.registered_items[node.name]
|
local def = minetest.registered_items[node.name]
|
||||||
local dirt = def and def.groups
|
local dirt = def and def.groups
|
||||||
|
|
||||||
-- does node have groups set
|
-- does node have groups set
|
||||||
if not dirt then return false end
|
if not dirt then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- if we're using on ground, move position up
|
-- if we're using on ground, move position up
|
||||||
if dirt.soil or dirt.sand or dirt.can_bonemeal then
|
if dirt.soil or dirt.sand or dirt.can_bonemeal then
|
||||||
@ -275,14 +291,16 @@ local function use_checks(user, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- check if protected
|
-- check if protected
|
||||||
if core.is_protected(pos, user:get_player_name()) then
|
if minetest.is_protected(pos, user:get_player_name()) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return node
|
return node
|
||||||
end
|
end
|
||||||
|
|
||||||
--= Global functions
|
|
||||||
|
-- global functions
|
||||||
|
|
||||||
|
|
||||||
-- add to sapling list
|
-- add to sapling list
|
||||||
-- {sapling node, schematic or function name, "soil"|"sand"|specific_node|"group:"}
|
-- {sapling node, schematic or function name, "soil"|"sand"|specific_node|"group:"}
|
||||||
@ -295,10 +313,10 @@ function bonemeal:add_sapling(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- add to crop list to force grow
|
-- add to crop list to force grow
|
||||||
-- {crop name start_, growth steps, seed node (if required)}
|
-- {crop name start_, growth steps, seed node (if required)}
|
||||||
-- e.g. {"farming:wheat_", 8, "farming:seed_wheat"}
|
-- e.g. {"farming:wheat_", 8, "farming:seed_wheat"}
|
||||||
|
|
||||||
function bonemeal:add_crop(list)
|
function bonemeal:add_crop(list)
|
||||||
|
|
||||||
for n = 1, #list do
|
for n = 1, #list do
|
||||||
@ -306,12 +324,12 @@ function bonemeal:add_crop(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- add grass and flower/plant decoration for specific dirt types
|
-- add grass and flower/plant decoration for specific dirt types
|
||||||
-- {dirt_node, {grass_nodes}, {flower_nodes}
|
-- {dirt_node, {grass_nodes}, {flower_nodes}
|
||||||
-- e.g. {"default:dirt_with_dry_grass", dry_grass, flowers}
|
-- e.g. {"default:dirt_with_dry_grass", dry_grass, flowers}
|
||||||
-- if an entry already exists for a given dirt type, it will add new entries and all empty
|
-- if an entry already exists for a given dirt type, it will add new entries and all empty
|
||||||
-- entries, allowing to both add decorations and decrease their frequency.
|
-- entries, allowing to both add decorations and decrease their frequency.
|
||||||
|
|
||||||
function bonemeal:add_deco(list)
|
function bonemeal:add_deco(list)
|
||||||
|
|
||||||
for l = 1, #list do
|
for l = 1, #list do
|
||||||
@ -329,7 +347,8 @@ function bonemeal:add_deco(list)
|
|||||||
for _, entry in pairs(deco[n][2]) do
|
for _, entry in pairs(deco[n][2]) do
|
||||||
|
|
||||||
if extra == entry then
|
if extra == entry then
|
||||||
extra = false ; break
|
extra = false
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -347,7 +366,8 @@ function bonemeal:add_deco(list)
|
|||||||
for __, entry in pairs(deco[n][3]) do
|
for __, entry in pairs(deco[n][3]) do
|
||||||
|
|
||||||
if extra == entry then
|
if extra == entry then
|
||||||
extra = false ; break
|
extra = false
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -357,7 +377,8 @@ function bonemeal:add_deco(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
list[l] = false ; break
|
list[l] = false
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -367,9 +388,9 @@ function bonemeal:add_deco(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- definitively set a decration scheme
|
-- definitively set a decration scheme
|
||||||
-- this function will either add a new entry as is, or replace the existing one
|
-- this function will either add a new entry as is, or replace the existing one
|
||||||
|
|
||||||
function bonemeal:set_deco(list)
|
function bonemeal:set_deco(list)
|
||||||
|
|
||||||
for l = 1, #list do
|
for l = 1, #list do
|
||||||
@ -394,15 +415,17 @@ function bonemeal:set_deco(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- global on_use function for bonemeal
|
|
||||||
|
|
||||||
|
-- global on_use function for bonemeal
|
||||||
function bonemeal:on_use(pos, strength, node)
|
function bonemeal:on_use(pos, strength, node)
|
||||||
|
|
||||||
-- get node pointed at
|
-- get node pointed at
|
||||||
local node = node or core.get_node(pos)
|
local node = node or minetest.get_node(pos)
|
||||||
|
|
||||||
-- return if nothing there
|
-- return if nothing there
|
||||||
if node.name == "ignore" then return end
|
if node.name == "ignore" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- make sure strength is between 1 and 4
|
-- make sure strength is between 1 and 4
|
||||||
strength = strength or 1
|
strength = strength or 1
|
||||||
@ -414,25 +437,31 @@ function bonemeal:on_use(pos, strength, node)
|
|||||||
|
|
||||||
default.grow_papyrus(pos, node)
|
default.grow_papyrus(pos, node)
|
||||||
|
|
||||||
particle_effect(pos) ; return true
|
particle_effect(pos)
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
elseif node.name == "default:cactus" then
|
elseif node.name == "default:cactus" then
|
||||||
|
|
||||||
default.grow_cactus(pos, node)
|
default.grow_cactus(pos, node)
|
||||||
|
|
||||||
particle_effect(pos) ; return true
|
particle_effect(pos)
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
elseif node.name == "default:dry_dirt" and strength == 1 then
|
elseif node.name == "default:dry_dirt" and strength == 1 then
|
||||||
|
|
||||||
core.set_node(pos, {name = "default:dry_dirt_with_dry_grass"})
|
minetest.set_node(pos, {name = "default:dry_dirt_with_dry_grass"})
|
||||||
|
|
||||||
particle_effect(pos) ; return true
|
particle_effect(pos)
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- grow grass and flowers
|
-- grow grass and flowers
|
||||||
if core.get_item_group(node.name, "soil") > 0
|
if minetest.get_item_group(node.name, "soil") > 0
|
||||||
or core.get_item_group(node.name, "sand") > 0
|
or minetest.get_item_group(node.name, "sand") > 0
|
||||||
or core.get_item_group(node.name, "can_bonemeal") > 0 then
|
or minetest.get_item_group(node.name, "can_bonemeal") > 0 then
|
||||||
|
|
||||||
check_soil(pos, node.name, strength)
|
check_soil(pos, node.name, strength)
|
||||||
|
|
||||||
@ -442,7 +471,7 @@ function bonemeal:on_use(pos, strength, node)
|
|||||||
-- light check depending on strength (strength of 4 = no light needed)
|
-- light check depending on strength (strength of 4 = no light needed)
|
||||||
local light_ok = true
|
local light_ok = true
|
||||||
|
|
||||||
if (core.get_node_light(pos) or 0) < (12 - (strength * 3)) then
|
if (minetest.get_node_light(pos) or 0) < (12 - (strength * 3)) then
|
||||||
light_ok = nil
|
light_ok = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -457,11 +486,14 @@ function bonemeal:on_use(pos, strength, node)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--= Items
|
|
||||||
|
--
|
||||||
|
-- items
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
-- mulch (strength 1)
|
-- mulch (strength 1)
|
||||||
|
minetest.register_craftitem("bonemeal:mulch", {
|
||||||
core.register_craftitem("bonemeal:mulch", {
|
|
||||||
description = S("Mulch"),
|
description = S("Mulch"),
|
||||||
inventory_image = "bonemeal_mulch.png",
|
inventory_image = "bonemeal_mulch.png",
|
||||||
|
|
||||||
@ -485,9 +517,9 @@ core.register_craftitem("bonemeal:mulch", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- bonemeal (strength 2)
|
|
||||||
|
|
||||||
core.register_craftitem("bonemeal:bonemeal", {
|
-- bonemeal (strength 2)
|
||||||
|
minetest.register_craftitem("bonemeal:bonemeal", {
|
||||||
description = S("Bone Meal"),
|
description = S("Bone Meal"),
|
||||||
inventory_image = "bonemeal_item.png",
|
inventory_image = "bonemeal_item.png",
|
||||||
|
|
||||||
@ -511,9 +543,9 @@ core.register_craftitem("bonemeal:bonemeal", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- fertiliser (strength 3)
|
|
||||||
|
|
||||||
core.register_craftitem("bonemeal:fertiliser", {
|
-- fertiliser (strength 3)
|
||||||
|
minetest.register_craftitem("bonemeal:fertiliser", {
|
||||||
description = S("Fertiliser"),
|
description = S("Fertiliser"),
|
||||||
inventory_image = "bonemeal_fertiliser.png",
|
inventory_image = "bonemeal_fertiliser.png",
|
||||||
|
|
||||||
@ -537,27 +569,28 @@ core.register_craftitem("bonemeal:fertiliser", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- bone
|
|
||||||
|
|
||||||
core.register_craftitem("bonemeal:bone", {
|
-- bone
|
||||||
|
minetest.register_craftitem("bonemeal:bone", {
|
||||||
description = S("Bone"),
|
description = S("Bone"),
|
||||||
inventory_image = "bonemeal_bone.png",
|
inventory_image = "bonemeal_bone.png",
|
||||||
groups = {bone = 1}
|
groups = {bone = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- gelatin powder
|
-- gelatin powder
|
||||||
|
minetest.register_craftitem("bonemeal:gelatin_powder", {
|
||||||
core.register_craftitem("bonemeal:gelatin_powder", {
|
|
||||||
description = S("Gelatin Powder"),
|
description = S("Gelatin Powder"),
|
||||||
inventory_image = "bonemeal_gelatin_powder.png",
|
inventory_image = "bonemeal_gelatin_powder.png",
|
||||||
groups = {food_gelatin = 1, flammable = 2}
|
groups = {food_gelatin = 1, flammable = 2}
|
||||||
})
|
})
|
||||||
|
|
||||||
--= Recipes
|
|
||||||
|
--
|
||||||
|
-- crafting recipes
|
||||||
|
--
|
||||||
|
|
||||||
-- gelatin powder
|
-- gelatin powder
|
||||||
|
minetest.register_craft({
|
||||||
core.register_craft({
|
|
||||||
output = "bonemeal:gelatin_powder 4",
|
output = "bonemeal:gelatin_powder 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:bone", "group:bone", "group:bone"},
|
{"group:bone", "group:bone", "group:bone"},
|
||||||
@ -570,8 +603,7 @@ core.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- bonemeal (from bone)
|
-- bonemeal (from bone)
|
||||||
|
minetest.register_craft({
|
||||||
core.register_craft({
|
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "bonemeal:bonemeal 2",
|
output = "bonemeal:bonemeal 2",
|
||||||
recipe = "group:bone",
|
recipe = "group:bone",
|
||||||
@ -579,25 +611,22 @@ core.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- bonemeal (from player bones)
|
-- bonemeal (from player bones)
|
||||||
|
if minetest.settings:get_bool("bonemeal.disable_deathbones_recipe") ~= true then
|
||||||
|
|
||||||
if core.settings:get_bool("bonemeal.disable_deathbones_recipe") ~= true then
|
minetest.register_craft({
|
||||||
|
|
||||||
core.register_craft({
|
|
||||||
output = "bonemeal:bone 2",
|
output = "bonemeal:bone 2",
|
||||||
recipe = {{"bones:bones"}}
|
recipe = {{"bones:bones"}}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- bonemeal (from coral skeleton)
|
-- bonemeal (from coral skeleton)
|
||||||
|
minetest.register_craft({
|
||||||
core.register_craft({
|
|
||||||
output = "bonemeal:bonemeal 2",
|
output = "bonemeal:bonemeal 2",
|
||||||
recipe = {{a.coral}}
|
recipe = {{a.coral}}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- mulch
|
-- mulch
|
||||||
|
minetest.register_craft({
|
||||||
core.register_craft({
|
|
||||||
output = "bonemeal:mulch 4",
|
output = "bonemeal:mulch 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:tree", "group:leaves", "group:leaves"},
|
{"group:tree", "group:leaves", "group:leaves"},
|
||||||
@ -606,7 +635,7 @@ core.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
core.register_craft({
|
minetest.register_craft({
|
||||||
output = "bonemeal:mulch",
|
output = "bonemeal:mulch",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:seed", "group:seed", "group:seed"},
|
{"group:seed", "group:seed", "group:seed"},
|
||||||
@ -616,17 +645,17 @@ core.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- fertiliser
|
-- fertiliser
|
||||||
|
minetest.register_craft({
|
||||||
core.register_craft({
|
|
||||||
output = "bonemeal:fertiliser 2",
|
output = "bonemeal:fertiliser 2",
|
||||||
recipe = {{"bonemeal:bonemeal", "bonemeal:mulch"}}
|
recipe = {{"bonemeal:bonemeal", "bonemeal:mulch"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- add bones to dirt
|
-- NALC: add bones to dirt but without overriding a previous drop definition
|
||||||
|
-- from other mods.
|
||||||
if core.registered_items[a.dirt] then
|
local drop = minetest.registered_items["default:dirt"].drop
|
||||||
|
if drop then
|
||||||
core.override_item(a.dirt, {
|
table.insert(drop.items, 1, {items = {"bonemeal:bone"}, rarity = 30})
|
||||||
|
else
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 1,
|
max_items = 1,
|
||||||
items = {
|
items = {
|
||||||
@ -635,20 +664,17 @@ if core.registered_items[a.dirt] then
|
|||||||
rarity = 40
|
rarity = 40
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
items = {a.dirt}
|
items = {"default:dirt"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add support for mods
|
-- add support for mods
|
||||||
|
|
||||||
dofile(path .. "/mods.lua")
|
dofile(path .. "/mods.lua")
|
||||||
|
|
||||||
-- lucky block support
|
-- lucky block support
|
||||||
|
if minetest.get_modpath("lucky_block") then
|
||||||
if core.get_modpath("lucky_block") then
|
|
||||||
dofile(path .. "/lucky_block.lua")
|
dofile(path .. "/lucky_block.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
|
|
||||||
-- helper function
|
-- add lucky blocks
|
||||||
|
|
||||||
local function growy(pos, player)
|
local function growy(pos, player)
|
||||||
|
|
||||||
local dpos = core.find_node_near(pos, 1, "group:soil")
|
local dpos = minetest.find_node_near(pos, 1, "group:soil")
|
||||||
|
|
||||||
if dpos then
|
if dpos then
|
||||||
bonemeal:on_use(dpos, 5)
|
bonemeal:on_use(dpos, 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add lucky blocks
|
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"lig"},
|
{"lig"},
|
||||||
|
112
mods.lua
112
mods.lua
@ -1,23 +1,21 @@
|
|||||||
|
|
||||||
-- craft bones from animalmaterials into bonemeal
|
-- craft bones from animalmaterials into bonemeal
|
||||||
|
if minetest.get_modpath("animalmaterials") then
|
||||||
|
|
||||||
if core.get_modpath("animalmaterials") then
|
minetest.register_craft({
|
||||||
|
|
||||||
core.register_craft({
|
|
||||||
output = "bonemeal:bonemeal 2",
|
output = "bonemeal:bonemeal 2",
|
||||||
recipe = {{"animalmaterials:bone"}}
|
recipe = {{"animalmaterials:bone"}}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- default additions
|
|
||||||
|
|
||||||
if core.get_modpath("default") then
|
if minetest.get_modpath("default") then
|
||||||
|
|
||||||
-- saplings
|
-- saplings
|
||||||
|
|
||||||
local function pine_grow(pos)
|
local function pine_grow(pos)
|
||||||
|
|
||||||
if core.find_node_near(pos, 1,
|
if minetest.find_node_near(pos, 1,
|
||||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||||
|
|
||||||
default.grow_new_snowy_pine_tree(pos)
|
default.grow_new_snowy_pine_tree(pos)
|
||||||
@ -27,11 +25,11 @@ if core.get_modpath("default") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function cactus_grow(pos)
|
local function cactus_grow(pos)
|
||||||
default.grow_cactus(pos, core.get_node(pos))
|
default.grow_cactus(pos, minetest.get_node(pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function papyrus_grow(pos)
|
local function papyrus_grow(pos)
|
||||||
default.grow_papyrus(pos, core.get_node(pos))
|
default.grow_papyrus(pos, minetest.get_node(pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
@ -64,10 +62,9 @@ if core.get_modpath("default") then
|
|||||||
|
|
||||||
local flowers = {}
|
local flowers = {}
|
||||||
|
|
||||||
-- add flowers from other mods
|
minetest.after(0.1, function()
|
||||||
core.after(0.1, function()
|
|
||||||
|
|
||||||
for node, def in pairs(core.registered_nodes) do
|
for node, def in pairs(minetest.registered_nodes) do
|
||||||
|
|
||||||
if def.groups
|
if def.groups
|
||||||
and def.groups.flower
|
and def.groups.flower
|
||||||
@ -95,7 +92,6 @@ if core.get_modpath("default") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- default farming crops
|
|
||||||
|
|
||||||
if farming then
|
if farming then
|
||||||
|
|
||||||
@ -105,7 +101,6 @@ if farming then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- farming redo crops
|
|
||||||
|
|
||||||
if farming and farming.mod and farming.mod == "redo" then
|
if farming and farming.mod and farming.mod == "redo" then
|
||||||
|
|
||||||
@ -153,9 +148,8 @@ if farming and farming.mod and farming.mod == "redo" then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ethereal crops, saplings and grass
|
|
||||||
|
|
||||||
if core.get_modpath("ethereal") then
|
if minetest.get_modpath("ethereal") then
|
||||||
|
|
||||||
bonemeal:add_crop({
|
bonemeal:add_crop({
|
||||||
{"ethereal:strawberry_", 8},
|
{"ethereal:strawberry_", 8},
|
||||||
@ -180,8 +174,7 @@ if core.get_modpath("ethereal") then
|
|||||||
{"ethereal:sakura_sapling", ethereal.grow_sakura_tree, "soil"},
|
{"ethereal:sakura_sapling", ethereal.grow_sakura_tree, "soil"},
|
||||||
{"ethereal:lemon_tree_sapling", ethereal.grow_lemon_tree, "soil"},
|
{"ethereal:lemon_tree_sapling", ethereal.grow_lemon_tree, "soil"},
|
||||||
{"ethereal:olive_tree_sapling", ethereal.grow_olive_tree, "soil"},
|
{"ethereal:olive_tree_sapling", ethereal.grow_olive_tree, "soil"},
|
||||||
{"ethereal:basandra_bush_sapling", ethereal.grow_basandra_bush, "soil"},
|
{"ethereal:basandra_bush_sapling", ethereal.grow_basandra_bush, "soil"}
|
||||||
{"ethereal:mangrove_sapling", ethereal.grow_mangrove_tree, "soil"}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local grass = {"default:grass_3", "default:grass_4", "default:grass_5", ""}
|
local grass = {"default:grass_3", "default:grass_4", "default:grass_5", ""}
|
||||||
@ -198,20 +191,17 @@ if core.get_modpath("ethereal") then
|
|||||||
"ethereal:spore_grass", "ethereal:spore_grass", "", "", ""}},
|
"ethereal:spore_grass", "ethereal:spore_grass", "", "", ""}},
|
||||||
{"ethereal:jungle_dirt", grass, {"default:junglegrass", "", "", ""}},
|
{"ethereal:jungle_dirt", grass, {"default:junglegrass", "", "", ""}},
|
||||||
{"ethereal:grove_dirt", grass, {"ethereal:fern", "", "", ""}},
|
{"ethereal:grove_dirt", grass, {"ethereal:fern", "", "", ""}},
|
||||||
{"ethereal:bamboo_dirt", grass, {}},
|
{"ethereal:bamboo_dirt", grass, {}}
|
||||||
{"ethereal:mud", {"default:fern_1", "default:fern_2", "default:fern_3", "", "",
|
|
||||||
"default:grass_5", "default:junglegrass"}, {"ethereal:bamboo"}}
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- moretrees saplings
|
|
||||||
|
|
||||||
if core.get_modpath("moretrees") then
|
if minetest.get_modpath("moretrees") then
|
||||||
|
|
||||||
-- special fir check for snow
|
-- special fir check for snow
|
||||||
local function fir_grow(pos)
|
local function fir_grow(pos)
|
||||||
|
|
||||||
if core.find_node_near(pos, 1,
|
if minetest.find_node_near(pos, 1,
|
||||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||||
|
|
||||||
moretrees.grow_fir_snow(pos)
|
moretrees.grow_fir_snow(pos)
|
||||||
@ -238,27 +228,23 @@ if core.get_modpath("moretrees") then
|
|||||||
{"moretrees:rubber_tree_sapling", moretrees.spawn_rubber_tree_object, "soil"},
|
{"moretrees:rubber_tree_sapling", moretrees.spawn_rubber_tree_object, "soil"},
|
||||||
{"moretrees:fir_sapling", fir_grow, "soil"}
|
{"moretrees:fir_sapling", fir_grow, "soil"}
|
||||||
})
|
})
|
||||||
end
|
|
||||||
|
|
||||||
-- technic rubber tree
|
elseif minetest.get_modpath("technic_worldgen") then
|
||||||
|
|
||||||
if core.get_modpath("technic_worldgen") then
|
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
{"moretrees:rubber_tree_sapling", technic.rubber_tree_model, "soil"}
|
{"moretrees:rubber_tree_sapling", technic.rubber_tree_model, "soil"}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- caverealms mushroom
|
|
||||||
|
|
||||||
if core.get_modpath("caverealms") then
|
if minetest.get_modpath("caverealms") then
|
||||||
|
|
||||||
local fil = core.get_modpath("caverealms") .. "/schematics/shroom.mts"
|
local fil = minetest.get_modpath("caverealms") .. "/schematics/shroom.mts"
|
||||||
local add_shroom = function(pos)
|
local add_shroom = function(pos)
|
||||||
|
|
||||||
core.swap_node(pos, {name = "air"})
|
minetest.swap_node(pos, {name = "air"})
|
||||||
|
|
||||||
core.place_schematic(
|
minetest.place_schematic(
|
||||||
{x = pos.x - 5, y = pos.y, z = pos.z - 5}, fil, 0, nil, false)
|
{x = pos.x - 5, y = pos.y, z = pos.z - 5}, fil, 0, nil, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -267,7 +253,6 @@ if core.get_modpath("caverealms") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- helper
|
|
||||||
|
|
||||||
local function y_func(grow_func)
|
local function y_func(grow_func)
|
||||||
return function(pos)
|
return function(pos)
|
||||||
@ -275,38 +260,30 @@ local function y_func(grow_func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ferns
|
if minetest.get_modpath("ferns") then
|
||||||
|
|
||||||
if core.get_modpath("ferns") then
|
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
{"ferns:sapling_giant_tree_fern",
|
{"ferns:sapling_giant_tree_fern", y_func(abstract_ferns.grow_giant_tree_fern), "soil"},
|
||||||
y_func(abstract_ferns.grow_giant_tree_fern), "soil"},
|
{"ferns:sapling_giant_tree_fern", y_func(abstract_ferns.grow_giant_tree_fern), "sand"},
|
||||||
{"ferns:sapling_giant_tree_fern",
|
{"ferns:sapling_tree_fern", y_func(abstract_ferns.grow_tree_fern), "soil"}
|
||||||
y_func(abstract_ferns.grow_giant_tree_fern), "sand"},
|
|
||||||
{"ferns:sapling_tree_fern",
|
|
||||||
y_func(abstract_ferns.grow_tree_fern), "soil"}
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- dryplants sapling
|
if minetest.get_modpath("dryplants") then
|
||||||
|
|
||||||
if core.get_modpath("dryplants") then
|
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
{"dryplants:reedmace_sapling", y_func(abstract_dryplants.grow_reedmace), "soil"}
|
{"dryplants:reedmace_sapling", y_func(abstract_dryplants.grow_reedmace), "soil"}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add bonemeal dyes
|
|
||||||
|
|
||||||
if core.get_modpath("dye") then
|
if minetest.get_modpath("dye") then
|
||||||
|
|
||||||
local bonemeal_dyes = {bonemeal = "white", fertiliser = "green", mulch = "brown"}
|
local bonemeal_dyes = {bonemeal = "white", fertiliser = "green", mulch = "brown"}
|
||||||
|
|
||||||
for mat, dye in pairs(bonemeal_dyes) do
|
for mat, dye in pairs(bonemeal_dyes) do
|
||||||
|
|
||||||
core.register_craft({
|
minetest.register_craft({
|
||||||
output = "dye:" .. dye .. " 4",
|
output = "dye:" .. dye .. " 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"bonemeal:" .. mat}
|
{"bonemeal:" .. mat}
|
||||||
@ -315,36 +292,35 @@ if core.get_modpath("dye") then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- df_trees saplings
|
|
||||||
|
|
||||||
if core.get_modpath("df_trees") then
|
if minetest.get_modpath("df_trees") then
|
||||||
|
|
||||||
local function spore_tree_fix(pos)
|
local function spore_tree_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_spore_tree(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_spore_tree(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fungiwood_fix(pos)
|
local function fungiwood_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_fungiwood(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_fungiwood(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tunnel_fix(pos)
|
local function tunnel_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_tunnel_tube(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_tunnel_tube(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function black_cap_fix(pos)
|
local function black_cap_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_black_cap(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_black_cap(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function goblin_cap_fix(pos)
|
local function goblin_cap_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_goblin_cap(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_goblin_cap(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tower_cap_fix(pos)
|
local function tower_cap_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_tower_cap(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_tower_cap(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function nether_cap_fix(pos)
|
local function nether_cap_fix(pos)
|
||||||
core.remove_node(pos) ; df_trees.spawn_nether_cap(pos)
|
minetest.remove_node(pos) ; df_trees.spawn_nether_cap(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
@ -359,9 +335,8 @@ if core.get_modpath("df_trees") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- df_farming crops
|
|
||||||
|
|
||||||
if core.get_modpath("df_farming") then
|
if minetest.get_modpath("df_farming") then
|
||||||
|
|
||||||
bonemeal:add_crop({
|
bonemeal:add_crop({
|
||||||
{"df_farming:cave_wheat_", 8, "df_farming:cave_wheat_seed", true},
|
{"df_farming:cave_wheat_", 8, "df_farming:cave_wheat_seed", true},
|
||||||
@ -373,25 +348,24 @@ if core.get_modpath("df_farming") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- df_primordial saplings and plants
|
|
||||||
|
|
||||||
if core.get_modpath("df_primordial_items") then
|
if minetest.get_modpath("df_primordial_items") then
|
||||||
|
|
||||||
local function mush_fix(pos)
|
local function mush_fix(pos)
|
||||||
core.set_node(pos, {name = "air"})
|
minetest.set_node(pos, {name = "air"})
|
||||||
mapgen_helper.place_schematic(pos,
|
mapgen_helper.place_schematic(pos,
|
||||||
df_primordial_items.get_primordial_mushroom(), (math.random(4) - 1) * 90)
|
df_primordial_items.get_primordial_mushroom(), (math.random(4) - 1) * 90)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fern_fix(pos)
|
local function fern_fix(pos)
|
||||||
core.set_node(pos, {name = "air"})
|
minetest.set_node(pos, {name = "air"})
|
||||||
local rotations = {0, 90, 180, 270}
|
local rotations = {0, 90, 180, 270}
|
||||||
mapgen_helper.place_schematic(pos,
|
mapgen_helper.place_schematic(pos,
|
||||||
df_primordial_items.get_fern_schematic(), rotations[math.random(#rotations)])
|
df_primordial_items.get_fern_schematic(), rotations[math.random(#rotations)])
|
||||||
end
|
end
|
||||||
|
|
||||||
local function blood_fix(pos)
|
local function blood_fix(pos)
|
||||||
df_trees.grow_blood_thorn(pos, core.get_node(pos))
|
df_trees.grow_blood_thorn(pos, minetest.get_node(pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
@ -443,9 +417,8 @@ if core.get_modpath("df_primordial_items") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- everness saplings
|
|
||||||
|
|
||||||
if core.get_modpath("everness") then
|
if minetest.get_modpath("everness") then
|
||||||
|
|
||||||
bonemeal:add_sapling({
|
bonemeal:add_sapling({
|
||||||
{"everness:baobab_sapling", Everness.grow_baobab_tree, "soil"},
|
{"everness:baobab_sapling", Everness.grow_baobab_tree, "soil"},
|
||||||
@ -463,18 +436,17 @@ if core.get_modpath("everness") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- bush classic fruit
|
|
||||||
|
|
||||||
if core.get_modpath("bushes_classic") then
|
if minetest.get_modpath("bushes_classic") then
|
||||||
|
|
||||||
local function grow_bush(pos)
|
local function grow_bush(pos)
|
||||||
|
|
||||||
local meta = core.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local bush_name = meta:get_string("bush_type")
|
local bush_name = meta:get_string("bush_type")
|
||||||
|
|
||||||
-- only change if meta found
|
-- only change if meta found
|
||||||
if meta and bush_name then
|
if meta and bush_name then
|
||||||
core.swap_node(pos, {name = "bushes:" .. bush_name .. "_bush"})
|
minetest.swap_node(pos, {name = "bushes:" .. bush_name .. "_bush"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user