@@ -42,7 +42,14 @@ FlagDesc flagdesc_mapgen[] = {
42
42
{" v6_jungles" , MGV6_JUNGLES},
43
43
{" v6_biome_blend" , MGV6_BIOME_BLEND},
44
44
{" flat" , MG_FLAT},
45
- {NULL , 0 }
45
+ {NULL , 0 }
46
+ };
47
+
48
+ FlagDesc flagdesc_ore[] = {
49
+ {" absheight" , OREFLAG_ABSHEIGHT},
50
+ {" scatter_noisedensity" , OREFLAG_DENSITY},
51
+ {" claylike_nodeisnt" , OREFLAG_NODEISNT},
52
+ {NULL , 0 }
46
53
};
47
54
48
55
@@ -87,17 +94,28 @@ void Ore::resolveNodeNames(INodeDefManager *ndef) {
87
94
88
95
89
96
void OreScatter::generate (Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
90
- if (nmin.Y > height_max || nmax.Y < height_min)
97
+ int in_range = 0 ;
98
+
99
+ in_range |= (nmin.Y <= height_max && nmax.Y >= height_min);
100
+ if (flags & OREFLAG_ABSHEIGHT)
101
+ in_range |= (nmin.Y >= -height_max && nmax.Y <= -height_min) << 1 ;
102
+ if (!in_range)
91
103
return ;
92
-
104
+
93
105
resolveNodeNames (mg->ndef );
94
106
95
107
MapNode n_ore (ore);
96
108
ManualMapVoxelManipulator *vm = mg->vm ;
97
109
PseudoRandom pr (blockseed);
110
+ int ymin, ymax;
98
111
99
- int ymin = MYMAX (nmin.Y , height_min);
100
- int ymax = MYMIN (nmax.Y , height_max);
112
+ if (in_range & ORE_RANGE_MIRROR) {
113
+ ymin = MYMAX (nmin.Y , -height_max);
114
+ ymax = MYMIN (nmax.Y , -height_min);
115
+ } else {
116
+ ymin = MYMAX (nmin.Y , height_min);
117
+ ymax = MYMIN (nmax.Y , height_max);
118
+ }
101
119
if (clust_size >= ymax - ymin + 1 )
102
120
return ;
103
121
@@ -131,17 +149,29 @@ void OreScatter::generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
131
149
132
150
133
151
void OreSheet::generate (Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
134
- if (nmin.Y > height_max || nmax.Y < height_min)
135
- return ;
152
+ int in_range = 0 ;
136
153
154
+ in_range |= (nmin.Y <= height_max && nmax.Y >= height_min);
155
+ if (flags & OREFLAG_ABSHEIGHT)
156
+ in_range |= (nmin.Y >= -height_max && nmax.Y <= -height_min) << 1 ;
157
+ if (!in_range)
158
+ return ;
159
+
137
160
resolveNodeNames (mg->ndef );
138
161
139
162
MapNode n_ore (ore);
140
163
ManualMapVoxelManipulator *vm = mg->vm ;
141
164
PseudoRandom pr (blockseed + 4234 );
165
+ int ymin, ymax;
142
166
143
- int ymin = MYMAX (nmin.Y , height_min);
144
- int ymax = MYMIN (nmax.Y , height_max);
167
+ if (in_range & ORE_RANGE_MIRROR) {
168
+ ymin = MYMAX (nmin.Y , -height_max);
169
+ ymax = MYMIN (nmax.Y , -height_min);
170
+ } else {
171
+ ymin = MYMAX (nmin.Y , height_min);
172
+ ymax = MYMIN (nmax.Y , height_max);
173
+ }
174
+
145
175
if (clust_size >= ymax - ymin + 1 )
146
176
return ;
147
177
0 commit comments