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

Method netStoreEntity

source/game/StarEntityFactory.cpp:43–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43ByteArray EntityFactory::netStoreEntity(EntityPtr const& entity, NetCompatibilityRules rules) const {
44 RecursiveMutexLocker locker(m_mutex);
45
46 if (auto player = as<Player>(entity)) {
47 return player->netStore(rules);
48 } else if (auto monster = as<Monster>(entity)) {
49 return monster->netStore(rules);
50 } else if (auto object = as<Object>(entity)) {
51 return object->netStore(rules);
52 } else if (auto plant = as<Plant>(entity)) {
53 return plant->netStore(rules);
54 } else if (auto plantDrop = as<PlantDrop>(entity)) {
55 return plantDrop->netStore(rules);
56 } else if (auto projectile = as<Projectile>(entity)) {
57 return projectile->netStore(rules);
58 } else if (auto itemDrop = as<ItemDrop>(entity)) {
59 return itemDrop->netStore(rules);
60 } else if (auto npc = as<Npc>(entity)) {
61 return npc->netStore(rules);
62 } else if (auto stagehand = as<Stagehand>(entity)) {
63 return stagehand->netStore(rules);
64 } else if (auto vehicle = as<Vehicle>(entity)) {
65 return m_vehicleDatabase->netStore(vehicle, rules);
66 } else {
67 throw EntityFactoryException::format("Don't know how to make net store for entity type '{}'", EntityTypeNames.getRight(entity->entityType()));
68 }
69}
70
71EntityPtr EntityFactory::netLoadEntity(EntityType type, ByteArray const& netStore, NetCompatibilityRules rules) const {
72 RecursiveMutexLocker locker(m_mutex);

Callers 3

addEntityMethod · 0.80
notifyEntityCreateMethod · 0.80
queueUpdatePacketsMethod · 0.80

Calls 3

formatFunction · 0.50
netStoreMethod · 0.45
entityTypeMethod · 0.45

Tested by

no test coverage detected