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

Method netLoadEntity

source/game/StarEntityFactory.cpp:71–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71EntityPtr EntityFactory::netLoadEntity(EntityType type, ByteArray const& netStore, NetCompatibilityRules rules) const {
72 RecursiveMutexLocker locker(m_mutex);
73
74 if (type == EntityType::Player) {
75 return m_playerFactory->netLoadPlayer(netStore, rules);
76 } else if (type == EntityType::Monster) {
77 return m_monsterDatabase->netLoadMonster(netStore, rules);
78 } else if (type == EntityType::Object) {
79 return m_objectDatabase->netLoadObject(netStore, rules);
80 } else if (type == EntityType::Plant) {
81 return make_shared<Plant>(netStore, rules);
82 } else if (type == EntityType::PlantDrop) {
83 return make_shared<PlantDrop>(netStore, rules);
84 } else if (type == EntityType::Projectile) {
85 return m_projectileDatabase->netLoadProjectile(netStore, rules);
86 } else if (type == EntityType::ItemDrop) {
87 return make_shared<ItemDrop>(netStore, rules);
88 } else if (type == EntityType::Npc) {
89 return m_npcDatabase->netLoadNpc(netStore, rules);
90 } else if (type == EntityType::Stagehand) {
91 return make_shared<Stagehand>(netStore, rules);
92 } else if (type == EntityType::Vehicle) {
93 return m_vehicleDatabase->netLoad(netStore, rules);
94 } else {
95 throw EntityFactoryException::format("Don't know how to create entity type '{}' from net store", EntityTypeNames.getRight(type));
96 }
97}
98
99Json EntityFactory::diskStoreEntity(EntityPtr const& entity) const {
100 RecursiveMutexLocker locker(m_mutex);

Callers 2

handleIncomingPacketsMethod · 0.80
handleIncomingPacketsMethod · 0.80

Calls 7

netLoadPlayerMethod · 0.80
netLoadMonsterMethod · 0.80
netLoadProjectileMethod · 0.80
netLoadNpcMethod · 0.80
formatFunction · 0.50
netLoadObjectMethod · 0.45
netLoadMethod · 0.45

Tested by

no test coverage detected