1
0
Fork 0

Simplify leafdecay stuff, add leafdecay factoid

This commit is contained in:
Wuzzy 2017-08-31 02:06:35 +02:00
parent 65ec2c9b54
commit 4f20ab1950
2 changed files with 18 additions and 11 deletions

View File

@ -46,6 +46,18 @@ doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
return datastring
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
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
local datastring = ""

View File

@ -930,8 +930,6 @@ end
-- 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.
--
-- 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_enable_cache = true
@ -997,8 +995,6 @@ minetest.register_abm({
-- Drop stuff other than the node itself
local itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in ipairs(itemstacks) do
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
itemname ~= n0.name then
local p_drop = {
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
@ -1006,7 +1002,6 @@ minetest.register_abm({
}
minetest.add_item(p_drop, itemname)
end
end
-- Remove node
minetest.remove_node(p0)
core.check_for_falling(p0)