1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Node placement / mineral / serialization / iron freq / node_dig callback

- Node placement code moved to Lua
- Mineral system removed (added default:stone_with_coal and default:stone_with_iron).
- MapBlock and MapNode serialization updated.
- Mapgen: Frequency of iron increased.
- node_dig callback and related changes.
This commit is contained in:
Kahrl 2012-01-21 00:11:44 +01:00 committed by Perttu Ahola
parent f22c73f501
commit 157a4cf18c
36 changed files with 1610 additions and 1454 deletions

View file

@ -915,7 +915,7 @@ void Map::updateLighting(core::map<v3s16, MapBlock*> & a_blocks,
/*
*/
void Map::addNodeAndUpdate(v3s16 p, MapNode n,
core::map<v3s16, MapBlock*> &modified_blocks, std::string &player_name)
core::map<v3s16, MapBlock*> &modified_blocks)
{
INodeDefManager *nodemgr = m_gamedef->ndef();
@ -1010,9 +1010,6 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
if(!meta){
errorstream<<"Failed to create node metadata \""
<<metadata_name<<"\""<<std::endl;
} else {
meta->setOwner(player_name);
setNodeMetadata(p, meta);
}
}
@ -1291,8 +1288,7 @@ bool Map::addNodeWithEvent(v3s16 p, MapNode n)
bool succeeded = true;
try{
core::map<v3s16, MapBlock*> modified_blocks;
std::string st = std::string("");
addNodeAndUpdate(p, n, modified_blocks, st);
addNodeAndUpdate(p, n, modified_blocks);
// Copy modified_blocks to event
for(core::map<v3s16, MapBlock*>::Iterator
@ -3271,10 +3267,7 @@ void ServerMap::saveBlock(MapBlock *block)
o.write((char*)&version, 1);
// Write basic data
block->serialize(o, version);
// Write extra data stored on disk
block->serializeDiskExtra(o, version);
block->serialize(o, version, true);
// Write block to database
@ -3336,11 +3329,8 @@ void ServerMap::loadBlock(std::string sectordir, std::string blockfile, MapSecto
}
// Read basic data
block->deSerialize(is, version);
block->deSerialize(is, version, true);
// Read extra data stored on disk
block->deSerializeDiskExtra(is, version);
// If it's a new block, insert it to the map
if(created_new)
sector->insertBlock(block);
@ -3406,10 +3396,7 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool
}
// Read basic data
block->deSerialize(is, version);
// Read extra data stored on disk
block->deSerializeDiskExtra(is, version);
block->deSerialize(is, version, true);
// If it's a new block, insert it to the map
if(created_new)