mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Place schematic (on vmanip): Enable use of 'place center' flags
For 'place schematic' and 'place schematic on vmanip' APIs. Fix 'place center' code to properly centre schematics. Fix some comments.
This commit is contained in:
parent
6c9df2ffa7
commit
c610643c4c
4 changed files with 40 additions and 18 deletions
|
@ -188,15 +188,15 @@ bool Schematic::placeOnVManip(MMVManip *vm, v3s16 p, u32 flags,
|
|||
|
||||
//// Adjust placement position if necessary
|
||||
if (flags & DECO_PLACE_CENTER_X)
|
||||
p.X -= (s.X + 1) / 2;
|
||||
p.X -= (s.X - 1) / 2;
|
||||
if (flags & DECO_PLACE_CENTER_Y)
|
||||
p.Y -= (s.Y + 1) / 2;
|
||||
p.Y -= (s.Y - 1) / 2;
|
||||
if (flags & DECO_PLACE_CENTER_Z)
|
||||
p.Z -= (s.Z + 1) / 2;
|
||||
p.Z -= (s.Z - 1) / 2;
|
||||
|
||||
blitToVManip(vm, p, rot, force_place);
|
||||
|
||||
return vm->m_area.contains(VoxelArea(p, p + s - v3s16(1,1,1)));
|
||||
return vm->m_area.contains(VoxelArea(p, p + s - v3s16(1, 1, 1)));
|
||||
}
|
||||
|
||||
void Schematic::placeOnMap(ServerMap *map, v3s16 p, u32 flags,
|
||||
|
@ -219,16 +219,16 @@ void Schematic::placeOnMap(ServerMap *map, v3s16 p, u32 flags,
|
|||
|
||||
//// Adjust placement position if necessary
|
||||
if (flags & DECO_PLACE_CENTER_X)
|
||||
p.X -= (s.X + 1) / 2;
|
||||
p.X -= (s.X - 1) / 2;
|
||||
if (flags & DECO_PLACE_CENTER_Y)
|
||||
p.Y -= (s.Y + 1) / 2;
|
||||
p.Y -= (s.Y - 1) / 2;
|
||||
if (flags & DECO_PLACE_CENTER_Z)
|
||||
p.Z -= (s.Z + 1) / 2;
|
||||
p.Z -= (s.Z - 1) / 2;
|
||||
|
||||
//// Create VManip for effected area, emerge our area, modify area
|
||||
//// inside VManip, then blit back.
|
||||
v3s16 bp1 = getNodeBlockPos(p);
|
||||
v3s16 bp2 = getNodeBlockPos(p + s - v3s16(1,1,1));
|
||||
v3s16 bp2 = getNodeBlockPos(p + s - v3s16(1, 1, 1));
|
||||
|
||||
MMVManip vm(map);
|
||||
vm.initialEmerge(bp1, bp2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue