mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Simplify leafdecay stuff, add leafdecay factoid
This commit is contained in:
parent
65ec2c9b54
commit
4f20ab1950
2 changed files with 18 additions and 11 deletions
|
@ -46,6 +46,18 @@ doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||||
return datastring
|
return datastring
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||||
|
local formstring = ""
|
||||||
|
if def.groups.leafdecay ~= nil then
|
||||||
|
if def.drop ~= "" and def.drop ~= nil and def.drop ~= itemstring then
|
||||||
|
formstring = string.format("This block quickly decays when there is no wood block of any species within a distance of %d. When decaying, it disappears and may drop one of its regular drops. The block does not decay when the block has been placed by a player.", def.groups.leafdecay)
|
||||||
|
else
|
||||||
|
formstring = string.format("This block quickly decays and disappears when there is no wood block of any species within a distance of %d. The block does not decay when the block has been placed by a player.", def.groups.leafdecay)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return formstring
|
||||||
|
end)
|
||||||
|
|
||||||
-- nodes which have flower placement rules
|
-- nodes which have flower placement rules
|
||||||
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||||
local datastring = ""
|
local datastring = ""
|
||||||
|
|
|
@ -930,8 +930,6 @@ end
|
||||||
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
|
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
|
||||||
-- the player places a node of that kind, you will want to set param2=1 or so.
|
-- the player places a node of that kind, you will want to set param2=1 or so.
|
||||||
--
|
--
|
||||||
-- If the node is in the leafdecay_drop group then the it will always be dropped
|
|
||||||
-- as an item
|
|
||||||
|
|
||||||
mcl_core.leafdecay_trunk_cache = {}
|
mcl_core.leafdecay_trunk_cache = {}
|
||||||
mcl_core.leafdecay_enable_cache = true
|
mcl_core.leafdecay_enable_cache = true
|
||||||
|
@ -997,15 +995,12 @@ minetest.register_abm({
|
||||||
-- Drop stuff other than the node itself
|
-- Drop stuff other than the node itself
|
||||||
local itemstacks = minetest.get_node_drops(n0.name)
|
local itemstacks = minetest.get_node_drops(n0.name)
|
||||||
for _, itemname in ipairs(itemstacks) do
|
for _, itemname in ipairs(itemstacks) do
|
||||||
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
|
local p_drop = {
|
||||||
itemname ~= n0.name then
|
x = p0.x - 0.5 + math.random(),
|
||||||
local p_drop = {
|
y = p0.y - 0.5 + math.random(),
|
||||||
x = p0.x - 0.5 + math.random(),
|
z = p0.z - 0.5 + math.random(),
|
||||||
y = p0.y - 0.5 + math.random(),
|
}
|
||||||
z = p0.z - 0.5 + math.random(),
|
minetest.add_item(p_drop, itemname)
|
||||||
}
|
|
||||||
minetest.add_item(p_drop, itemname)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- Remove node
|
-- Remove node
|
||||||
minetest.remove_node(p0)
|
minetest.remove_node(p0)
|
||||||
|
|
Loading…
Reference in a new issue