1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Make sure generated blocks have their timestamp set

behavior change: newly generated blocks are no longer momentarily activated.
this shouldn't matter for anyone and did not consistently apply to all blocks anyway

addresses issue from #15902 for new maps(!)
This commit is contained in:
sfan5 2025-03-18 21:50:17 +01:00
parent ed40ea010b
commit 7b746d21f9
8 changed files with 66 additions and 32 deletions

View file

@ -199,6 +199,7 @@ bool ServerMap::blockpos_over_mapgen_limit(v3s16 p)
bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
{
assert(data);
s16 csize = getMapgenParams()->chunksize;
v3s16 bpmin = EmergeManager::getContainingChunk(blockpos, csize);
v3s16 bpmax = bpmin + v3s16(1, 1, 1) * (csize - 1);
@ -263,8 +264,10 @@ bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
}
void ServerMap::finishBlockMake(BlockMakeData *data,
std::map<v3s16, MapBlock*> *changed_blocks)
std::map<v3s16, MapBlock*> *changed_blocks, u32 now)
{
assert(data);
assert(changed_blocks);
v3s16 bpmin = data->blockpos_min;
v3s16 bpmax = data->blockpos_max;
@ -283,7 +286,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
/*
Copy transforming liquid information
*/
while (data->transforming_liquid.size()) {
while (!data->transforming_liquid.empty()) {
m_transforming_liquid.push_back(data->transforming_liquid.front());
data->transforming_liquid.pop_front();
}
@ -297,15 +300,13 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
*/
block->expireIsAirCache();
/*
Set block as modified
Set block as modified (if it isn't already)
*/
block->raiseModified(MOD_STATE_WRITE_NEEDED,
MOD_REASON_EXPIRE_IS_AIR);
}
/*
Set central blocks as generated
*/
// Note: this does not apply to the extra border area
for (s16 x = bpmin.X; x <= bpmax.X; x++)
for (s16 z = bpmin.Z; z <= bpmax.Z; z++)
for (s16 y = bpmin.Y; y <= bpmax.Y; y++) {
@ -314,13 +315,10 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
continue;
block->setGenerated(true);
// Set timestamp to ensure correct application of LBMs and other stuff
block->setTimestampNoChangedFlag(now);
}
/*
Save changed parts of map
NOTE: Will be saved later.
*/
//save(MOD_STATE_WRITE_AT_UNLOAD);
m_chunks_in_progress.erase(bpmin);
}