forked from VoxeLibre/VoxeLibre
Add mcl_bone_meal.
* New mod mcl_bone_meal, replacing bone meal functionality previously held in mcl_dye. * Improve bonemealing API using callbacks in the nodes that support bonemealing. * Rename bone meal item to `"mcl_bone_meal:bone_meal"` and updated its crafting recipe. * Implement legacy compatibility for older bone meal API. * Remove all non dye-related bone meal code, texture and translations from mcl_dye. * Add legacy compatibility shims to mcl_dye that refer to mcl_bone_meal. * Add an alias for "mcl_dye:white" to keep mcl_dye and its API working uniterrupted. * Update mod depends in mcl_dye mod.conf.
This commit is contained in:
parent
c5dd0b7016
commit
c9afccd0c3
|
@ -0,0 +1,54 @@
|
|||
|
||||
# Bone meal API
|
||||
Bonemealing callbacks and particle functions.
|
||||
|
||||
|
||||
## _mcl_on_bonemealing(pointed_thing, placer)
|
||||
The bone meal API provides a callback definition that nodes can use to
|
||||
register a handler that is executed when a bone meal item is used on it.
|
||||
|
||||
Nodes that wish to use the bone meal API should in their node registration
|
||||
define a callback handler named `_mcl_on_bonemealing`. This handler is a
|
||||
|
||||
`function(pointed_thing, placer)`
|
||||
|
||||
Its arguments are:
|
||||
* `pointed_thing`: exact pointing location (see Minetest API), where the
|
||||
bone meal is applied
|
||||
* `placer`: ObjectRef of the player who aplied the bone meal, can be nil!
|
||||
|
||||
The function should return `true` if the bonemealing was succesful.
|
||||
|
||||
It is for all intents and purposes up to the callback defined in the node to
|
||||
decide how to handle the effect that bone meal has on that particular node.
|
||||
|
||||
The `on_place` code in the bone meal item will spawn bone meal particles and
|
||||
decrease the bone meal itemstack if the handler returned `true` and the
|
||||
`placer` is not in creative mode.
|
||||
|
||||
|
||||
## mcl_bone_meal.add_bone_meal_particle(pos, def)
|
||||
Spawns standard or custom bone meal particles.
|
||||
* `pos`: position, is ignored if you define def.minpos and def.maxpos
|
||||
* `def`: (optional) particle definition; see minetest.add_particlespawner()
|
||||
for more details.
|
||||
|
||||
|
||||
# Legacy API
|
||||
The bone meal API also provides a legacy compatibility function. This
|
||||
function is not meant to be continued and callers should migrate to the
|
||||
newer bonemealing API.
|
||||
|
||||
## mcl_bone_meal.register_on_bone_meal_apply(function(pointed_thing, placer))
|
||||
Called when the bone meal is applied anywhere.
|
||||
* `pointed_thing`: exact pointing location (see Minetest API), where the
|
||||
bone meal is applied
|
||||
* `placer`: ObjectRef of the player who aplied the bone meal, can be nil!
|
||||
This function is deprecated and will be removed at some time in the future.
|
||||
|
||||
## mcl_dye.add_bone_meal_particle(pos, def)
|
||||
## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user))
|
||||
These shims in mcl_dye that point to corresponding legacy compatibility
|
||||
functions in mcl_bone_meal remain for legacy callers that have not yet been
|
||||
updated to the new API. These shims will be removed at some time in the
|
||||
future.
|
|
@ -0,0 +1,133 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local longdesc = S(
|
||||
"Bone meal is a white dye and also useful as a fertilizer to " ..
|
||||
"speed up the growth of many plants."
|
||||
)
|
||||
local usagehelp = S(
|
||||
"Rightclick a sheep to turn its wool white. Rightclick a plant " ..
|
||||
"to speed up its growth. Note that not all plants can be " ..
|
||||
"fertilized like this. When you rightclick a grass block, tall " ..
|
||||
"grass and flowers will grow all over the place."
|
||||
)
|
||||
|
||||
mcl_bone_meal = {}
|
||||
|
||||
-- Bone meal particle api:
|
||||
|
||||
--- Spawns bone meal particles.
|
||||
-- pos: where the particles spawn
|
||||
-- def: particle spawner parameters, see minetest.add_particlespawner() for
|
||||
-- details on these parameters.
|
||||
--
|
||||
function mcl_bone_meal.add_bone_meal_particle(pos, def)
|
||||
if not def then
|
||||
def = {}
|
||||
end
|
||||
minetest.add_particlespawner({
|
||||
amount = def.amount or 10,
|
||||
time = def.time or 0.1,
|
||||
minpos = def.minpos or vector.subtract(pos, 0.5),
|
||||
maxpos = def.maxpos or vector.add(pos, 0.5),
|
||||
minvel = def.minvel or vector.new(-0.01, 0.01, -0.01),
|
||||
maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01),
|
||||
minacc = def.minacc or vector.new(0, 0, 0),
|
||||
maxacc = def.maxacc or vector.new(0, 0, 0),
|
||||
minexptime = def.minexptime or 1,
|
||||
maxexptime = def.maxexptime or 4,
|
||||
minsize = def.minsize or 0.7,
|
||||
maxsize = def.maxsize or 2.4,
|
||||
texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color
|
||||
glow = def.glow or 1,
|
||||
})
|
||||
end
|
||||
|
||||
-- Begin legacy bone meal API.
|
||||
--
|
||||
-- Compatibility code for legacy users of the old bone meal API.
|
||||
-- This code will be removed at some time in the future.
|
||||
--
|
||||
mcl_bone_meal.bone_meal_callbacks = {}
|
||||
|
||||
-- Shims for the old API are still available in mcl_dye and refer to
|
||||
-- the real functions in mcl_bone_meal.
|
||||
--
|
||||
function mcl_bone_meal.register_on_bone_meal_apply(func)
|
||||
minetest.log("warning", "register_on_bone_meal_apply(func) is deprecated. Read mcl_bone_meal/API.md!")
|
||||
table.insert(mcl_bone_meal.bone_meal_callbacks, func)
|
||||
end
|
||||
|
||||
-- Legacy registered users of the old API are handled through this function.
|
||||
--
|
||||
local function apply_bone_meal(pointed_thing, placer)
|
||||
for _, func in pairs(mcl_bone_meal.bone_meal_callbacks) do
|
||||
if func(pointed_thing, placer) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
-- End legacy bone meal API
|
||||
|
||||
minetest.register_craftitem("mcl_bone_meal:bone_meal", {
|
||||
inventory_image = "mcl_bone_meal.png",
|
||||
description = S("Bone Meal"),
|
||||
_tt_help = S("Speeds up plant growth"),
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_usagehelp = usagehelp,
|
||||
stack_max = 64,
|
||||
groups = {craftitem=1, dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
-- Use pointed node's on_rightclick function first, if present.
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if ndef and ndef.on_rightclick then
|
||||
return ndef.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack
|
||||
end
|
||||
end
|
||||
-- If the pointed node can be bonemealed, let it handle the processing.
|
||||
if ndef and ndef._mcl_on_bonemealing then
|
||||
if ndef._mcl_on_bonemealing(pointed_thing, placer) then
|
||||
mcl_bone_meal.add_bone_meal_particle(pos)
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
-- Otherwise try the legacy API.
|
||||
elseif apply_bone_meal(pointed_thing, placer) and
|
||||
not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
_on_dispense = function(itemstack, pos, droppos, dropnode, dropdir)
|
||||
local pointed_thing
|
||||
if dropnode.name == "air" then
|
||||
pointed_thing = {above = droppos, under = vector.offset(droppos, 0, -1 ,0)}
|
||||
else
|
||||
pointed_thing = {above = pos, under = droppos}
|
||||
end
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
-- If the pointed node can be bonemealed, let it handle the processing.
|
||||
if ndef and ndef._mcl_on_bonemealing then
|
||||
if ndef._mcl_on_bonemealing(pointed_thing, nil) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
else
|
||||
-- Otherwise try the legacy API.
|
||||
if apply_bone_meal(pointed_thing, nil) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
_dispense_into_walkable = true
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_bone_meal:bone_meal 3",
|
||||
recipe = {{"mcl_mobitems:bone"}},
|
||||
})
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=Knochenmehl
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen.
|
||||
Speeds up plant growth=Beschleunigt Pflanzenwachstum
|
|
@ -0,0 +1,4 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=Harina de hueso
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar.
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=Farine d'Os
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout.
|
||||
Speeds up plant growth=Accélère la croissance des plantes
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=Mączka kostna
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół.
|
||||
Speeds up plant growth=Przyspiesza wzrost roślin
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=Костная мука
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Костная мука является белым красителем. Она также полезна в качестве удобрения, чтобы увеличить скорость роста многих растений.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы.
|
||||
Speeds up plant growth=Ускоряет рост растений
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=骨粉
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。
|
||||
Speeds up plant growth=加速植物生長
|
|
@ -0,0 +1,6 @@
|
|||
# textdomain: mcl_bone_meal
|
||||
Bone Meal=
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=
|
||||
Speeds up plant growth=
|
|
@ -0,0 +1,3 @@
|
|||
name = mcl_bone_meal
|
||||
description = Bone meal can be used as a fertilizer and as a dye.
|
||||
author = kabou
|
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
|
@ -15,7 +15,6 @@ mcl_dye = {}
|
|||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local math = math
|
||||
local string = string
|
||||
|
||||
-- Other mods can use these for looping through available colors
|
||||
|
@ -85,8 +84,6 @@ dyelocal.dyes = {
|
|||
{"pink", "dye_pink", S("Pink Dye"), {dye=1, craftitem=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}},
|
||||
}
|
||||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
dyelocal.unicolor_to_dye_id = {}
|
||||
for d=1, #dyelocal.dyes do
|
||||
for k, _ in pairs(dyelocal.dyes[d][4]) do
|
||||
|
@ -109,7 +106,7 @@ end
|
|||
-- Define items
|
||||
for _, row in ipairs(dyelocal.dyes) do
|
||||
local name = row[1]
|
||||
-- White and brown dyes are defined explicitly below
|
||||
-- White dye is an alias and brown dye is defined explicitly below
|
||||
if name ~= "white" and name ~= "brown" then
|
||||
local img = row[2]
|
||||
local description = row[3]
|
||||
|
@ -127,290 +124,21 @@ for _, row in ipairs(dyelocal.dyes) do
|
|||
end
|
||||
end
|
||||
|
||||
-- Bone Meal
|
||||
-- Legacy support for things now in mcl_bone_meal.
|
||||
-- These shims will at some time in the future be removed.
|
||||
--
|
||||
function mcl_dye.add_bone_meal_particle(pos, def)
|
||||
if not def then
|
||||
def = {}
|
||||
end
|
||||
minetest.add_particlespawner({
|
||||
amount = def.amount or 10,
|
||||
time = def.time or 0.1,
|
||||
minpos = def.minpos or vector.subtract(pos, 0.5),
|
||||
maxpos = def.maxpos or vector.add(pos, 0.5),
|
||||
minvel = def.minvel or vector.new(-0.01, 0.01, -0.01),
|
||||
maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01),
|
||||
minacc = def.minacc or vector.new(0, 0, 0),
|
||||
maxacc = def.maxacc or vector.new(0, 0, 0),
|
||||
minexptime = def.minexptime or 1,
|
||||
maxexptime = def.maxexptime or 4,
|
||||
minsize = def.minsize or 0.7,
|
||||
maxsize = def.maxsize or 2.4,
|
||||
texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color
|
||||
glow = def.glow or 1,
|
||||
})
|
||||
minetest.log("warning", "mcl_dye.add_bone_meal_particles() is deprecated. Read mcl_bone_meal/API.md!")
|
||||
mcl_bone_meal.add_bone_meal_particle(pos, def)
|
||||
end
|
||||
|
||||
mcl_dye.bone_meal_callbacks = {}
|
||||
|
||||
function mcl_dye.register_on_bone_meal_apply(func)
|
||||
table.insert(mcl_dye.bone_meal_callbacks, func)
|
||||
minetest.log("warning", "mcl_dye.register_on_bone_meal_apply() is deprecated. Read mcl_bone_meal/API.md!")
|
||||
mcl_bone_meal.register_on_bone_meal_apply(func)
|
||||
end
|
||||
|
||||
local function apply_bone_meal(pointed_thing)
|
||||
-- Bone meal currently spawns all flowers found in the plains.
|
||||
local flowers_table_plains = {
|
||||
"mcl_flowers:dandelion",
|
||||
"mcl_flowers:dandelion",
|
||||
"mcl_flowers:poppy",
|
||||
|
||||
"mcl_flowers:oxeye_daisy",
|
||||
"mcl_flowers:tulip_orange",
|
||||
"mcl_flowers:tulip_red",
|
||||
"mcl_flowers:tulip_white",
|
||||
"mcl_flowers:tulip_pink",
|
||||
"mcl_flowers:azure_bluet",
|
||||
}
|
||||
local flowers_table_simple = {
|
||||
"mcl_flowers:dandelion",
|
||||
"mcl_flowers:poppy",
|
||||
}
|
||||
local flowers_table_swampland = {
|
||||
"mcl_flowers:blue_orchid",
|
||||
}
|
||||
local flowers_table_flower_forest = {
|
||||
"mcl_flowers:dandelion",
|
||||
"mcl_flowers:poppy",
|
||||
"mcl_flowers:oxeye_daisy",
|
||||
"mcl_flowers:tulip_orange",
|
||||
"mcl_flowers:tulip_red",
|
||||
"mcl_flowers:tulip_white",
|
||||
"mcl_flowers:tulip_pink",
|
||||
"mcl_flowers:azure_bluet",
|
||||
"mcl_flowers:allium",
|
||||
}
|
||||
|
||||
local pos = pointed_thing.under
|
||||
local n = minetest.get_node(pos)
|
||||
if n.name == "" then return false end
|
||||
|
||||
for _, func in pairs(mcl_dye.bone_meal_callbacks) do
|
||||
if func(pointed_thing, user) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.get_item_group(n.name, "sapling") >= 1 then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
-- Saplings: 45% chance to advance growth stage
|
||||
if math.random(1,100) <= 45 then
|
||||
return mcl_core.grow_sapling(pos, n)
|
||||
end
|
||||
elseif minetest.get_item_group(n.name, "mushroom") == 1 then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
-- Try to grow huge mushroom
|
||||
|
||||
-- Must be on a dirt-type block
|
||||
local below = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
if below.name ~= "mcl_core:mycelium" and below.name ~= "mcl_core:dirt" and minetest.get_item_group(below.name, "grass_block") ~= 1 and below.name ~= "mcl_core:coarse_dirt" and below.name ~= "mcl_core:podzol" then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Select schematic
|
||||
local schematic, offset, height
|
||||
if n.name == "mcl_mushrooms:mushroom_brown" then
|
||||
schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_brown.mts"
|
||||
offset = { x = -3, y = -1, z = -3 }
|
||||
height = 8
|
||||
elseif n.name == "mcl_mushrooms:mushroom_red" then
|
||||
schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_red.mts"
|
||||
offset = { x = -2, y = -1, z = -2 }
|
||||
height = 8
|
||||
else
|
||||
return false
|
||||
end
|
||||
-- 40% chance
|
||||
if math.random(1, 100) <= 40 then
|
||||
-- Check space requirements
|
||||
for i=1,3 do
|
||||
local cpos = vector.add(pos, {x=0, y=i, z=0})
|
||||
if minetest.get_node(cpos).name ~= "air" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
local yoff = 3
|
||||
local minp, maxp = {x=pos.x-3, y=pos.y+yoff, z=pos.z-3}, {x=pos.x+3, y=pos.y+yoff+(height-3), z=pos.z+3}
|
||||
local diff = vector.subtract(maxp, minp)
|
||||
diff = vector.add(diff, {x=1,y=1,z=1})
|
||||
local totalnodes = diff.x * diff.y * diff.z
|
||||
local goodnodes = minetest.find_nodes_in_area(minp, maxp, {"air", "group:leaves"})
|
||||
if #goodnodes < totalnodes then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Place the huge mushroom
|
||||
minetest.remove_node(pos)
|
||||
local place_pos = vector.add(pos, offset)
|
||||
local ok = minetest.place_schematic(place_pos, schematic, 0, nil, false)
|
||||
return ok ~= nil
|
||||
end
|
||||
return false
|
||||
-- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages
|
||||
elseif string.find(n.name, "mcl_farming:wheat_") then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:potato_") then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_potato", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:carrot_") then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:pumpkin_") then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:melontige_") then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:beetroot_") then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
-- Beetroot: 75% chance to advance to next stage
|
||||
if math.random(1, 100) <= 75 then
|
||||
return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true)
|
||||
end
|
||||
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
-- Cocoa: Advance by 1 stage
|
||||
mcl_cocoas.grow(pos)
|
||||
return true
|
||||
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
|
||||
-- Grass Block: Generate tall grass and random flowers all over the place
|
||||
for i = -7, 7 do
|
||||
for j = -7, 7 do
|
||||
for y = -1, 1 do
|
||||
pos = vector.offset(pointed_thing.above, i, y, j)
|
||||
n = minetest.get_node(pos)
|
||||
local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0))
|
||||
|
||||
if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then
|
||||
-- Randomly generate flowers, tall grass or nothing
|
||||
if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then
|
||||
-- 90% tall grass, 10% flower
|
||||
mcl_dye.add_bone_meal_particle(pos, {amount = 4})
|
||||
if math.random(1,100) <= 90 then
|
||||
local col = n2.param2
|
||||
minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col})
|
||||
else
|
||||
local flowers_table
|
||||
if mg_name == "v6" then
|
||||
flowers_table = flowers_table_plains
|
||||
else
|
||||
local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome)
|
||||
if biome == "Swampland" or biome == "Swampland_shore" or biome == "Swampland_ocean" or biome == "Swampland_deep_ocean" or biome == "Swampland_underground" then
|
||||
flowers_table = flowers_table_swampland
|
||||
elseif biome == "FlowerForest" or biome == "FlowerForest_beach" or biome == "FlowerForest_ocean" or biome == "FlowerForest_deep_ocean" or biome == "FlowerForest_underground" then
|
||||
flowers_table = flowers_table_flower_forest
|
||||
elseif biome == "Plains" or biome == "Plains_beach" or biome == "Plains_ocean" or biome == "Plains_deep_ocean" or biome == "Plains_underground" or biome == "SunflowerPlains" or biome == "SunflowerPlains_ocean" or biome == "SunflowerPlains_deep_ocean" or biome == "SunflowerPlains_underground" then
|
||||
flowers_table = flowers_table_plains
|
||||
else
|
||||
flowers_table = flowers_table_simple
|
||||
end
|
||||
end
|
||||
minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
-- Double flowers: Drop corresponding item
|
||||
elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
minetest.add_item(pos, "mcl_flowers:rose_bush")
|
||||
return true
|
||||
elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
minetest.add_item(pos, "mcl_flowers:peony")
|
||||
return true
|
||||
elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
minetest.add_item(pos, "mcl_flowers:lilac")
|
||||
return true
|
||||
elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
minetest.add_item(pos, "mcl_flowers:sunflower")
|
||||
return true
|
||||
|
||||
elseif n.name == "mcl_flowers:tallgrass" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
-- Tall Grass: Grow into double tallgrass
|
||||
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||
local topnode = minetest.get_node(toppos)
|
||||
if minetest.registered_nodes[topnode.name].buildable_to then
|
||||
minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = n.param2 })
|
||||
minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = n.param2 })
|
||||
return true
|
||||
end
|
||||
|
||||
elseif n.name == "mcl_flowers:fern" then
|
||||
mcl_dye.add_bone_meal_particle(pos)
|
||||
-- Fern: Grow into large fern
|
||||
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||
local topnode = minetest.get_node(toppos)
|
||||
if minetest.registered_nodes[topnode.name].buildable_to then
|
||||
minetest.set_node(pos, { name = "mcl_flowers:double_fern", param2 = n.param2 })
|
||||
minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top", param2 = n.param2 })
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_craftitem("mcl_dye:white", {
|
||||
inventory_image = "mcl_dye_white.png",
|
||||
description = S("Bone Meal"),
|
||||
_tt_help = S("Speeds up plant growth"),
|
||||
_doc_items_longdesc = S("Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants."),
|
||||
_doc_items_usagehelp = S("Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place."),
|
||||
stack_max = 64,
|
||||
groups = dyelocal.dyes[1][4],
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if user and not user:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
-- Use the bone meal on the ground
|
||||
if (apply_bone_meal(pointed_thing, user) and (not minetest.is_creative_enabled(user:get_player_name()))) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
||||
-- Apply bone meal, if possible
|
||||
local pointed_thing
|
||||
if dropnode.name == "air" then
|
||||
pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } }
|
||||
else
|
||||
pointed_thing = { above = pos, under = droppos }
|
||||
end
|
||||
local success = apply_bone_meal(pointed_thing, nil)
|
||||
if success then
|
||||
stack:take_item()
|
||||
end
|
||||
return stack
|
||||
end,
|
||||
_dispense_into_walkable = true
|
||||
})
|
||||
minetest.register_alias("mcl_dye:white", "mcl_bone_meal:bone_meal")
|
||||
-- End of legacy support
|
||||
|
||||
minetest.register_craftitem("mcl_dye:brown", {
|
||||
inventory_image = "mcl_dye_brown.png",
|
||||
|
@ -466,19 +194,16 @@ minetest.register_craft({
|
|||
output = "mcl_dye:magenta 2",
|
||||
recipe = {"mcl_dye:violet", "mcl_dye:pink"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_dye:pink 2",
|
||||
recipe = {"mcl_dye:red", "mcl_dye:white"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_dye:cyan 2",
|
||||
recipe = {"mcl_dye:blue", "mcl_dye:dark_green"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_dye:violet 2",
|
||||
|
@ -557,7 +282,3 @@ minetest.register_craft({
|
|||
recipe = "mcl_core:cactus",
|
||||
cooktime = 10,
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_dye:white 3",
|
||||
recipe = {{"mcl_mobitems:bone"}},
|
||||
})
|
||||
|
|
|
@ -17,11 +17,7 @@ Magenta Dye=Magenta Farbstoff
|
|||
Pink Dye=Rosa Farbstoff
|
||||
This item is a dye which is used for dyeing and crafting.=Dieser Gegenstand ist ein Farbstoff, der zum Einfärben und in der Herstellung benutzt werden kann.
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Rechtsklicken Sie auf ein Schaf, um seine Wolle zu färben. Andere Dinge werden mit der Fertigung eingefärbt.
|
||||
Bone Meal=Knochenmehl
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen.
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=Kakaobohnen sind ein brauner Farbstoff und werden benutzt, um Kakao anzupflanzen.
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen.
|
||||
Cocoa Beans=Kakaobohnen
|
||||
Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen
|
||||
Speeds up plant growth=Beschleunigt Pflanzenwachstum
|
||||
|
|
|
@ -17,9 +17,6 @@ Magenta Dye=Tinte magenta
|
|||
Pink Dye=Tinte rosado
|
||||
This item is a dye which is used for dyeing and crafting.=Este artículo es un tinte que se utiliza para teñir y elaborar.
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Haga clic derecho sobre una oveja para teñir su lana. Otras cosas pueden ser teñidas mediante la elaboración.
|
||||
Bone Meal=Harina de hueso
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar.
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=Los granos de cacao son un tinte marrón y se pueden usar para plantar cacao.
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven.
|
||||
Cocoa Beans=Granos de cacao
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# textdomain: mcl_dye
|
||||
Bone Meal=Poudre d'Os
|
||||
Bone Meal=Farine d'Os
|
||||
Light Grey Dye=Teinture Gris Clair
|
||||
Grey Dye=Teinture Gris
|
||||
Ink Sac=Poche d'Encre
|
||||
|
@ -17,11 +17,7 @@ Magenta Dye=Teinture Magenta
|
|||
Pink Dye=Teinture Rose
|
||||
This item is a dye which is used for dyeing and crafting.=Cet objet est un colorant utilisé pour la teinture et l'artisanat.
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Clic droit sur un mouton pour teindre sa laine. D'autres choses sont teintes par l'artisanat.
|
||||
Bone Meal=Farine d'Os
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout.
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=Les fèves de cacao ont une teinture brune et peuvent être utilisées pour planter du cacao.
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao.
|
||||
Cocoa Beans=Fèves de Cacao
|
||||
Grows at the side of jungle trees=Pousse à côté des arbres de la jungle
|
||||
Speeds up plant growth=Accélère la croissance des plantes
|
||||
|
|
|
@ -17,11 +17,7 @@ Magenta Dye=Karmazynowa farba
|
|||
Pink Dye=Różowa farba
|
||||
This item is a dye which is used for dyeing and crafting.=Ten przedmiot to farba wykorzystywana to farbowania i wytwarzania.
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Kliknij prawym na owcę aby zafarbować jej wełnę. Inne rzeczy mogą być zafarbowane przy wytwarzaniu.
|
||||
Bone Meal=Mączka kostna
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół.
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=Ziarna kakaowe mogą być wykorzystane do sadzenia kakao.
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao.
|
||||
Cocoa Beans=Ziarna kakaowe
|
||||
Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew
|
||||
Speeds up plant growth=Przyspiesza wzrost roślin
|
||||
|
|
|
@ -17,11 +17,7 @@ Magenta Dye=Фиолетовый краситель
|
|||
Pink Dye=Розовый краситель
|
||||
This item is a dye which is used for dyeing and crafting.=Это краситель, которые используется, чтобы окрашивать и крафтить.
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Кликните правой по овце, чтобы окрасить её шерсть. Остальные вещи окрашиваются путём крафтинга.
|
||||
Bone Meal=Костная мука
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Костная мука является белым красителем. Она также полезна в качестве удобрения, чтобы увеличить скорость роста многих растений.
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы.
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=Какао-бобы являются коричневым красителем. Их также можно использовать, чтобы посадить какао.
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Кликните правой по овце, чтобы сделать её шерсть коричневой. Кликните правой по боковой части ствола дерева джунглей, чтобы посадить молодое какао.
|
||||
Cocoa Beans=Какао-бобы
|
||||
Grows at the side of jungle trees=Растут на стволах деревьев джунглей
|
||||
Speeds up plant growth=Ускоряет рост растений
|
||||
|
|
|
@ -17,9 +17,6 @@ Magenta Dye=洋紅色染料
|
|||
Pink Dye=粉紅色染料
|
||||
This item is a dye which is used for dyeing and crafting.=這個物品是一種用於染色和合成的染料。
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=右鍵單擊綿羊以染它的毛。其他東西是通過合成染色的。
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=可可豆是一種棕色染料,也可用於種植可可。
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。
|
||||
Grows at the side of jungle trees=在叢林木側生長
|
||||
Speeds up plant growth=加速植物生長
|
||||
|
|
|
@ -17,11 +17,7 @@ Magenta Dye=
|
|||
Pink Dye=
|
||||
This item is a dye which is used for dyeing and crafting.=
|
||||
Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=
|
||||
Bone Meal=
|
||||
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=
|
||||
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=
|
||||
Cocoa beans are a brown dye and can be used to plant cocoas.=
|
||||
Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=
|
||||
Cocoa Beans=
|
||||
Grows at the side of jungle trees=
|
||||
Speeds up plant growth=
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
name = mcl_dye
|
||||
depends = mcl_core, mcl_flowers, mcl_mobitems, mcl_cocoas
|
||||
description = Adds color to your world!
|
||||
depends = mcl_bone_meal, mcl_cocoas
|
||||
|
|
Loading…
Reference in New Issue