diff options
author | Pablo Beltrán <spekdrum@gmail.com> | 2017-06-04 06:35:02 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-06-04 06:35:02 +0200 |
commit | 2b699dc749b1827e47943f148f57dfe2e03f3a75 (patch) | |
tree | e743e2abe76e6c22a221f13648b26f4dda986dd4 /src/Entities/Pickup.cpp | |
parent | Add command line argument for disabling the logfile (diff) | |
download | cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.tar cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.tar.gz cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.tar.bz2 cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.tar.lz cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.tar.xz cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.tar.zst cuberite-2b699dc749b1827e47943f148f57dfe2e03f3a75.zip |
Diffstat (limited to 'src/Entities/Pickup.cpp')
-rw-r--r-- | src/Entities/Pickup.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index d88a47187..5f64d6fbe 100644 --- a/src/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp @@ -31,7 +31,7 @@ public: virtual bool Item(cEntity * a_Entity) override { ASSERT(a_Entity->IsTicking()); - if (!a_Entity->IsPickup() || (a_Entity->GetUniqueID() <= m_Pickup->GetUniqueID())) + if (!a_Entity->IsPickup() || (a_Entity->GetUniqueID() <= m_Pickup->GetUniqueID()) || !a_Entity->IsOnGround()) { return false; } @@ -59,6 +59,12 @@ public: if (Item.m_ItemCount <= 0) { + /* Experimental: show animation pickups getting together */ + int DiffX = FloorC(m_Pickup->GetPosX() * 32.0) - FloorC(EntityPos.x * 32.0); + int DiffY = FloorC(m_Pickup->GetPosY() * 32.0) - FloorC(EntityPos.y * 32.0); + int DiffZ = FloorC(m_Pickup->GetPosZ() * 32.0) - FloorC(EntityPos.z * 32.0); + a_Entity->GetWorld()->BroadcastEntityRelMove(*a_Entity, static_cast<char>(DiffX), static_cast<char>(DiffY), static_cast<char>(DiffZ)); + /* End of experimental animation */ a_Entity->Destroy(); } else @@ -159,7 +165,7 @@ void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } // Try to combine the pickup with adjacent same-item pickups: - if ((m_Item.m_ItemCount < m_Item.GetMaxStackSize())) // Don't combine if already full + if ((m_Item.m_ItemCount < m_Item.GetMaxStackSize()) && IsOnGround()) // Don't combine if already full or not on ground { // By using a_Chunk's ForEachEntity() instead of cWorld's, pickups don't combine across chunk boundaries. // That is a small price to pay for not having to traverse the entire world for each entity. |