From 4b0bc220e4da1173f742a4973939b139bef562db Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 21 Jul 2023 00:58:49 +1000 Subject: Support for changing the game's timescale Context-specific (like per-world) timescales can also be added later --- source/game/StarWorldServer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/game/StarWorldServer.cpp') diff --git a/source/game/StarWorldServer.cpp b/source/game/StarWorldServer.cpp index ebd853a..3c5fbfe 100644 --- a/source/game/StarWorldServer.cpp +++ b/source/game/StarWorldServer.cpp @@ -523,7 +523,7 @@ void WorldServer::setFidelity(WorldServerFidelity fidelity) { m_fidelityConfig = m_serverConfig.get("fidelitySettings").get(WorldServerFidelityNames.getRight(m_fidelity)); } -void WorldServer::update() { +void WorldServer::update(float dt) { ++m_currentStep; for (auto const& pair : m_clientInfo) pair.second->interpolationTracker.update(m_currentStep); @@ -539,7 +539,7 @@ void WorldServer::update() { for (auto const& action : triggeredActions) action(this); - m_spawner.update(); + m_spawner.update(dt); bool doBreakChecks = m_tileEntityBreakCheckTimer.wrapTick(m_currentStep) && m_needsGlobalBreakCheck; if (doBreakChecks) @@ -547,7 +547,7 @@ void WorldServer::update() { List toRemove; m_entityMap->updateAllEntities([&](EntityPtr const& entity) { - entity->update(m_currentStep); + entity->update(dt, m_currentStep); if (auto tileEntity = as(entity)) { // Only do break checks on objects if all sectors the object touches @@ -564,11 +564,11 @@ void WorldServer::update() { return a->entityType() < b->entityType(); }); - updateDamage(); + updateDamage(dt); if (shouldRunThisStep("wiringUpdate")) m_wireProcessor->process(); - m_sky->update(); + m_sky->update(dt); List clientWindows; List clientMonitoringRegions; @@ -579,7 +579,7 @@ void WorldServer::update() { } m_weather.setClientVisibleRegions(clientWindows); - m_weather.update(); + m_weather.update(dt); for (auto projectile : m_weather.pullNewProjectiles()) addEntity(move(projectile)); @@ -1782,8 +1782,8 @@ void WorldServer::queueUpdatePackets(ConnectionId clientId) { clientInfo->outgoingPackets.append(move(p.second)); } -void WorldServer::updateDamage() { - m_damageManager->update(); +void WorldServer::updateDamage(float dt) { + m_damageManager->update(dt); // Do nothing with damage notifications at the moment. m_damageManager->pullPendingNotifications(); -- cgit v1.2.3