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/objects/StarContainerObject.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/objects/StarContainerObject.cpp')
-rw-r--r-- | source/game/objects/StarContainerObject.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/game/objects/StarContainerObject.cpp b/source/game/objects/StarContainerObject.cpp index d013a3b..f666902 100644 --- a/source/game/objects/StarContainerObject.cpp +++ b/source/game/objects/StarContainerObject.cpp @@ -64,15 +64,15 @@ void ContainerObject::init(World* world, EntityId entityId, EntityMode mode) { } } -void ContainerObject::update(uint64_t currentStep) { - Object::update(currentStep); +void ContainerObject::update(float dt, uint64_t currentStep) { + Object::update(dt, currentStep); if (isMaster()) { for (auto const& drop : take(m_lostItems)) world()->addEntity(ItemDrop::createRandomizedDrop(drop, position())); if (m_crafting.get()) - tickCrafting(); + tickCrafting(dt); if (m_autoCloseCooldown > 0) { m_autoCloseCooldown -= 1; @@ -453,7 +453,7 @@ ItemRecipe ContainerObject::recipeForMaterials(List<ItemPtr> const& inputItems) return itemDatabase->parseRecipe(*result); } -void ContainerObject::tickCrafting() { +void ContainerObject::tickCrafting(float dt) { if (!m_crafting.get()) return; @@ -477,7 +477,7 @@ void ContainerObject::tickCrafting() { return; } if (m_goalRecipe.duration > 0) - m_craftingProgress.set(m_craftingProgress.get() + WorldTimestep / m_goalRecipe.duration); + m_craftingProgress.set(m_craftingProgress.get() + dt / m_goalRecipe.duration); else m_craftingProgress.set(1.0f); if (m_craftingProgress.get() >= 1.0f) { |