1
0
Fork 0

Fix metadata wiping when placing schematics

minenux
luk3yx 2022-12-11 13:18:49 +13:00
parent ccf20998f4
commit 9985ffb2fc
2 changed files with 7 additions and 14 deletions

View File

@ -119,7 +119,7 @@ void Schematic::resolveNodeNames()
}
void Schematic::blitToVManip(MMVManip *vm, v3s16 p, Rotation rot, bool force_place)
void Schematic::blitToVManip(MMVManip *vm, v3s16 p, Rotation rot, bool force_place, ServerMap *map)
{
assert(schemdata && slice_probs);
sanity_check(m_ndef != NULL);
@ -195,6 +195,10 @@ void Schematic::blitToVManip(MMVManip *vm, v3s16 p, Rotation rot, bool force_pla
if (rot)
vm->m_data[vi].rotateAlongYAxis(m_ndef, rot);
// Wipe metadata if a map object was specified
if (map != nullptr && (force_place || force_place_node))
map->removeNodeMetadata(pos);
}
}
y_map++;
@ -263,23 +267,12 @@ void Schematic::placeOnMap(ServerMap *map, v3s16 p, u32 flags,
MMVManip vm(map);
vm.initialEmerge(bp1, bp2);
blitToVManip(&vm, p, rot, force_place);
blitToVManip(&vm, p, rot, force_place, map);
voxalgo::blit_back_with_light(map, &vm, &modified_blocks);
//// Carry out post-map-modification actions
if (force_place) {
v3s16 npos;
for (npos.X = p.X; npos.X < p.X + s.X; npos.X++) {
for (npos.Y = p.Y; npos.Y < p.Y + s.Y; npos.Y++) {
for (npos.Z = p.Z; npos.Z < p.Z + s.Z; npos.Z++) {
map->removeNodeMetadata(npos);
}
}
}
}
//// Create & dispatch map modification events to observers
MapEditEvent event;
event.type = MEET_OTHER;

View File

@ -113,7 +113,7 @@ public:
bool serializeToLua(std::ostream *os, const std::vector<std::string> &names,
bool use_comments, u32 indent_spaces) const;
void blitToVManip(MMVManip *vm, v3s16 p, Rotation rot, bool force_place);
void blitToVManip(MMVManip *vm, v3s16 p, Rotation rot, bool force_place, ServerMap *map = nullptr);
bool placeOnVManip(MMVManip *vm, v3s16 p, u32 flags, Rotation rot, bool force_place);
void placeOnMap(ServerMap *map, v3s16 p, u32 flags, Rotation rot, bool force_place);