fix drop prediction only working on drops from blocks

This commit is contained in:
Kae 2023-08-19 15:30:27 +10:00
parent 7ff3e0fecc
commit 9665048a9e

View File

@ -180,6 +180,8 @@ RectF ItemDrop::collisionArea() const {
} }
void ItemDrop::update(float dt, uint64_t) { void ItemDrop::update(float dt, uint64_t) {
m_dropAge.update(world()->epochTime());
if (isMaster()) { if (isMaster()) {
if (m_owningEntity.get() != NullEntityId) { if (m_owningEntity.get() != NullEntityId) {
updateTaken(true); updateTaken(true);
@ -217,7 +219,6 @@ void ItemDrop::update(float dt, uint64_t) {
m_movementController.tickMaster(dt); m_movementController.tickMaster(dt);
m_intangibleTimer.tick(dt); m_intangibleTimer.tick(dt);
m_dropAge.update(world()->epochTime());
m_ageItemsTimer.update(world()->epochTime()); m_ageItemsTimer.update(world()->epochTime());
if ((m_mode.get() == Mode::Intangible || m_mode.get() == Mode::Available) && m_movementController.atWorldLimit()) if ((m_mode.get() == Mode::Intangible || m_mode.get() == Mode::Available) && m_movementController.atWorldLimit())
@ -240,7 +241,6 @@ void ItemDrop::update(float dt, uint64_t) {
Root::singleton().itemDatabase()->loadItem(m_itemDescriptor.get(), m_item); Root::singleton().itemDatabase()->loadItem(m_itemDescriptor.get(), m_item);
m_netGroup.tickNetInterpolation(GlobalTimestep); m_netGroup.tickNetInterpolation(GlobalTimestep);
if (m_owningEntity.get() != NullEntityId) { if (m_owningEntity.get() != NullEntityId) {
m_dropAge.update(world()->epochTime());
if (!isMaster() && m_dropAge.elapsedTime() > 1.0f) if (!isMaster() && m_dropAge.elapsedTime() > 1.0f)
m_owningEntity.set(NullEntityId); m_owningEntity.set(NullEntityId);
else { else {