summaryrefslogtreecommitdiff
path: root/src/mg_ore.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-09-13 00:09:00 -0400
committerkwolekr <kwolekr@minetest.net>2015-09-13 00:11:50 -0400
commitbeba96941365a750f8b681df7a73566bdf797f0c (patch)
tree74bfb88c53b4584f757c37e1d1360cc317ea3b94 /src/mg_ore.cpp
parent1d6911676e8e9eadba76ef9f170d750fe6fa31bc (diff)
downloadminetest-beba96941365a750f8b681df7a73566bdf797f0c.tar.gz
minetest-beba96941365a750f8b681df7a73566bdf797f0c.tar.bz2
minetest-beba96941365a750f8b681df7a73566bdf797f0c.zip
Ore: Add ore sheet column height range selection
Modders are now able to select the range of ore column height, and the midpoint at which they 'grow' starting from. This commit adds three new parameters for the 'sheet' ore type: column_height_min, column_height_max, and column_midpoint_factor. clust_size is now deprecated for this ore type.
Diffstat (limited to 'src/mg_ore.cpp')
-rw-r--r--src/mg_ore.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp
index 0d0f74bf5..f5d312ba2 100644
--- a/src/mg_ore.cpp
+++ b/src/mg_ore.cpp
@@ -176,8 +176,8 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
PseudoRandom pr(blockseed + 4234);
MapNode n_ore(c_ore, 0, ore_param2);
- int max_height = clust_size;
- int y_start = pr.range(nmin.Y, nmax.Y - max_height);
+ u16 max_height = column_height_max;
+ int y_start = pr.range(nmin.Y + max_height, nmax.Y - max_height);
if (!noise) {
int sx = nmax.X - nmin.X + 1;
@@ -200,10 +200,12 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
continue;
}
- int height = max_height * (1. / pr.range(1, 3));
- int y0 = y_start + np.scale * noiseval; //pr.range(1, 3) - 1;
+ u16 height = pr.range(column_height_min, column_height_max);
+ int ymidpoint = y_start + noiseval;
+ int y0 = ymidpoint - height * (1 - column_midpoint_factor);
int y1 = y0 + height;
- for (int y = y0; y != y1; y++) {
+
+ for (int y = y0; y < y1; y++) {
u32 i = vm->m_area.index(x, y, z);
if (!vm->m_area.contains(i))
continue;