summaryrefslogtreecommitdiffstats
path: root/src/GameState.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-21 11:23:16 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-21 11:23:16 +0200
commita0e2ff6eab4866471c1c4fe3ddd12fdd8c616739 (patch)
tree99998d24ae70527770432af228eb3c41bc9aedd5 /src/GameState.cpp
parentMore correct block rotating (diff)
downloadAltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.tar
AltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.tar.gz
AltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.tar.bz2
AltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.tar.lz
AltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.tar.xz
AltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.tar.zst
AltCraft-a0e2ff6eab4866471c1c4fe3ddd12fdd8c616739.zip
Diffstat (limited to '')
-rw-r--r--src/GameState.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp
index c42092a..fabfdb8 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -58,6 +58,9 @@ void GameState::Update(float deltaTime) {
isBlockSelected = raycast.isHit;
raycastHit = raycast.hitPos;
+
+ if (doDaylightCycle)
+ interpolatedTimeOfDay += 20.0 * deltaTime;
}
}
@@ -433,8 +436,10 @@ void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) {
case TimeUpdate: {
auto packet = std::static_pointer_cast<PacketTimeUpdate>(ptr);
+ doDaylightCycle = TimeOfDay != packet->TimeOfDay;
WorldAge = packet->WorldAge;
TimeOfDay = packet->TimeOfDay;
+ interpolatedTimeOfDay = TimeOfDay;
break;
}