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

summaryrefslogtreecommitdiff
path: root/source/game/StarTechController.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/StarTechController.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/StarTechController.cpp')
-rw-r--r--source/game/StarTechController.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/game/StarTechController.cpp b/source/game/StarTechController.cpp
index 8f0c7d7..4295fb7 100644
--- a/source/game/StarTechController.cpp
+++ b/source/game/StarTechController.cpp
@@ -190,7 +190,7 @@ void TechController::setAimPosition(Vec2F const& aimPosition) {
m_aimPosition = aimPosition;
}
-void TechController::tickMaster() {
+void TechController::tickMaster(float dt) {
// if there's no gravity, fly instead of walking
if (m_movementController->zeroG()) {
if (m_moveRight || m_moveLeft || m_moveUp || m_moveDown) {
@@ -235,16 +235,16 @@ void TechController::tickMaster() {
{"special3", m_moveSpecial3}
};
- module.scriptComponent.update(JsonObject{{"moves", moves}, {"dt", WorldTimestep}});
+ module.scriptComponent.update(JsonObject{{"moves", moves}, {"dt", dt}});
}
resetMoves();
- updateAnimators();
+ updateAnimators(dt);
}
-void TechController::tickSlave() {
+void TechController::tickSlave(float dt) {
resetMoves();
- updateAnimators();
+ updateAnimators(dt);
}
Maybe<TechController::ParentState> TechController::parentState() const {
@@ -467,15 +467,15 @@ void TechController::resetMoves() {
m_moveSpecial3 = false;
}
-void TechController::updateAnimators() {
+void TechController::updateAnimators(float dt) {
for (auto const& module : m_techModules)
m_techAnimators.getNetElement(module.animatorId)->setVisible(module.visible);
for (auto const& animator : m_techAnimators.netElements()) {
if (m_parentEntity->world()->isServer() || !animator->isVisible()) {
- 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());
}
}