MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / readMetadata

Method readMetadata

source/game/StarWorldServer.cpp:2452–2474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2450}
2451
2452void WorldServer::readMetadata() {
2453 auto dungeonDefinitions = Root::singleton().dungeonDefinitions();
2454 auto versioningDatabase = Root::singleton().versioningDatabase();
2455
2456 auto metadata = versioningDatabase->loadVersionedJson(m_worldStorage->worldMetadata(), "WorldMetadata");
2457
2458 m_playerStart = jsonToVec2F(metadata.get("playerStart"));
2459 m_respawnInWorld = metadata.getBool("respawnInWorld");
2460 m_adjustPlayerStart = metadata.getBool("adjustPlayerStart");
2461 m_worldTemplate = make_shared<WorldTemplate>(metadata.get("worldTemplate"));
2462 m_centralStructure = WorldStructure(metadata.get("centralStructure"));
2463 m_protectedDungeonIds = jsonToSet<StableHashSet<DungeonId>>(metadata.get("protectedDungeonIds"), mem_fn(&Json::toUInt));
2464 m_worldProperties = metadata.getObject("worldProperties");
2465 m_spawner.setActive(metadata.getBool("spawningEnabled"));
2466
2467 m_dungeonIdGravity = transform<HashMap<DungeonId, float>>(metadata.getArray("dungeonIdGravity"), [](Json const& p) {
2468 return make_pair(p.getInt(0), p.getFloat(1));
2469 });
2470
2471 m_dungeonIdBreathable = transform<HashMap<DungeonId, bool>>(metadata.getArray("dungeonIdBreathable"), [](Json const& p) {
2472 return make_pair(p.getInt(0), p.getBool(1));
2473 });
2474}
2475
2476void WorldServer::writeMetadata() {
2477 auto versioningDatabase = Root::singleton().versioningDatabase();

Callers

nothing calls this directly

Calls 14

singletonClass · 0.85
jsonToVec2FFunction · 0.85
WorldStructureClass · 0.85
dungeonDefinitionsMethod · 0.80
versioningDatabaseMethod · 0.80
worldMetadataMethod · 0.80
getBoolMethod · 0.80
getArrayMethod · 0.80
getIntMethod · 0.80
getFloatMethod · 0.80
loadVersionedJsonMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected