From 2214a3cd0ae019de409d4918ef590f6605722445 Mon Sep 17 00:00:00 2001 From: btd Date: Tue, 31 Aug 2010 21:32:25 +0400 Subject: [PATCH] Now lights affects on all hitted characters as doors --- src/game/server/entities/door.h | 1 + src/game/server/entities/gun.cpp | 4 +--- src/game/server/entities/light.cpp | 10 ++++++---- src/game/server/gamecontext.cpp | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/game/server/entities/door.h b/src/game/server/entities/door.h index 15b6fea6e..b904d1c14 100644 --- a/src/game/server/entities/door.h +++ b/src/game/server/entities/door.h @@ -8,6 +8,7 @@ class CTrigger; class CDoor : public CEntity { vec2 m_To; + int m_ActivatedTeam; int m_EvalTick; bool m_Opened; bool HitCharacter(); diff --git a/src/game/server/entities/gun.cpp b/src/game/server/entities/gun.cpp index a5d99efef..b4add3186 100644 --- a/src/game/server/entities/gun.cpp +++ b/src/game/server/entities/gun.cpp @@ -41,9 +41,7 @@ void CGun::Fire() for (int i = 0; i < Num; i++) { CCharacter *Target = Ents[i]; - int res=0; - vec2 coltile; - res = GameServer()->Collision()->IntersectLine(m_Pos, Target->m_Pos,0,0,false); + int res = GameServer()->Collision()->IntersectLine(m_Pos, Target->m_Pos,0,0,false); if (!res) { int Len=length(Target->m_Pos - m_Pos); diff --git a/src/game/server/entities/light.cpp b/src/game/server/entities/light.cpp index a522d5cbc..d65c6f2fb 100644 --- a/src/game/server/entities/light.cpp +++ b/src/game/server/entities/light.cpp @@ -28,10 +28,12 @@ CLight::CLight(CGameWorld *pGameWorld, vec2 pos, float rotation, int length) bool CLight::hit_character() { vec2 nothing; - CCharacter *hit = GameServer()->m_World.IntersectCharacter(m_Pos, to, 0.0f, nothing, 0); - if(!hit) - return false; - hit->Freeze(Server()->TickSpeed()*3); + std::list < CCharacter * > hittedCharacters = GameServer()->m_World.IntersectedCharacters(m_Pos, to, 0.0f, nothing, 0); + if(hittedCharacters.empty()) return false; + for(std::list < CCharacter * >::iterator i = hittedCharacters.begin(); i != hittedCharacters.end(); i++) { + CCharacter * Char = *i; + Char->Freeze(Server()->TickSpeed()*3); + } return true; } diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 4ae65ee61..d6e919d27 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -145,7 +145,7 @@ void CGameContext::CreateExplosion(vec2 p, int Owner, int Weapon, bool NoDamage) float Dmg = 6 * l; if((int)Dmg) if((g_Config.m_SvHit||NoDamage) || Owner == apEnts[i]->m_pPlayer->GetCID()) - { + {//TODO: Change which explosion affects only on one team if(Owner != -1 && apEnts[i]->m_Alive && apEnts[i]->Team() != GetPlayerChar(Owner)->Team()) continue; apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon); if(!g_Config.m_SvHit||NoDamage) break;