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

summaryrefslogtreecommitdiff
path: root/source/game
diff options
context:
space:
mode:
Diffstat (limited to 'source/game')
-rw-r--r--source/game/StarItemDrop.cpp4
-rw-r--r--source/game/StarItemDrop.hpp2
-rw-r--r--source/game/StarWorldClient.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/source/game/StarItemDrop.cpp b/source/game/StarItemDrop.cpp
index 8114de4..3ff0d37 100644
--- a/source/game/StarItemDrop.cpp
+++ b/source/game/StarItemDrop.cpp
@@ -300,10 +300,10 @@ bool ItemDrop::canTake() const {
return m_mode.get() == Mode::Available && m_owningEntity.get() == NullEntityId && !m_item->empty();
}
-ItemPtr ItemDrop::takeBy(EntityId entityId) {
+ItemPtr ItemDrop::takeBy(EntityId entityId, float timeOffset) {
if (canTake()) {
m_owningEntity.set(entityId);
- m_dropAge.setElapsedTime(0.0);
+ m_dropAge.setElapsedTime(timeOffset);
m_mode.set(Mode::Taken);
setPersistent(false);
diff --git a/source/game/StarItemDrop.hpp b/source/game/StarItemDrop.hpp
index e72878c..54114fb 100644
--- a/source/game/StarItemDrop.hpp
+++ b/source/game/StarItemDrop.hpp
@@ -70,7 +70,7 @@ public:
// Mark this drop as taken by the given entity. The drop will animate
// towards them for a while and then disappear.
- ItemPtr takeBy(EntityId entityId);
+ ItemPtr takeBy(EntityId entityId, float timeOffset = 0.0f);
// Mark this drop as taken, but do not animate it towards a player simply
// disappear next step.
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp
index de324ad..17a1996 100644
--- a/source/game/StarWorldClient.cpp
+++ b/source/game/StarWorldClient.cpp
@@ -1126,7 +1126,7 @@ void WorldClient::update(float dt) {
if (itemDrop->canTake() && !m_requestedDrops.contains(itemDrop->entityId()) && distSquared < square(DropDist)) {
m_requestedDrops.add(itemDrop->entityId());
if (m_mainPlayer->itemsCanHold(itemDrop->item()) != 0) {
- itemDrop->takeBy(m_mainPlayer->entityId());
+ itemDrop->takeBy(m_mainPlayer->entityId(), (float)m_latency / 1000);
m_outgoingPackets.append(make_shared<RequestDropPacket>(itemDrop->entityId()));
}
}