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

summaryrefslogtreecommitdiff
path: root/source/game/StarItemDrop.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-08-18 16:54:47 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-08-18 16:54:47 +1000
commitaa0ef06ac64542183a6f66bbfcad7d4cb45e9fd9 (patch)
tree25827d6a4853621526244a1b6248a9be1e5a5654 /source/game/StarItemDrop.cpp
parent50ec1a040649bdf9020a8da5453a703beb13453d (diff)
Predict item drop animation client-side
Diffstat (limited to 'source/game/StarItemDrop.cpp')
-rw-r--r--source/game/StarItemDrop.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/game/StarItemDrop.cpp b/source/game/StarItemDrop.cpp
index 289de55..4bf41e5 100644
--- a/source/game/StarItemDrop.cpp
+++ b/source/game/StarItemDrop.cpp
@@ -240,8 +240,13 @@ void ItemDrop::update(float dt, uint64_t) {
Root::singleton().itemDatabase()->loadItem(m_itemDescriptor.get(), m_item);
m_netGroup.tickNetInterpolation(GlobalTimestep);
if (m_owningEntity.get() != NullEntityId) {
- updateTaken(false);
- m_movementController.tickMaster(dt);
+ m_dropAge.update(world()->epochTime());
+ if (!isMaster() && m_dropAge.elapsedTime() > 1.0f)
+ m_owningEntity.set(NullEntityId);
+ else {
+ updateTaken(false);
+ m_movementController.tickMaster(dt);
+ }
}
else {
m_movementController.tickSlave(dt);