mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 17:44:18 +00:00
Fixed crazy shotgun bullets explosion collision when sv_hit = 0
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
b895547979
commit
22fc13c692
|
@ -336,16 +336,20 @@ void CCharacter::FireWeapon()
|
||||||
|
|
||||||
case WEAPON_GUN:
|
case WEAPON_GUN:
|
||||||
{
|
{
|
||||||
CProjectile *Proj = new CProjectile(GameWorld(), WEAPON_GUN,
|
CProjectile *Proj = new CProjectile
|
||||||
m_pPlayer->GetCID(),
|
(
|
||||||
ProjStartPos,
|
GameWorld(),
|
||||||
Direction,
|
WEAPON_GUN,//Type
|
||||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
|
m_pPlayer->GetCID(),//Owner
|
||||||
0,
|
ProjStartPos,//Pos
|
||||||
0,
|
Direction,//Dir
|
||||||
0,
|
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),//Span
|
||||||
-1,
|
0,//Freeze
|
||||||
WEAPON_GUN);
|
0,//Explosive
|
||||||
|
0,//Force
|
||||||
|
-1,//SoundImpact
|
||||||
|
WEAPON_GUN//Weapon
|
||||||
|
);
|
||||||
|
|
||||||
// pack the Projectile and send it to the client Directly
|
// pack the Projectile and send it to the client Directly
|
||||||
CNetObj_Projectile p;
|
CNetObj_Projectile p;
|
||||||
|
@ -399,15 +403,20 @@ void CCharacter::FireWeapon()
|
||||||
|
|
||||||
case WEAPON_GRENADE:
|
case WEAPON_GRENADE:
|
||||||
{
|
{
|
||||||
CProjectile *Proj = new CProjectile(GameWorld(), WEAPON_GRENADE,
|
CProjectile *Proj = new CProjectile
|
||||||
m_pPlayer->GetCID(),
|
(
|
||||||
ProjStartPos,
|
GameWorld(),
|
||||||
Direction,
|
WEAPON_GRENADE,//Type
|
||||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),
|
m_pPlayer->GetCID(),//Owner
|
||||||
0,
|
ProjStartPos,//Pos
|
||||||
true,
|
Direction,//Dir
|
||||||
0,
|
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),//Span
|
||||||
SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
|
0,//Freeze
|
||||||
|
true,//Explosive
|
||||||
|
0,//Force
|
||||||
|
SOUND_GRENADE_EXPLODE,//SoundImpact
|
||||||
|
WEAPON_GRENADE//Weapon
|
||||||
|
);//SoundImpact
|
||||||
|
|
||||||
// pack the Projectile and send it to the client Directly
|
// pack the Projectile and send it to the client Directly
|
||||||
CNetObj_Projectile p;
|
CNetObj_Projectile p;
|
||||||
|
|
|
@ -99,11 +99,11 @@ void CProjectile::Tick()
|
||||||
if(m_LifeSpan > -1)
|
if(m_LifeSpan > -1)
|
||||||
m_LifeSpan--;
|
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)))
|
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);
|
GameServer()->CreateSound(ColPos, m_SoundImpact);
|
||||||
}
|
}
|
||||||
else if(TargetChr && m_Freeze)
|
else if(TargetChr && m_Freeze)
|
||||||
|
|
|
@ -159,7 +159,9 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
||||||
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
|
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
|
||||||
{
|
{
|
||||||
float Deg = i*(pi/2);
|
float Deg = i*(pi/2);
|
||||||
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
|
CProjectile *bullet = new CProjectile
|
||||||
|
(
|
||||||
|
&GameServer()->m_World,
|
||||||
WEAPON_SHOTGUN, //Type
|
WEAPON_SHOTGUN, //Type
|
||||||
-1, //Owner
|
-1, //Owner
|
||||||
Pos, //Pos
|
Pos, //Pos
|
||||||
|
@ -167,9 +169,10 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
||||||
-2, //Span
|
-2, //Span
|
||||||
true, //Freeze
|
true, //Freeze
|
||||||
true, //Explosive
|
true, //Explosive
|
||||||
0,
|
0,//Force
|
||||||
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,
|
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,//SoundImpact
|
||||||
WEAPON_SHOTGUN);
|
WEAPON_SHOTGUN//Weapon
|
||||||
|
);
|
||||||
bullet->SetBouncing(2 - (i % 2));
|
bullet->SetBouncing(2 - (i % 2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue