mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
using weapon damage for explosion damage
removed unused nodamage parameter in CreateExplosion took projectile damage for explosion maxdamage replaced some 0s by false as it should be
This commit is contained in:
parent
c9bdc32fc0
commit
ee2d53b411
|
@ -160,7 +160,6 @@ class Weapons(Struct):
|
||||||
class Explosion(Struct):
|
class Explosion(Struct):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Struct.__init__(self, "CDataExplosion")
|
Struct.__init__(self, "CDataExplosion")
|
||||||
self.max_damage = Int(6)
|
|
||||||
self.radius = Float(135)
|
self.radius = Float(135)
|
||||||
self.max_force = Float(12)
|
self.max_force = Float(12)
|
||||||
|
|
||||||
|
@ -563,7 +562,7 @@ container.weapons.id.Add(weapon)
|
||||||
|
|
||||||
weapon = WeaponSpec(container, "grenade")
|
weapon = WeaponSpec(container, "grenade")
|
||||||
weapon.firedelay.Set(500) # TODO: fix this
|
weapon.firedelay.Set(500) # TODO: fix this
|
||||||
weapon.damage.Set(0)
|
weapon.damage.Set(6)
|
||||||
weapon.visual_size.Set(96)
|
weapon.visual_size.Set(96)
|
||||||
weapon.offsetx.Set(24)
|
weapon.offsetx.Set(24)
|
||||||
weapon.offsety.Set(-2)
|
weapon.offsety.Set(-2)
|
||||||
|
|
|
@ -334,7 +334,7 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos,
|
ProjStartPos,
|
||||||
Direction,
|
Direction,
|
||||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
|
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
|
||||||
g_pData->m_Weapons.m_Gun.m_pBase->m_Damage, 0, 0, -1, WEAPON_GUN);
|
g_pData->m_Weapons.m_Gun.m_pBase->m_Damage, false, 0, -1, WEAPON_GUN);
|
||||||
|
|
||||||
// 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;
|
||||||
|
@ -369,7 +369,7 @@ void CCharacter::FireWeapon()
|
||||||
ProjStartPos,
|
ProjStartPos,
|
||||||
vec2(cosf(a), sinf(a))*Speed,
|
vec2(cosf(a), sinf(a))*Speed,
|
||||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_ShotgunLifetime),
|
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_ShotgunLifetime),
|
||||||
g_pData->m_Weapons.m_Shotgun.m_pBase->m_Damage, 0, 0, -1, WEAPON_SHOTGUN);
|
g_pData->m_Weapons.m_Shotgun.m_pBase->m_Damage, false, 0, -1, WEAPON_SHOTGUN);
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
|
@ -74,7 +74,7 @@ void CProjectile::Tick()
|
||||||
GameServer()->CreateSound(CurPos, m_SoundImpact);
|
GameServer()->CreateSound(CurPos, m_SoundImpact);
|
||||||
|
|
||||||
if(m_Explosive)
|
if(m_Explosive)
|
||||||
GameServer()->CreateExplosion(CurPos, m_Owner, m_Weapon, false);
|
GameServer()->CreateExplosion(CurPos, m_Owner, m_Weapon, m_Damage);
|
||||||
|
|
||||||
else if(TargetChr)
|
else if(TargetChr)
|
||||||
TargetChr->TakeDamage(m_Direction * max(0.001f, m_Force), m_Damage, m_Owner, m_Weapon);
|
TargetChr->TakeDamage(m_Direction * max(0.001f, m_Force), m_Damage, m_Owner, m_Weapon);
|
||||||
|
|
|
@ -123,7 +123,7 @@ void CGameContext::CreateHammerHit(vec2 Pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage)
|
void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, int MaxDamage)
|
||||||
{
|
{
|
||||||
// create the event
|
// create the event
|
||||||
CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion));
|
CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion));
|
||||||
|
@ -133,14 +133,11 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
|
||||||
pEvent->m_Y = (int)Pos.y;
|
pEvent->m_Y = (int)Pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NoDamage)
|
|
||||||
{
|
|
||||||
// deal damage
|
// deal damage
|
||||||
CCharacter *apEnts[MAX_CLIENTS];
|
CCharacter *apEnts[MAX_CLIENTS];
|
||||||
float Radius = g_pData->m_Explosion.m_Radius;
|
float Radius = g_pData->m_Explosion.m_Radius;
|
||||||
float InnerRadius = 48.0f;
|
float InnerRadius = 48.0f;
|
||||||
float MaxForce = g_pData->m_Explosion.m_MaxForce;
|
float MaxForce = g_pData->m_Explosion.m_MaxForce;
|
||||||
int MaxDamage = g_pData->m_Explosion.m_MaxDamage;
|
|
||||||
int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
||||||
for(int i = 0; i < Num; i++)
|
for(int i = 0; i < Num; i++)
|
||||||
{
|
{
|
||||||
|
@ -150,12 +147,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
|
||||||
if(l)
|
if(l)
|
||||||
Force = normalize(Diff) * MaxForce;
|
Force = normalize(Diff) * MaxForce;
|
||||||
float Factor = 1 - clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
float Factor = 1 - clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
||||||
Force *= Factor;
|
apEnts[i]->TakeDamage(Force * Factor, (int)(Factor * MaxDamage), Owner, Weapon);
|
||||||
if(NoDamage)
|
|
||||||
apEnts[i]->TakeDamage(Force, 0, Owner, Weapon);
|
|
||||||
else
|
|
||||||
apEnts[i]->TakeDamage(Force, (int)(Factor * MaxDamage), Owner, Weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public:
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount);
|
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount);
|
||||||
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage);
|
void CreateExplosion(vec2 Pos, int Owner, int Weapon, int MaxDamage);
|
||||||
void CreateHammerHit(vec2 Pos);
|
void CreateHammerHit(vec2 Pos);
|
||||||
void CreatePlayerSpawn(vec2 Pos);
|
void CreatePlayerSpawn(vec2 Pos);
|
||||||
void CreateDeath(vec2 Pos, int Who);
|
void CreateDeath(vec2 Pos, int Who);
|
||||||
|
|
Loading…
Reference in a new issue