Fix explosion issue. Dont pull, not tested. Can pull if test both commits=)

This commit is contained in:
btd 2010-11-11 12:12:03 +03:00
parent 748065dbcf
commit cd59d111a8
4 changed files with 6 additions and 5 deletions

View file

@ -36,7 +36,7 @@ bool CPlasma::HitCharacter()
if(Hit->Team() != m_ResponsibleTeam) return false;
m_Freeze ? Hit->Freeze(Server()->TickSpeed()*3) : Hit->UnFreeze();
if(m_Explosive)
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true, Hit->Teams()->TeamMask(m_ResponsibleTeam));
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true, m_ResponsibleTeam, Hit->Teams()->TeamMask(m_ResponsibleTeam));
GameServer()->m_World.DestroyEntity(this);
return true;
}
@ -68,7 +68,7 @@ void CPlasma::Tick()
if(Res)
{
if(m_Explosive)
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true);
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true, m_ResponsibleTeam, -1);//TODO: Fix mask
Reset();
}

View file

@ -118,7 +118,7 @@ void CProjectile::Tick()
{
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
{
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, m_Owner == -1,
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, m_Owner == -1, TargetChr->Team(),
(m_Owner != -1)? TeamMask : -1);
GameServer()->CreateSound(ColPos, m_SoundImpact,
(m_Owner != -1)? TeamMask : -1);

View file

@ -120,7 +120,7 @@ void CGameContext::CreateHammerHit(vec2 P, int Mask)
}
void CGameContext::CreateExplosion(vec2 P, int Owner, int Weapon, bool NoDamage, int Mask)
void CGameContext::CreateExplosion(vec2 P, int Owner, int Weapon, bool NoDamage, int ActivatedTeam,int Mask)
{
// create the event
NETEVENT_EXPLOSION *ev = (NETEVENT_EXPLOSION *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(NETEVENT_EXPLOSION), Mask);
@ -150,6 +150,7 @@ void CGameContext::CreateExplosion(vec2 P, int Owner, int Weapon, bool NoDamage,
if((g_Config.m_SvHit||NoDamage) || Owner == apEnts[i]->m_pPlayer->GetCID())
{
if(Owner != -1 && apEnts[i]->m_Alive && !apEnts[i]->CanCollide(Owner)) continue;
if(Owner == -1 && apEnts[i]->m_Alive && apEnts[i]->Team() != ActivatedTeam) continue;
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
if(!g_Config.m_SvHit||NoDamage) break;
}

View file

@ -191,7 +191,7 @@ public:
// helper functions
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int Mask=-1);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int Mask=-1);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int Mask);
void CreateSmoke(vec2 Pos, int Mask=-1);
void CreateHammerHit(vec2 Pos, int Mask=-1);
void CreatePlayerSpawn(vec2 Pos, int Mask=-1);