mirror of
git://repo.or.cz/minetest_schemedit.git
synced 2025-01-09 09:30:32 +01:00
Prevent adding dupe slice definitions
This commit is contained in:
parent
cd808777c8
commit
f0c5c2659f
13
init.lua
13
init.lua
@ -635,7 +635,18 @@ schemedit.add_form("slice", {
|
|||||||
index = self.selected
|
index = self.selected
|
||||||
end
|
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))
|
meta:set_string("slices", minetest.serialize(slice_list))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user