diff options
Diffstat (limited to 'src/game/server/gamecontext.cpp')
| -rw-r--r-- | src/game/server/gamecontext.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 6f983855..fa36187b 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -138,6 +138,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag float Radius = 135.0f; float InnerRadius = 48.0f; int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); + bool someoneWasHit = false; for(int i = 0; i < Num; i++) { if(!limitVictims || victims[apEnts[i]->GetPlayer()->GetCID()]) @@ -150,9 +151,19 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag l = 1-clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f); float Dmg = 6 * l; if((int)Dmg) + { apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon); + someoneWasHit = true; + } } } + // give the owner the ammo back if he hit someone else or himself (like rocketjump) + if(someoneWasHit) + { + CCharacter *ownerChar = GetPlayerChar(Owner); + if(ownerChar) + ownerChar->GiveAmmo(Weapon, 1); + } } } |