summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRorkh <78957156+Rorkh@users.noreply.github.com>2021-08-04 10:58:54 +0200
committerGitHub <noreply@github.com>2021-08-04 10:58:54 +0200
commit383867b6b0d139ea696f1638623b6011ad0f6e46 (patch)
treeacb45b05394b8c7f96c388c6c3e290547cffe2b1 /src
parentRemove one level of indent in statistics serialiser (diff)
downloadcuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.tar
cuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.tar.gz
cuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.tar.bz2
cuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.tar.lz
cuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.tar.xz
cuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.tar.zst
cuberite-383867b6b0d139ea696f1638623b6011ad0f6e46.zip
Diffstat (limited to 'src')
-rw-r--r--src/Entities/Pawn.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index ed26a080b..a1c3a7610 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -423,20 +423,27 @@ void cPawn::HandleFalling(void)
Damage = static_cast<int>(static_cast<float>(Damage) * 0.33);
}
- TakeDamage(dtFalling, nullptr, Damage, static_cast<float>(Damage), 0);
-
// Fall particles:
if (const auto Below = POS_TOINT.addedY(-1); Below.y >= 0)
{
+ const auto BlockBelow = GetWorld()->GetBlock(Below);
+
+ if (BlockBelow == E_BLOCK_HAY_BALE)
+ {
+ Damage = std::clamp(static_cast<int>(static_cast<float>(Damage) * 0.2), 1, 20);
+ }
+
GetWorld()->BroadcastParticleEffect(
"blockdust",
GetPosition(),
{ 0, 0, 0 },
(Damage - 1.f) * ((0.3f - 0.1f) / (15.f - 1.f)) + 0.1f, // Map damage (1 - 15) to particle speed (0.1 - 0.3)
static_cast<int>((Damage - 1.f) * ((50.f - 20.f) / (15.f - 1.f)) + 20.f), // Map damage (1 - 15) to particle quantity (20 - 50)
- { { GetWorld()->GetBlock(Below), 0 } }
+ { { BlockBelow, 0 } }
);
}
+
+ TakeDamage(dtFalling, nullptr, Damage, static_cast<float>(Damage), 0);
}
m_bTouchGround = true;