Don't touch description if tt snippets did nothing (#4264)

This should prevent problems like the ones described in https://git.minetest.land/MineClone2/MineClone2/pulls/4196#issuecomment-77558 or https://git.minetest.land/MineClone2/MineClone2/pulls/4130#issuecomment-77571

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4264
Co-authored-by: the-real-herowl <wiktor_t-i@proton.me>
Co-committed-by: the-real-herowl <wiktor_t-i@proton.me>
This commit is contained in:
the-real-herowl 2024-04-28 15:04:39 +00:00 committed by the-real-herowl
parent 4e12c6747c
commit 5f70189e08
1 changed files with 1 additions and 0 deletions

View File

@ -76,6 +76,7 @@ function tt.reload_itemstack_description(itemstack)
orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name"))
end
local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack)
if desc == def.description and meta:get_string("description") == "" then return end
meta:set_string("description", desc)
end
end