Biome API: Enable decorations placed on water
Add schematic decoration force placement flagmaster
parent
b65c7ab4a4
commit
c7454d4732
|
@ -792,11 +792,13 @@ Schematic attributes
|
||||||
--------------------
|
--------------------
|
||||||
See section "Flag Specifier Format".
|
See section "Flag Specifier Format".
|
||||||
|
|
||||||
Currently supported flags: `place_center_x`, `place_center_y`, `place_center_z`.
|
Currently supported flags: `place_center_x`, `place_center_y`,
|
||||||
|
`place_center_z`, `force_placement`.
|
||||||
|
|
||||||
* `place_center_x`: Placement of this decoration is centered along the X axis.
|
* `place_center_x`: Placement of this decoration is centered along the X axis.
|
||||||
* `place_center_y`: Placement of this decoration is centered along the Y axis.
|
* `place_center_y`: Placement of this decoration is centered along the Y axis.
|
||||||
* `place_center_z`: Placement of this decoration is centered along the Z axis.
|
* `place_center_z`: Placement of this decoration is centered along the Z axis.
|
||||||
|
* `force_placement`: Schematic nodes other than "ignore" will replace existing nodes.
|
||||||
|
|
||||||
|
|
||||||
HUD element types
|
HUD element types
|
||||||
|
@ -3191,8 +3193,10 @@ Definition tables
|
||||||
schematic = {
|
schematic = {
|
||||||
size = {x=4, y=6, z=4},
|
size = {x=4, y=6, z=4},
|
||||||
data = {
|
data = {
|
||||||
{name="cobble", param1=255, param2=0},
|
{name="default:cobble", param1=255, param2=0},
|
||||||
{name="dirt_with_grass", param1=255, param2=0},
|
{name="default:dirt_with_grass", param1=255, param2=0},
|
||||||
|
{name="ignore", param1=255, param2=0},
|
||||||
|
{name="air", param1=255, param2=0},
|
||||||
...
|
...
|
||||||
},
|
},
|
||||||
yslice_prob = {
|
yslice_prob = {
|
||||||
|
@ -3203,7 +3207,7 @@ Definition tables
|
||||||
},
|
},
|
||||||
-- ^ See 'Schematic specifier' for details.
|
-- ^ See 'Schematic specifier' for details.
|
||||||
replacements = {["oldname"] = "convert_to", ...},
|
replacements = {["oldname"] = "convert_to", ...},
|
||||||
flags = "place_center_x, place_center_z",
|
flags = "place_center_x, place_center_y, place_center_z, force_placement",
|
||||||
-- ^ Flags for schematic decorations. See 'Schematic attributes'.
|
-- ^ Flags for schematic decorations. See 'Schematic attributes'.
|
||||||
rotation = "90" -- rotate schematic 90 degrees on placement
|
rotation = "90" -- rotate schematic 90 degrees on placement
|
||||||
-- ^ Rotation can be "0", "90", "180", "270", or "random".
|
-- ^ Rotation can be "0", "90", "180", "270", or "random".
|
||||||
|
|
|
@ -31,6 +31,7 @@ FlagDesc flagdesc_deco[] = {
|
||||||
{"place_center_x", DECO_PLACE_CENTER_X},
|
{"place_center_x", DECO_PLACE_CENTER_X},
|
||||||
{"place_center_y", DECO_PLACE_CENTER_Y},
|
{"place_center_y", DECO_PLACE_CENTER_Y},
|
||||||
{"place_center_z", DECO_PLACE_CENTER_Z},
|
{"place_center_z", DECO_PLACE_CENTER_Z},
|
||||||
|
{"force_placement", DECO_FORCE_PLACEMENT},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,6 +141,7 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
|
||||||
s16 y = mg->heightmap ?
|
s16 y = mg->heightmap ?
|
||||||
mg->heightmap[mapindex] :
|
mg->heightmap[mapindex] :
|
||||||
mg->findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y);
|
mg->findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y);
|
||||||
|
y = MYMAX(y, mg->water_level);
|
||||||
|
|
||||||
if (y < nmin.Y || y > nmax.Y ||
|
if (y < nmin.Y || y > nmax.Y ||
|
||||||
y < y_min || y > y_max)
|
y < y_min || y > y_max)
|
||||||
|
@ -333,6 +335,8 @@ size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16
|
||||||
if (flags & DECO_PLACE_CENTER_Z)
|
if (flags & DECO_PLACE_CENTER_Z)
|
||||||
p.Z -= (schematic->size.Z + 1) / 2;
|
p.Z -= (schematic->size.Z + 1) / 2;
|
||||||
|
|
||||||
|
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
|
||||||
|
|
||||||
if (!vm->m_area.contains(p))
|
if (!vm->m_area.contains(p))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -344,7 +348,7 @@ size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16
|
||||||
Rotation rot = (rotation == ROTATE_RAND) ?
|
Rotation rot = (rotation == ROTATE_RAND) ?
|
||||||
(Rotation)pr->range(ROTATE_0, ROTATE_270) : rotation;
|
(Rotation)pr->range(ROTATE_0, ROTATE_270) : rotation;
|
||||||
|
|
||||||
schematic->blitToVManip(p, vm, rot, false, m_ndef);
|
schematic->blitToVManip(p, vm, rot, force_placement, m_ndef);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ enum DecorationType {
|
||||||
#define DECO_PLACE_CENTER_Y 0x02
|
#define DECO_PLACE_CENTER_Y 0x02
|
||||||
#define DECO_PLACE_CENTER_Z 0x04
|
#define DECO_PLACE_CENTER_Z 0x04
|
||||||
#define DECO_USE_NOISE 0x08
|
#define DECO_USE_NOISE 0x08
|
||||||
|
#define DECO_FORCE_PLACEMENT 0x10
|
||||||
|
|
||||||
extern FlagDesc flagdesc_deco[];
|
extern FlagDesc flagdesc_deco[];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue