Fixed crazy shotgun bullets explosion collision when sv_hit = 0

Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
GreYFoXGTi 2010-08-29 04:24:43 +02:00
parent b895547979
commit 22fc13c692
3 changed files with 37 additions and 25 deletions

View file

@ -336,16 +336,20 @@ void CCharacter::FireWeapon()
case WEAPON_GUN:
{
CProjectile *Proj = new CProjectile(GameWorld(), WEAPON_GUN,
m_pPlayer->GetCID(),
ProjStartPos,
Direction,
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
0,
0,
0,
-1,
WEAPON_GUN);
CProjectile *Proj = new CProjectile
(
GameWorld(),
WEAPON_GUN,//Type
m_pPlayer->GetCID(),//Owner
ProjStartPos,//Pos
Direction,//Dir
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),//Span
0,//Freeze
0,//Explosive
0,//Force
-1,//SoundImpact
WEAPON_GUN//Weapon
);
// pack the Projectile and send it to the client Directly
CNetObj_Projectile p;
@ -399,15 +403,20 @@ void CCharacter::FireWeapon()
case WEAPON_GRENADE:
{
CProjectile *Proj = new CProjectile(GameWorld(), WEAPON_GRENADE,
m_pPlayer->GetCID(),
ProjStartPos,
Direction,
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),
0,
true,
0,
SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
CProjectile *Proj = new CProjectile
(
GameWorld(),
WEAPON_GRENADE,//Type
m_pPlayer->GetCID(),//Owner
ProjStartPos,//Pos
Direction,//Dir
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),//Span
0,//Freeze
true,//Explosive
0,//Force
SOUND_GRENADE_EXPLODE,//SoundImpact
WEAPON_GRENADE//Weapon
);//SoundImpact
// pack the Projectile and send it to the client Directly
CNetObj_Projectile p;

View file

@ -99,11 +99,11 @@ void CProjectile::Tick()
if(m_LifeSpan > -1)
m_LifeSpan--;
if( (TargetChr && (g_Config.m_SvHit || TargetChr == OwnerChar)) || Collide)
if( (TargetChr && ((g_Config.m_SvHit || m_Owner == -1) || TargetChr == OwnerChar)) || Collide)
{
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
{
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, false);
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, (m_Owner == -1)?true:false);
GameServer()->CreateSound(ColPos, m_SoundImpact);
}
else if(TargetChr && m_Freeze)

View file

@ -159,7 +159,9 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
{
float Deg = i*(pi/2);
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
CProjectile *bullet = new CProjectile
(
&GameServer()->m_World,
WEAPON_SHOTGUN, //Type
-1, //Owner
Pos, //Pos
@ -167,9 +169,10 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
-2, //Span
true, //Freeze
true, //Explosive
0,
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,
WEAPON_SHOTGUN);
0,//Force
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,//SoundImpact
WEAPON_SHOTGUN//Weapon
);
bullet->SetBouncing(2 - (i % 2));
}