diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-04-02 09:29:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 09:29:42 +0200 |
commit | 59e38d1a46101252e684e9514bdb912e3e030fec (patch) | |
tree | f9238350265272e8840f3ccb7bcd9bef6cd30386 /src/ChunkMap.cpp | |
parent | Oops, that wasn't supposed to be negated (diff) | |
download | cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.gz cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.bz2 cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.lz cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.xz cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.tar.zst cuberite-59e38d1a46101252e684e9514bdb912e3e030fec.zip |
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r-- | src/ChunkMap.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index f2c0cf59f..fdaf7390d 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1313,18 +1313,19 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ a_Entity.TakeDamage(dtExplosion, nullptr, static_cast<int>((1 / std::max(1.0, DistanceFromExplosion.Length())) * 8 * ExplosionSizeInt), 0); } - double Length = DistanceFromExplosion.Length(); - if (Length <= ExplosionSizeInt) // Entity is impacted by explosion - { - float EntityExposure = a_Entity.GetExplosionExposureRate(ExplosionPos, static_cast<float>(a_ExplosionSize)); + float EntityExposure = a_Entity.GetExplosionExposureRate(ExplosionPos, static_cast<float>(a_ExplosionSize)); - // Exposure reduced by armor - EntityExposure = EntityExposure * (1.0f - a_Entity.GetEnchantmentBlastKnockbackReduction()); + // Exposure reduced by armor + EntityExposure = EntityExposure * (1.0f - a_Entity.GetEnchantmentBlastKnockbackReduction()); - double Impact = (1 - ((Length / ExplosionSizeInt) / 2)) * EntityExposure; + auto Impact = std::pow(std::max(0.2, DistanceFromExplosion.Length()), -1); + Impact *= EntityExposure * ExplosionSizeInt * 6.0; + if (Impact > 0.0) + { DistanceFromExplosion.Normalize(); - DistanceFromExplosion *= Impact; + DistanceFromExplosion *= Vector3d{Impact, 0.0, Impact}; + DistanceFromExplosion.y += 0.3 * Impact; a_Entity.SetSpeed(DistanceFromExplosion); } @@ -2315,8 +2316,3 @@ void cChunkMap::DelChunkStay(cChunkStay & a_ChunkStay) } // for itr - Chunks[] a_ChunkStay.OnDisabled(); } - - - - - |