Add histogram loading screen
This commit is contained in:
parent
8f261ad354
commit
f9b74cef27
23
init.lua
23
init.lua
@ -711,6 +711,21 @@ minetest.register_chatcommand("perlin_generate", {
|
||||
end,
|
||||
})
|
||||
|
||||
local show_histogram_loading_formspec = function(player)
|
||||
local form = [[
|
||||
formspec_version[4]size[10,2]
|
||||
container[0.25,0.25]
|
||||
box[0,0;9.5,1.5;]]..FORMSPEC_BOX_COLOR..[[]
|
||||
box[0,0;9.5,0.4;]]..FORMSPEC_HEADER_COLOR..[[]
|
||||
label[0.25,0.2;]]..F(S("Performing deep analysis ..."))..[[]
|
||||
container[0.25,0.8]
|
||||
label[0,0;]]..F(S("Collecting data, please wait …"))..[[]
|
||||
container_end[]
|
||||
container_end[]
|
||||
]]
|
||||
minetest.show_formspec(player:get_player_name(), "perlin_explorer:histogram_loading", form)
|
||||
end
|
||||
|
||||
local show_histogram_formspec = function(player, stats)
|
||||
local txt = ""
|
||||
local maxh = 6.0
|
||||
@ -753,7 +768,7 @@ local show_histogram_formspec = function(player, stats)
|
||||
container[0.25,0.25]
|
||||
box[0,0;9.5,10;]]..FORMSPEC_BOX_COLOR..[[]
|
||||
box[0,0;9.5,0.4;]]..FORMSPEC_HEADER_COLOR..[[]
|
||||
label[0.25,0.2;]]..F(S("Noise Parameter Histogram"))..[[]
|
||||
label[0.25,0.2;]]..F(S("Noise Value Histogram"))..[[]
|
||||
container[0.25,0.8]
|
||||
]]..labels..[[
|
||||
]]..boxes..[[
|
||||
@ -989,9 +1004,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
else -- 3 dimensions
|
||||
size = 162 -- 163^3 is roughly equal to 2048
|
||||
end
|
||||
-- Show a loading formspec
|
||||
show_histogram_loading_formspec(player)
|
||||
-- This takes long
|
||||
local _, stats = create_perlin(pos, {dimensions=current_perlin.dimensions, size=size, set_nodes=false})
|
||||
if stats then
|
||||
-- Update the formspec to show the result
|
||||
show_histogram_formspec(player, stats)
|
||||
else
|
||||
minetest.log("error", "[perlin_explorer] Error while creating stats from Perlin noise!")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user