Skip to content

Commit b517381

Browse files
committedJul 8, 2015
Biome API decorations: 'spawnby' searches a 3D neighbourhood
The neighbours checked are the 8 nodes horizontally surrounding the decoration base and the 8 nodes horizontally surrounding the ground node below the decoration
1 parent 39439cb commit b517381

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
 

‎doc/lua_api.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -3331,7 +3331,9 @@ Definition tables
33313331
-- ^ Number of nodes the decoration can be at maximum.
33323332
-- ^ If absent, the parameter 'height' is used as a constant.
33333333
spawn_by = "default:water",
3334-
-- ^ Node that the decoration only spawns next to, in a 1-node square radius.
3334+
-- ^ Node that the decoration only spawns next to.
3335+
-- ^ The neighbours checked are the 8 nodes horizontally surrounding the lowest node of the
3336+
-- ^ decoration, and the 8 nodes horizontally surrounding the ground node below the decoration.
33353337
num_spawn_by = 1,
33363338
-- ^ Number of spawn_by nodes that must be surrounding the decoration position to occur.
33373339
-- ^ If absent or -1, decorations occur next to any nodes.

‎src/mg_decoration.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,24 @@ bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p)
246246
return true;
247247

248248
int nneighs = 0;
249-
v3s16 dirs[8] = {
249+
v3s16 dirs[16] = {
250250
v3s16( 0, 0, 1),
251251
v3s16( 0, 0, -1),
252252
v3s16( 1, 0, 0),
253253
v3s16(-1, 0, 0),
254254
v3s16( 1, 0, 1),
255255
v3s16(-1, 0, 1),
256256
v3s16(-1, 0, -1),
257-
v3s16( 1, 0, -1)
257+
v3s16( 1, 0, -1),
258+
259+
v3s16( 0, 1, 1),
260+
v3s16( 0, 1, -1),
261+
v3s16( 1, 1, 0),
262+
v3s16(-1, 1, 0),
263+
v3s16( 1, 1, 1),
264+
v3s16(-1, 1, 1),
265+
v3s16(-1, 1, -1),
266+
v3s16( 1, 1, -1)
258267
};
259268

260269
// Check a Moore neighborhood if there are enough spawnby nodes

0 commit comments

Comments
 (0)
Please sign in to comment.