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

Method writeNetState

source/game/StarNpc.cpp:262–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262pair<ByteArray, uint64_t> Npc::writeNetState(uint64_t fromVersion, NetCompatibilityRules rules) {
263 // client-side npcs error nearby vanilla NPC scripts because callScriptedEntity
264 // for now, scrungle the collision poly to avoid their queries. hacky :(
265 if (m_npcVariant.overrides && m_npcVariant.overrides.getBool("overrideNetPoly", false)) {
266 if (auto mode = entityMode()) {
267 if (*mode == EntityMode::Master && connectionForEntity(entityId()) != ServerConnectionId) {
268 PolyF poly = m_movementController->collisionPoly();
269 m_movementController->setCollisionPoly({ { 0.0f, -3.402823466e+38F }});
270 auto result = m_netGroup.writeNetState(fromVersion, rules);
271 m_movementController->setCollisionPoly(poly);
272 return result;
273 }
274 }
275 }
276
277 return m_netGroup.writeNetState(fromVersion, rules);
278}
279
280void Npc::readNetState(ByteArray data, float interpolationTime, NetCompatibilityRules rules) {
281 m_netGroup.readNetState(data, interpolationTime, rules);

Callers 13

resendEntityMethod · 0.45
removeEntityMethod · 0.45
addEntityMethod · 0.45
queueUpdatePacketsMethod · 0.45
notifyEntityCreateMethod · 0.45
writeUpdateMethod · 0.45
writeUpdateMethod · 0.45
queueUpdatePacketsMethod · 0.45
removeEntityMethod · 0.45
queueUpdatePacketsMethod · 0.45
writeUpdateMethod · 0.45
writeDeltaMethod · 0.45

Calls 3

connectionForEntityFunction · 0.85
getBoolMethod · 0.80
setCollisionPolyMethod · 0.80

Tested by 1

TESTFunction · 0.36