diff --git a/init.lua b/init.lua index d9220e8..24ff898 100644 --- a/init.lua +++ b/init.lua @@ -31,13 +31,13 @@ local FORMSPEC_HEADER_COLOR = "#000000FF" -- Buckets to use for the histogram local HISTOGRAM_BUCKETS = 10 --- Length of side (XZ) of the square to calculate in the Deep Analyze mode. +-- Length of side (XZ) of the square to calculate for the statistics screen. -- Number of values calculated is this to the power of 2. -local DEEP_ANALYSIS_SIZE_2D = 2048 +local STATISTICS_SIZE_2D = 2048 --- Length of side (XZZ) of the cube to calculate in the Deep Analyze mode. +-- Length of side (XYZ) of the cube to calculate for the statistics screen. -- Number of values calculated is this to the power of 3. -local DEEP_ANALYSIS_SIZE_3D = 162 -- 163^3 is roughly equal to 2048 +local STATISTICS_SIZE_3D = 162 -- 163^3 is roughly equal to 2048 local S = minetest.get_translator("perlin_explorer") local F = minetest.formspec_escape @@ -892,10 +892,10 @@ local show_histogram_formspec = function(player, stats) local vmin, vmax if current_perlin.dimensions == 2 then vmin = S("(@1,@2)", 0,0) - vmax = S("(@1,@2)", DEEP_ANALYSIS_SIZE_2D, DEEP_ANALYSIS_SIZE_2D) + vmax = S("(@1,@2)", STATISTICS_SIZE_2D, STATISTICS_SIZE_2D) else vmin = S("(@1,@2,@3)", 0,0,0) - vmax = S("(@1,@2,@3)", DEEP_ANALYSIS_SIZE_3D, DEEP_ANALYSIS_SIZE_3D, DEEP_ANALYSIS_SIZE_3D) + vmax = S("(@1,@2,@3)", STATISTICS_SIZE_3D, STATISTICS_SIZE_3D, STATISTICS_SIZE_3D) end local labels = "textarea[0,0;10,2;;;".. F(S("Values were picked between coordinates @1 and @2.", vmin, vmax)).."\n".. @@ -1100,7 +1100,7 @@ local show_noise_formspec = function(player, noiseparams, profile_id) label[0.15,0.2;]]..F(S("Noise options"))..[[] dropdown[0.25,0.7;1,0.75;dimensions;]]..F(S("2D"))..[[,]]..F(S("3D"))..[[;]]..dimensions_index..[[;true] field[2.25,0.7;2,0.75;sidelen;]]..F(S("Pixelization"))..[[;]]..sidelen..[[] - button[6.25,0.7;2.0,0.6;deep_analyze;]]..F(S("Statistics"))..[[] + button[6.25,0.7;2.0,0.6;statistics;]]..F(S("Statistics"))..[[] tooltip[sidelen;]]..F(S("If higher than 1, Perlin values will be repeated along all axes every x nodes, for a ‘pixelized’ effect."))..[[] container_end[] @@ -1164,14 +1164,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) return end - -- Start deep analysis - if fields.deep_analyze then + -- Start statistics calculation + if fields.statistics then local pos = vector.zero() local size if current_perlin.dimensions == 2 then - size = DEEP_ANALYSIS_SIZE_2D + size = STATISTICS_SIZE_2D else -- 3 dimensions - size = DEEP_ANALYSIS_SIZE_3D + size = STATISTICS_SIZE_3D end -- Show a loading formspec show_histogram_loading_formspec(player)