Rewrite explosion knock back (#4251)
1. Base knockback on an entity's bounding box intersection with the explosion 2. Armor blast protection reduces knockback 3. Don't apply knockback to players flying in creative mode Fixes #4139
This commit is contained in:
committed by
peterbell10
parent
7b0db672d1
commit
01e72ddb65
@@ -3069,3 +3069,31 @@ float cPlayer::GetPlayerRelativeBlockHardness(BLOCKTYPE a_Block)
|
||||
// LOGD("blockHardness: %f, digSpeed: %f, canHarvestBlockDivisor: %f\n", blockHardness, digSpeed, canHarvestBlockDivisor);
|
||||
return (blockHardness < 0) ? 0 : ((digSpeed / blockHardness) / canHarvestBlockDivisor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
float cPlayer::GetExplosionExposureRate(Vector3d a_ExplosionPosition, float a_ExlosionPower)
|
||||
{
|
||||
if (
|
||||
IsGameModeSpectator() ||
|
||||
(IsGameModeCreative() && !IsOnGround())
|
||||
)
|
||||
{
|
||||
return 0; // No impact from explosion
|
||||
}
|
||||
|
||||
return super::GetExplosionExposureRate(a_ExplosionPosition, a_ExlosionPower);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user