Now lights affects on all hitted characters as doors

This commit is contained in:
btd 2010-08-31 21:32:25 +04:00
parent 3264c57306
commit 2214a3cd0a
4 changed files with 9 additions and 8 deletions

View file

@ -8,6 +8,7 @@ class CTrigger;
class CDoor : public CEntity
{
vec2 m_To;
int m_ActivatedTeam;
int m_EvalTick;
bool m_Opened;
bool HitCharacter();

View file

@ -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);

View file

@ -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;
}

View file

@ -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;