diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /src/Mobs/Creeper.cpp | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2 cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip |
Diffstat (limited to 'src/Mobs/Creeper.cpp')
-rw-r--r-- | src/Mobs/Creeper.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp index 0461bcc2a..7f8c6a3d7 100644 --- a/src/Mobs/Creeper.cpp +++ b/src/Mobs/Creeper.cpp @@ -76,20 +76,16 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer) AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); // If the creeper was killed by a skeleton, add a random music disc drop: - if ( - (a_Killer != nullptr) && - a_Killer->IsProjectile() && + if ((a_Killer != nullptr) && a_Killer->IsProjectile() && ((static_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID() != cEntity::INVALID_ID)) { auto ProjectileCreatorCallback = [](cEntity & a_Entity) - { - return ( - a_Entity.IsMob() && - ((static_cast<cMonster &>(a_Entity)).GetMobType() == mtSkeleton) - ); - }; - - if (GetWorld()->DoWithEntityByID(static_cast<cProjectileEntity *>(a_Killer)->GetCreatorUniqueID(), ProjectileCreatorCallback)) + { return (a_Entity.IsMob() && ((static_cast<cMonster &>(a_Entity)).GetMobType() == mtSkeleton)); }; + + if (GetWorld()->DoWithEntityByID( + static_cast<cProjectileEntity *>(a_Killer)->GetCreatorUniqueID(), + ProjectileCreatorCallback + )) { AddRandomDropItem(a_Drops, 1, 1, static_cast<short>(m_World->GetTickRandomNumber(11) + E_ITEM_FIRST_DISC)); } @@ -126,7 +122,12 @@ bool cCreeper::Attack(std::chrono::milliseconds a_Dt) if (!m_bIsBlowing) { - m_World->BroadcastSoundEffect("entity.creeper.primed", GetPosition(), 1.f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect( + "entity.creeper.primed", + GetPosition(), + 1.f, + (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64) + ); m_bIsBlowing = true; m_World->BroadcastEntityMetadata(*this); @@ -149,7 +150,12 @@ void cCreeper::OnRightClicked(cPlayer & a_Player) { a_Player.UseEquippedItem(); } - m_World->BroadcastSoundEffect("entity.creeper.primed", GetPosition(), 1.f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect( + "entity.creeper.primed", + GetPosition(), + 1.f, + (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64) + ); m_bIsBlowing = true; m_World->BroadcastEntityMetadata(*this); m_BurnedWithFlintAndSteel = true; |