forked from VoxeLibre/VoxeLibre
Add code for bonemeal particles
This commit is contained in:
parent
7464b8ff48
commit
92c25ef691
|
@ -128,6 +128,24 @@ for _, row in ipairs(dyelocal.dyes) do
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Bone Meal
|
-- Bone Meal
|
||||||
|
local function bone_meal_particle(pos)
|
||||||
|
minetest.add_particlespawner({
|
||||||
|
amount = 10,
|
||||||
|
time = 0.1,
|
||||||
|
minpos = { x = pos.x - 0.5, y = pos.y - 0.5, z = pos.z - 0.5 },
|
||||||
|
maxpos = { x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5 },
|
||||||
|
minvel = { x = 0, y = 0, z = 0},
|
||||||
|
maxvel = { x = 0, y = 0, z = 0},
|
||||||
|
minacc = { x = 0, y = 0, z = 0},
|
||||||
|
maxacc = { x = 0, y = 0, z = 0},
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 4,
|
||||||
|
minsize = 0.7,
|
||||||
|
maxsize = 2.4,
|
||||||
|
texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color
|
||||||
|
glow = 5,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
function mcl_dye.apply_bone_meal(pointed_thing)
|
function mcl_dye.apply_bone_meal(pointed_thing)
|
||||||
-- Bone meal currently spawns all flowers found in the plains.
|
-- Bone meal currently spawns all flowers found in the plains.
|
||||||
|
@ -166,11 +184,13 @@ function mcl_dye.apply_bone_meal(pointed_thing)
|
||||||
local n = minetest.get_node(pos)
|
local n = minetest.get_node(pos)
|
||||||
if n.name == "" then return false end
|
if n.name == "" then return false end
|
||||||
if minetest.get_item_group(n.name, "sapling") >= 1 then
|
if minetest.get_item_group(n.name, "sapling") >= 1 then
|
||||||
|
bone_meal_particle(pos)
|
||||||
-- Saplings: 45% chance to advance growth stage
|
-- Saplings: 45% chance to advance growth stage
|
||||||
if math.random(1,100) <= 45 then
|
if math.random(1,100) <= 45 then
|
||||||
return mcl_core.grow_sapling(pos, n)
|
return mcl_core.grow_sapling(pos, n)
|
||||||
end
|
end
|
||||||
elseif minetest.get_item_group(n.name, "mushroom") == 1 then
|
elseif minetest.get_item_group(n.name, "mushroom") == 1 then
|
||||||
|
bone_meal_particle(pos)
|
||||||
-- Try to grow huge mushroom
|
-- Try to grow huge mushroom
|
||||||
|
|
||||||
-- Must be on a dirt-type block
|
-- Must be on a dirt-type block
|
||||||
|
@ -220,30 +240,39 @@ function mcl_dye.apply_bone_meal(pointed_thing)
|
||||||
return false
|
return false
|
||||||
-- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages
|
-- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages
|
||||||
elseif string.find(n.name, "mcl_farming:wheat_") then
|
elseif string.find(n.name, "mcl_farming:wheat_") then
|
||||||
|
bone_meal_particle(pos)
|
||||||
local stages = math.random(2, 5)
|
local stages = math.random(2, 5)
|
||||||
return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true)
|
return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true)
|
||||||
elseif string.find(n.name, "mcl_farming:potato_") then
|
elseif string.find(n.name, "mcl_farming:potato_") then
|
||||||
|
bone_meal_particle(pos)
|
||||||
local stages = math.random(2, 5)
|
local stages = math.random(2, 5)
|
||||||
return mcl_farming:grow_plant("plant_potato", pos, n, stages, true)
|
return mcl_farming:grow_plant("plant_potato", pos, n, stages, true)
|
||||||
elseif string.find(n.name, "mcl_farming:carrot_") then
|
elseif string.find(n.name, "mcl_farming:carrot_") then
|
||||||
|
bone_meal_particle(pos)
|
||||||
local stages = math.random(2, 5)
|
local stages = math.random(2, 5)
|
||||||
return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true)
|
return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true)
|
||||||
elseif string.find(n.name, "mcl_farming:pumpkin_") then
|
elseif string.find(n.name, "mcl_farming:pumpkin_") then
|
||||||
|
bone_meal_particle(pos)
|
||||||
local stages = math.random(2, 5)
|
local stages = math.random(2, 5)
|
||||||
return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true)
|
return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true)
|
||||||
elseif string.find(n.name, "mcl_farming:melontige_") then
|
elseif string.find(n.name, "mcl_farming:melontige_") then
|
||||||
|
bone_meal_particle(pos)
|
||||||
local stages = math.random(2, 5)
|
local stages = math.random(2, 5)
|
||||||
return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true)
|
return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true)
|
||||||
elseif string.find(n.name, "mcl_farming:beetroot_") then
|
elseif string.find(n.name, "mcl_farming:beetroot_") then
|
||||||
|
bone_meal_particle(pos)
|
||||||
-- Beetroot: 75% chance to advance to next stage
|
-- Beetroot: 75% chance to advance to next stage
|
||||||
if math.random(1, 100) <= 75 then
|
if math.random(1, 100) <= 75 then
|
||||||
return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true)
|
return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true)
|
||||||
end
|
end
|
||||||
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then
|
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
-- Cocoa: Advance by 1 stage
|
-- Cocoa: Advance by 1 stage
|
||||||
mcl_cocoas.grow(pos)
|
mcl_cocoas.grow(pos)
|
||||||
return true
|
return true
|
||||||
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
|
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
|
||||||
|
local grass_block_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||||
|
bone_meal_particle(grass_block_pos)
|
||||||
-- Grass Block: Generate tall grass and random flowers all over the place
|
-- Grass Block: Generate tall grass and random flowers all over the place
|
||||||
for i = -2, 2 do
|
for i = -2, 2 do
|
||||||
for j = -2, 2 do
|
for j = -2, 2 do
|
||||||
|
@ -285,19 +314,24 @@ function mcl_dye.apply_bone_meal(pointed_thing)
|
||||||
|
|
||||||
-- Double flowers: Drop corresponding item
|
-- Double flowers: Drop corresponding item
|
||||||
elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then
|
elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
minetest.add_item(pos, "mcl_flowers:rose_bush")
|
minetest.add_item(pos, "mcl_flowers:rose_bush")
|
||||||
return true
|
return true
|
||||||
elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then
|
elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
minetest.add_item(pos, "mcl_flowers:peony")
|
minetest.add_item(pos, "mcl_flowers:peony")
|
||||||
return true
|
return true
|
||||||
elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then
|
elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
minetest.add_item(pos, "mcl_flowers:lilac")
|
minetest.add_item(pos, "mcl_flowers:lilac")
|
||||||
return true
|
return true
|
||||||
elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then
|
elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
minetest.add_item(pos, "mcl_flowers:sunflower")
|
minetest.add_item(pos, "mcl_flowers:sunflower")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
elseif n.name == "mcl_flowers:tallgrass" then
|
elseif n.name == "mcl_flowers:tallgrass" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
-- Tall Grass: Grow into double tallgrass
|
-- Tall Grass: Grow into double tallgrass
|
||||||
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
|
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||||
local topnode = minetest.get_node(toppos)
|
local topnode = minetest.get_node(toppos)
|
||||||
|
@ -308,6 +342,7 @@ function mcl_dye.apply_bone_meal(pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif n.name == "mcl_flowers:fern" then
|
elseif n.name == "mcl_flowers:fern" then
|
||||||
|
bone_meal_particle(pos)
|
||||||
-- Fern: Grow into large fern
|
-- Fern: Grow into large fern
|
||||||
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
|
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||||
local topnode = minetest.get_node(toppos)
|
local topnode = minetest.get_node(toppos)
|
||||||
|
|
Loading…
Reference in New Issue