Skip to content
Snippets Groups Projects
Commit b5173817 authored by paramat's avatar paramat
Browse files

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
parent 39439cbd
No related branches found
No related tags found
No related merge requests found
...@@ -3331,7 +3331,9 @@ Definition tables ...@@ -3331,7 +3331,9 @@ Definition tables
-- ^ Number of nodes the decoration can be at maximum. -- ^ Number of nodes the decoration can be at maximum.
-- ^ If absent, the parameter 'height' is used as a constant. -- ^ If absent, the parameter 'height' is used as a constant.
spawn_by = "default:water", spawn_by = "default:water",
-- ^ Node that the decoration only spawns next to, in a 1-node square radius. -- ^ Node that the decoration only spawns next to.
-- ^ The neighbours checked are the 8 nodes horizontally surrounding the lowest node of the
-- ^ decoration, and the 8 nodes horizontally surrounding the ground node below the decoration.
num_spawn_by = 1, num_spawn_by = 1,
-- ^ Number of spawn_by nodes that must be surrounding the decoration position to occur. -- ^ Number of spawn_by nodes that must be surrounding the decoration position to occur.
-- ^ If absent or -1, decorations occur next to any nodes. -- ^ If absent or -1, decorations occur next to any nodes.
......
...@@ -246,7 +246,7 @@ bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p) ...@@ -246,7 +246,7 @@ bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p)
return true; return true;
int nneighs = 0; int nneighs = 0;
v3s16 dirs[8] = { v3s16 dirs[16] = {
v3s16( 0, 0, 1), v3s16( 0, 0, 1),
v3s16( 0, 0, -1), v3s16( 0, 0, -1),
v3s16( 1, 0, 0), v3s16( 1, 0, 0),
...@@ -254,7 +254,16 @@ bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p) ...@@ -254,7 +254,16 @@ bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p)
v3s16( 1, 0, 1), v3s16( 1, 0, 1),
v3s16(-1, 0, 1), v3s16(-1, 0, 1),
v3s16(-1, 0, -1), v3s16(-1, 0, -1),
v3s16( 1, 0, -1) v3s16( 1, 0, -1),
v3s16( 0, 1, 1),
v3s16( 0, 1, -1),
v3s16( 1, 1, 0),
v3s16(-1, 1, 0),
v3s16( 1, 1, 1),
v3s16(-1, 1, 1),
v3s16(-1, 1, -1),
v3s16( 1, 1, -1)
}; };
// Check a Moore neighborhood if there are enough spawnby nodes // Check a Moore neighborhood if there are enough spawnby nodes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment