diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-21 00:58:49 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-21 00:58:49 +1000 |
commit | 4b0bc220e4da1173f742a4973939b139bef562db (patch) | |
tree | 0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/game/StarStatusController.cpp | |
parent | 607be749451aa40e3619e7ceab0927d1fcec8233 (diff) |
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/game/StarStatusController.cpp')
-rw-r--r-- | source/game/StarStatusController.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/game/StarStatusController.cpp b/source/game/StarStatusController.cpp index 44f0afc..ba0930c 100644 --- a/source/game/StarStatusController.cpp +++ b/source/game/StarStatusController.cpp @@ -452,8 +452,8 @@ void StatusController::blankNetDelta(float interpolationTime) { m_netGroup.blankNetDelta(interpolationTime); } -void StatusController::tickMaster() { - m_statCollection.tickMaster(); +void StatusController::tickMaster(float dt) { + m_statCollection.tickMaster(dt); m_recentHitsGiven.tick(1); m_recentDamageGiven.tick(1); @@ -492,12 +492,12 @@ void StatusController::tickMaster() { addEphemeralEffects(m_parentEntity->world()->weatherStatusEffects(m_parentEntity->position()).transformed(jsonToEphemeralStatusEffect)); } - m_primaryScript.update(m_primaryScript.updateDt()); + m_primaryScript.update(m_primaryScript.updateDt(dt)); for (auto& p : m_uniqueEffects) { - p.second.script.update(p.second.script.updateDt()); + p.second.script.update(p.second.script.updateDt(dt)); auto metadata = m_uniqueEffectMetadata.getNetElement(p.second.metadataId); if (metadata->duration) - *metadata->duration -= WorldTimestep; + *metadata->duration -= dt; } for (auto const& key : m_uniqueEffects.keys()) { @@ -516,12 +516,12 @@ void StatusController::tickMaster() { m_parentDirectives.set(move(parentDirectives)); - updateAnimators(); + updateAnimators(dt); } -void StatusController::tickSlave() { - m_statCollection.tickSlave(); - updateAnimators(); +void StatusController::tickSlave(float dt) { + m_statCollection.tickSlave(dt); + updateAnimators(dt); } const DirectivesGroup& StatusController::parentDirectives() const { @@ -637,12 +637,12 @@ void StatusController::UniqueEffectMetadata::netElementsNeedStore() { durationNetState.set(duration ? *duration : -1.0f); } -void StatusController::updateAnimators() { +void StatusController::updateAnimators(float dt) { for (auto const& animator : m_effectAnimators.netElements()) { if (m_parentEntity->world()->isServer()) { - animator->animator.update(WorldTimestep, nullptr); + animator->animator.update(dt, nullptr); } else { - animator->animator.update(WorldTimestep, &animator->dynamicTarget); + animator->animator.update(dt, &animator->dynamicTarget); animator->dynamicTarget.updatePosition(m_movementController->position()); } } |