mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-01-12 11:00:28 +01:00
parent
abc9efeeb8
commit
9417f2bbf1
@ -490,7 +490,7 @@ minetest.register_on_punchnode(function(pos, node, puncher)
|
|||||||
worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos))
|
worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos))
|
||||||
elseif worldedit.set_pos[name] == "prob" then --setting Minetest schematic node probabilities
|
elseif worldedit.set_pos[name] == "prob" then --setting Minetest schematic node probabilities
|
||||||
worldedit.prob_pos[name] = pos
|
worldedit.prob_pos[name] = pos
|
||||||
minetest.show_formspec(puncher:get_player_name(), "prob_val_enter", "field[text;;]")
|
minetest.show_formspec(name, "prob_val_enter", "field[text;;]")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -1644,11 +1644,18 @@ worldedit.register_command("mtschemprob", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname == "prob_val_enter" and not (fields.text == "" or fields.text == nil) then
|
if formname == "prob_val_enter" then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local prob_entry = {pos=worldedit.prob_pos[name], prob=tonumber(fields.text)}
|
local problist = worldedit.prob_list[name]
|
||||||
local index = table.getn(worldedit.prob_list[name]) + 1
|
if problist == nil then
|
||||||
worldedit.prob_list[name][index] = prob_entry
|
return
|
||||||
|
end
|
||||||
|
local e = {pos=worldedit.prob_pos[name], prob=tonumber(fields.text)}
|
||||||
|
if e.pos == nil or e.prob == nil or e.prob < 0 or e.prob > 256 then
|
||||||
|
worldedit.player_notify(name, "invalid node probability given, not saved")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
problist[#problist+1] = e
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user