1
0
mirror of git://repo.or.cz/minetest_schemedit.git synced 2024-11-13 19:20:16 +01:00

Prevent adding dupe slice definitions

This commit is contained in:
Wuzzy 2021-04-04 16:44:14 +02:00
parent cd808777c8
commit f0c5c2659f

View File

@ -635,7 +635,18 @@ schemedit.add_form("slice", {
index = self.selected
end
slice_list[index] = {ypos = ypos, prob = prob}
local dupe = false
if fields.done_add then
for k,v in pairs(slice_list) do
if v.ypos == ypos then
v.prob = prob
dupe = true
end
end
end
if not dupe then
slice_list[index] = {ypos = ypos, prob = prob}
end
meta:set_string("slices", minetest.serialize(slice_list))