diff options
| -rw-r--r-- | src/game/server/entities/character.cpp | 4 | ||||
| -rw-r--r-- | src/game/server/entities/projectile.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/entity.cpp | 6 | ||||
| -rw-r--r-- | src/game/server/entity.h | 7 |
4 files changed, 11 insertions, 8 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 03e409cd..2c1828da 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -489,7 +489,9 @@ void CCharacter::FireWeapon() CNetObj_Projectile p; pProj->FillInfo(&p); - pProj->SetCharactersNearby(); + pProj->InitAffectedCharacters(); + if(m_Core.m_HookedPlayer >= 0) + pProj->SetAffectedCharacter(m_Core.m_HookedPlayer); CMsgPacker Msg(NETMSGTYPE_SV_EXTRAPROJECTILE); Msg.AddInt(1); diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index d9654a58..3901d50a 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -73,7 +73,7 @@ void CProjectile::Tick() GameServer()->CreateSound(CurPos, m_SoundImpact); if(m_Explosive) - GameServer()->CreateExplosion(CurPos, m_Owner, m_Weapon, false, m_CharactersNearbyInitialized, m_CharactersNearby); + GameServer()->CreateExplosion(CurPos, m_Owner, m_Weapon, false, m_AffectedCharactersInitialized, m_AffectedCharacters); else if(TargetChr) TargetChr->TakeDamage(m_Direction * max(0.001f, m_Force), m_Damage, m_Owner, m_Weapon); diff --git a/src/game/server/entity.cpp b/src/game/server/entity.cpp index 3fae22f2..7c2a97e8 100644 --- a/src/game/server/entity.cpp +++ b/src/game/server/entity.cpp @@ -55,11 +55,11 @@ bool CEntity::GameLayerClipped(vec2 CheckPos) round(CheckPos.y)/32 < -200 || round(CheckPos.y)/32 > GameServer()->Collision()->GetHeight()+200 ? true : false; } -void CEntity::SetCharactersNearby() +void CEntity::InitAffectedCharacters() { CCharacter *c; for(int i = 0; i < MAX_CLIENTS; ++i) if((c = GameServer()->GetPlayerChar(i))) - m_CharactersNearby[i] = (absolute(c->m_Pos.x - m_Pos.x) <= 900.0f && absolute(c->m_Pos.y - m_Pos.y) <= 700.0f && distance(c->m_Pos, m_Pos) <= 900.0f); - m_CharactersNearbyInitialized = true; + m_AffectedCharacters[i] = (absolute(c->m_Pos.x - m_Pos.x) <= 900.0f && absolute(c->m_Pos.y - m_Pos.y) <= 700.0f && distance(c->m_Pos, m_Pos) <= 900.0f); + m_AffectedCharactersInitialized = true; } diff --git a/src/game/server/entity.h b/src/game/server/entity.h index 7abf76c9..ca2faf38 100644 --- a/src/game/server/entity.h +++ b/src/game/server/entity.h @@ -156,9 +156,10 @@ public: vec2 m_Pos; // nearby characters - bool m_CharactersNearbyInitialized; - bool m_CharactersNearby[MAX_CLIENTS]; - void SetCharactersNearby(); + bool m_AffectedCharactersInitialized; + bool m_AffectedCharacters[MAX_CLIENTS]; + void InitAffectedCharacters(); + void SetAffectedCharacter(int i) { m_AffectedCharacters[i] = true; } }; #endif |