1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2024-12-26 02:30:40 +01:00

Fix exiting mtschemprob entry dialog with ESC

This commit is contained in:
sfan5 2016-08-05 16:41:37 +02:00
parent 5afea424ba
commit 5abe1cee3d

View File

@ -1152,8 +1152,8 @@ minetest.register_chatcommand("/mtschemprob", {
return return
end end
for k,v in pairs(problist) do for k,v in pairs(problist) do
local prob = math.floor(((v["prob"] / 256) * 100) * 100 + 0.5) / 100 local prob = math.floor(((v.prob / 256) * 100) * 100 + 0.5) / 100
text = text .. minetest.pos_to_string(v["pos"]) .. ": " .. prob .. "% | " text = text .. minetest.pos_to_string(v.pos) .. ": " .. prob .. "% | "
end end
worldedit.player_notify(name, "currently set node probabilities:") worldedit.player_notify(name, "currently set node probabilities:")
worldedit.player_notify(name, text) worldedit.player_notify(name, text)
@ -1163,16 +1163,14 @@ minetest.register_chatcommand("/mtschemprob", {
end, end,
}) })
minetest.register_on_player_receive_fields( minetest.register_on_player_receive_fields(function(player, formname, fields)
function(player, formname, fields) if formname == "prob_val_enter" and not (fields.text == "" or fields.text == nil) then
if (formname == "prob_val_enter") and (fields.text ~= "") 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 prob_entry = {pos=worldedit.prob_pos[name], prob=tonumber(fields.text)} local index = table.getn(worldedit.prob_list[name]) + 1
local index = table.getn(worldedit.prob_list[name]) + 1 worldedit.prob_list[name][index] = prob_entry
worldedit.prob_list[name][index] = prob_entry
end
end end
) end)
minetest.register_chatcommand("/clearobjects", { minetest.register_chatcommand("/clearobjects", {
params = "", params = "",