| 1491 | } |
| 1492 | |
| 1493 | void WorldClient::queueUpdatePackets(bool sendEntityUpdates) { |
| 1494 | auto& root = Root::singleton(); |
| 1495 | auto assets = root.assets(); |
| 1496 | auto entityFactory = root.entityFactory(); |
| 1497 | |
| 1498 | m_outgoingPackets.append(make_shared<StepUpdatePacket>(m_currentTime)); |
| 1499 | |
| 1500 | if (m_currentStep % m_clientConfig.getInt("worldClientStateUpdateDelta") == 0) |
| 1501 | m_outgoingPackets.append(make_shared<WorldClientStateUpdatePacket>(m_clientState.writeDelta())); |
| 1502 | |
| 1503 | m_entityMap->forAllEntities([&](EntityPtr const& entity) { notifyEntityCreate(entity); }); |
| 1504 | |
| 1505 | if (sendEntityUpdates) { |
| 1506 | auto entityUpdateSet = make_shared<EntityUpdateSetPacket>(); |
| 1507 | entityUpdateSet->forConnection = *m_clientId; |
| 1508 | auto netRules = m_clientState.netCompatibilityRules(); |
| 1509 | m_entityMap->forAllEntities([&](EntityPtr const& entity) { |
| 1510 | if (auto version = m_masterEntitiesNetVersion.ptr(entity->entityId())) { |
| 1511 | auto updateAndVersion = entity->writeNetState(*version, netRules); |
| 1512 | if (!updateAndVersion.first.empty()) |
| 1513 | entityUpdateSet->deltas[entity->entityId()] = std::move(updateAndVersion.first); |
| 1514 | *version = updateAndVersion.second; |
| 1515 | } |
| 1516 | }); |
| 1517 | m_outgoingPackets.append(std::move(entityUpdateSet)); |
| 1518 | } |
| 1519 | |
| 1520 | for (auto& remoteHitRequest : m_damageManager->pullRemoteHitRequests()) |
| 1521 | m_outgoingPackets.append(make_shared<HitRequestPacket>(std::move(remoteHitRequest))); |
| 1522 | for (auto& remoteDamageRequest : m_damageManager->pullRemoteDamageRequests()) |
| 1523 | m_outgoingPackets.append(make_shared<DamageRequestPacket>(std::move(remoteDamageRequest))); |
| 1524 | for (auto& remoteDamageNotification : m_damageManager->pullRemoteDamageNotifications()) |
| 1525 | m_outgoingPackets.append(make_shared<DamageNotificationPacket>(std::move(remoteDamageNotification))); |
| 1526 | } |
| 1527 | |
| 1528 | void WorldClient::handleDamageNotifications() { |
| 1529 | if (!inWorld()) |
nothing calls this directly
no test coverage detected