mirror of
https://github.com/minetest-mods/carpets.git
synced 2024-07-07 08:15:14 +02:00
bugfix: do not change the template node group!
the groups copy "by reference" and change them did affects the template node groups (leafdecay, falling_node) Now the groups table is copied by value so the template node definition is not touched anymore
This commit is contained in:
parent
b7e08f3a2e
commit
245331c039
21
api.lua
21
api.lua
@ -34,16 +34,27 @@ function carpets.register(recipe, def)
|
|||||||
local recipe_def = minetest.registered_nodes[recipe]
|
local recipe_def = minetest.registered_nodes[recipe]
|
||||||
|
|
||||||
node.description = node.description or recipe_def.description .. " Carpet"
|
node.description = node.description or recipe_def.description .. " Carpet"
|
||||||
node.tiles = node.tiles or recipe_def.tiles
|
node.tiles = node.tiles or recipe_def.tiles
|
||||||
|
|
||||||
if node.tiles[6] then -- prefer "front" site for carpet
|
if node.tiles[6] then
|
||||||
|
-- prefer "front" site for carpet
|
||||||
node.tiles = {node.tiles[6]}
|
node.tiles = {node.tiles[6]}
|
||||||
end
|
end
|
||||||
|
|
||||||
node.sounds = node.sounds or recipe_def.sounds
|
if not node.sounds then
|
||||||
node.groups = node.groups or recipe_def.groups or {}
|
--copy by reference because no change expected
|
||||||
|
node.sounds = recipe_def.sounds
|
||||||
|
end
|
||||||
|
|
||||||
node.groups.leafdecay = nil
|
if not node.groups then
|
||||||
|
node.groups = {}
|
||||||
|
-- copy by value because of some changes
|
||||||
|
for k, v in pairs(recipe_def.groups) do
|
||||||
|
node.groups[k] = v
|
||||||
|
end
|
||||||
|
|
||||||
|
node.groups.leafdecay = nil
|
||||||
|
end
|
||||||
|
|
||||||
if config:get_bool("FallingCarpet") and node.groups.falling_node == nil then
|
if config:get_bool("FallingCarpet") and node.groups.falling_node == nil then
|
||||||
node.groups.falling_node = 1
|
node.groups.falling_node = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user