diff options
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 12 | ||||
-rw-r--r-- | src/Entities/Pawn.cpp | 5 | ||||
-rw-r--r-- | src/Entities/SplashPotionEntity.cpp | 1 | ||||
-rw-r--r-- | src/Entities/SplashPotionEntity.h | 2 |
4 files changed, 14 insertions, 6 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 30aa87f37..6e1dec957 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1927,10 +1927,13 @@ void cEntity::AttachTo(cEntity * a_AttachTo) Detach(); } - // Attach to the new entity: + // Update state information m_AttachedTo = a_AttachTo; a_AttachTo->m_Attachee = this; - m_World->BroadcastAttachEntity(*this, a_AttachTo); + if (a_AttachTo != nullptr) + { + m_World->BroadcastAttachEntity(*this, *a_AttachTo); + } } @@ -1941,12 +1944,13 @@ void cEntity::Detach(void) { if (m_AttachedTo == nullptr) { - // Attached to no entity, our work is done + // Already not attached to any entity, our work is done return; } + m_World->BroadcastDetachEntity(*this, *m_AttachedTo); + m_AttachedTo->m_Attachee = nullptr; m_AttachedTo = nullptr; - m_World->BroadcastAttachEntity(*this, nullptr); } diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index 69c2db5e7..462fa5057 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -418,8 +418,9 @@ void cPawn::HandleFalling(void) TakeDamage(dtFalling, nullptr, Damage, Damage, 0); // Fall particles - int ParticleSize = static_cast<int>((std::min(15, Damage) - 1.f) * ((50.f - 20.f) / (15.f - 1.f)) + 20.f); - GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_FALL_PARTICLES, POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT, ParticleSize); + // TODO: Re-enable this when effects in 1.9 aren't broken (right now this uses the wrong effect ID in 1.9 and the right one in 1.8 and 1.7) + // int ParticleSize = static_cast<int>((std::min(15, Damage) - 1.f) * ((50.f - 20.f) / (15.f - 1.f)) + 20.f); + // GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_FALL_PARTICLES, POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT, ParticleSize); } m_bTouchGround = true; diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index e61df0525..af4008e83 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -80,6 +80,7 @@ cSplashPotionEntity::cSplashPotionEntity( const cItem & a_Item ) : super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25), + m_Item(a_Item), m_DestroyTimer(-1) { SetSpeed(a_Speed); diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index c9831ce88..85aa5046f 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -41,6 +41,7 @@ public: cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; } cEntityEffect GetEntityEffect(void) const { return m_EntityEffect; } int GetPotionColor(void) const { return m_PotionColor; } + const cItem & GetItem(void) const { return m_Item; } void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; } void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; } @@ -53,6 +54,7 @@ protected: cEntityEffect::eType m_EntityEffectType; cEntityEffect m_EntityEffect; int m_PotionColor; + cItem m_Item; // cProjectileEntity overrides: |