Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarObject.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
commit4b0bc220e4da1173f742a4973939b139bef562db (patch)
tree0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/game/StarObject.cpp
parent607be749451aa40e3619e7ceab0927d1fcec8233 (diff)
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/game/StarObject.cpp')
-rw-r--r--source/game/StarObject.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/game/StarObject.cpp b/source/game/StarObject.cpp
index 1b55ac0..be0000d 100644
--- a/source/game/StarObject.cpp
+++ b/source/game/StarObject.cpp
@@ -352,12 +352,12 @@ List<Vec2I> Object::roots() const {
return {};
}
-void Object::update(uint64_t) {
+void Object::update(float dt, uint64_t) {
if (!inWorld())
return;
if (isMaster()) {
- m_tileDamageStatus->recover(m_config->tileDamageParameters, WorldTimestep);
+ m_tileDamageStatus->recover(m_config->tileDamageParameters, dt);
if (m_liquidCheckTimer.wrapTick())
checkLiquidBroken();
@@ -369,24 +369,24 @@ void Object::update(uint64_t) {
setImageKey("frame", toString(frame));
}
- m_animationTimer = std::fmod(m_animationTimer + WorldTimestep, orientation->animationCycle);
+ m_animationTimer = std::fmod(m_animationTimer + dt, orientation->animationCycle);
}
- m_networkedAnimator->update(WorldTimestep, nullptr);
+ m_networkedAnimator->update(dt, nullptr);
m_networkedAnimator->setFlipped(direction() == Direction::Left, m_animationCenterLine);
- m_scriptComponent.update(m_scriptComponent.updateDt());
+ m_scriptComponent.update(m_scriptComponent.updateDt(dt));
} else {
- m_networkedAnimator->update(WorldTimestep, &m_networkedAnimatorDynamicTarget);
+ m_networkedAnimator->update(dt, &m_networkedAnimatorDynamicTarget);
m_networkedAnimatorDynamicTarget.updatePosition(position() + m_animationPosition);
}
if (m_lightFlickering)
- m_lightFlickering->update(WorldTimestep);
+ m_lightFlickering->update(dt);
for (auto& timer : m_emissionTimers)
- timer.tick();
+ timer.tick(dt);
if (world()->isClient())
m_scriptedAnimator.update();