mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
cleaned up weapon value locations
removed laser damage tuning added explosion values in content.py made explosion force independent from damage linked all weapon damage values to content.py linked all weapon max ammo values to content.py stopped regenerating infinite ammo removed m_Ammocost in CCharacter
This commit is contained in:
parent
fe49818093
commit
c9bdc32fc0
|
@ -157,6 +157,13 @@ class Weapons(Struct):
|
|||
self.ninja = Weapon_Ninja()
|
||||
self.id = Array(WeaponSpec())
|
||||
|
||||
class Explosion(Struct):
|
||||
def __init__(self):
|
||||
Struct.__init__(self, "CDataExplosion")
|
||||
self.max_damage = Int(6)
|
||||
self.radius = Float(135)
|
||||
self.max_force = Float(12)
|
||||
|
||||
class DataContainer(Struct):
|
||||
def __init__(self):
|
||||
Struct.__init__(self, "CDataContainer")
|
||||
|
@ -167,6 +174,7 @@ class DataContainer(Struct):
|
|||
self.sprites = Array(Sprite())
|
||||
self.animations = Array(Animation())
|
||||
self.weapons = Weapons()
|
||||
self.explosion = Explosion()
|
||||
|
||||
def FileList(format, num):
|
||||
return [format%(x+1) for x in range(0,num)]
|
||||
|
@ -532,6 +540,7 @@ container.weapons.id.Add(weapon)
|
|||
|
||||
weapon = WeaponSpec(container, "gun")
|
||||
weapon.firedelay.Set(125)
|
||||
weapon.damage.Set(1)
|
||||
weapon.ammoregentime.Set(500)
|
||||
weapon.visual_size.Set(64)
|
||||
weapon.offsetx.Set(32)
|
||||
|
@ -543,6 +552,7 @@ container.weapons.id.Add(weapon)
|
|||
|
||||
weapon = WeaponSpec(container, "shotgun")
|
||||
weapon.firedelay.Set(500)
|
||||
weapon.damage.Set(1)
|
||||
weapon.visual_size.Set(96)
|
||||
weapon.offsetx.Set(24)
|
||||
weapon.offsety.Set(-2)
|
||||
|
@ -553,6 +563,7 @@ container.weapons.id.Add(weapon)
|
|||
|
||||
weapon = WeaponSpec(container, "grenade")
|
||||
weapon.firedelay.Set(500) # TODO: fix this
|
||||
weapon.damage.Set(0)
|
||||
weapon.visual_size.Set(96)
|
||||
weapon.offsetx.Set(24)
|
||||
weapon.offsety.Set(-2)
|
||||
|
@ -561,8 +572,8 @@ container.weapons.id.Add(weapon)
|
|||
|
||||
weapon = WeaponSpec(container, "laser")
|
||||
weapon.firedelay.Set(800)
|
||||
weapon.visual_size.Set(92)
|
||||
weapon.damage.Set(5)
|
||||
weapon.visual_size.Set(92)
|
||||
weapon.offsetx.Set(24)
|
||||
weapon.offsety.Set(-2)
|
||||
container.weapons.laser.base.Set(weapon)
|
||||
|
|
|
@ -334,7 +334,7 @@ void CCharacter::FireWeapon()
|
|||
ProjStartPos,
|
||||
Direction,
|
||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
|
||||
1, 0, 0, -1, WEAPON_GUN);
|
||||
g_pData->m_Weapons.m_Gun.m_pBase->m_Damage, 0, 0, -1, WEAPON_GUN);
|
||||
|
||||
// pack the Projectile and send it to the client Directly
|
||||
CNetObj_Projectile p;
|
||||
|
@ -369,7 +369,7 @@ void CCharacter::FireWeapon()
|
|||
ProjStartPos,
|
||||
vec2(cosf(a), sinf(a))*Speed,
|
||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_ShotgunLifetime),
|
||||
1, 0, 0, -1, WEAPON_SHOTGUN);
|
||||
g_pData->m_Weapons.m_Shotgun.m_pBase->m_Damage, 0, 0, -1, WEAPON_SHOTGUN);
|
||||
|
||||
// pack the Projectile and send it to the client Directly
|
||||
CNetObj_Projectile p;
|
||||
|
@ -391,7 +391,7 @@ void CCharacter::FireWeapon()
|
|||
ProjStartPos,
|
||||
Direction,
|
||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),
|
||||
1, true, 0, SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
|
||||
g_pData->m_Weapons.m_Grenade.m_pBase->m_Damage, true, 0, SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
|
||||
|
||||
// pack the Projectile and send it to the client Directly
|
||||
CNetObj_Projectile p;
|
||||
|
@ -452,7 +452,7 @@ void CCharacter::HandleWeapons()
|
|||
|
||||
// ammo regen
|
||||
int AmmoRegenTime = g_pData->m_Weapons.m_aId[m_ActiveWeapon].m_Ammoregentime;
|
||||
if(AmmoRegenTime)
|
||||
if(AmmoRegenTime && m_aWeapons[m_ActiveWeapon].m_Ammo >= 0)
|
||||
{
|
||||
// If equipped and not active, regen ammo?
|
||||
if (m_ReloadTimer <= 0)
|
||||
|
@ -463,7 +463,8 @@ void CCharacter::HandleWeapons()
|
|||
if ((Server()->Tick() - m_aWeapons[m_ActiveWeapon].m_AmmoRegenStart) >= AmmoRegenTime * Server()->TickSpeed() / 1000)
|
||||
{
|
||||
// Add some ammo
|
||||
m_aWeapons[m_ActiveWeapon].m_Ammo = min(m_aWeapons[m_ActiveWeapon].m_Ammo + 1, 10);
|
||||
m_aWeapons[m_ActiveWeapon].m_Ammo = min(m_aWeapons[m_ActiveWeapon].m_Ammo + 1,
|
||||
g_pData->m_Weapons.m_aId[m_ActiveWeapon].m_Maxammo);
|
||||
m_aWeapons[m_ActiveWeapon].m_AmmoRegenStart = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ private:
|
|||
{
|
||||
int m_AmmoRegenStart;
|
||||
int m_Ammo;
|
||||
int m_Ammocost;
|
||||
bool m_Got;
|
||||
|
||||
} m_aWeapons[NUM_WEAPONS];
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#include <game/generated/server_data.h>
|
||||
#include <game/server/gamecontext.h>
|
||||
|
||||
#include "character.h"
|
||||
|
@ -30,7 +31,7 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
|
|||
m_From = From;
|
||||
m_Pos = At;
|
||||
m_Energy = -1;
|
||||
pHit->TakeDamage(vec2(0.f, 0.f), GameServer()->Tuning()->m_LaserDamage, m_Owner, WEAPON_LASER);
|
||||
pHit->TakeDamage(vec2(0.f, 0.f), g_pData->m_Weapons.m_aId[WEAPON_LASER].m_Damage, m_Owner, WEAPON_LASER);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void CPickup::Tick()
|
|||
break;
|
||||
|
||||
case PICKUP_GRENADE:
|
||||
if(pChr->GiveWeapon(WEAPON_GRENADE, 10))
|
||||
if(pChr->GiveWeapon(WEAPON_GRENADE, g_pData->m_Weapons.m_aId[WEAPON_GRENADE].m_Maxammo))
|
||||
{
|
||||
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_GRENADE);
|
||||
|
@ -76,7 +76,7 @@ void CPickup::Tick()
|
|||
}
|
||||
break;
|
||||
case PICKUP_SHOTGUN:
|
||||
if(pChr->GiveWeapon(WEAPON_SHOTGUN, 10))
|
||||
if(pChr->GiveWeapon(WEAPON_SHOTGUN, g_pData->m_Weapons.m_aId[WEAPON_SHOTGUN].m_Maxammo))
|
||||
{
|
||||
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
|
||||
|
@ -85,7 +85,7 @@ void CPickup::Tick()
|
|||
}
|
||||
break;
|
||||
case PICKUP_LASER:
|
||||
if(pChr->GiveWeapon(WEAPON_LASER, 10))
|
||||
if(pChr->GiveWeapon(WEAPON_LASER, g_pData->m_Weapons.m_aId[WEAPON_LASER].m_Maxammo))
|
||||
{
|
||||
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <engine/shared/memheap.h>
|
||||
#include <engine/map.h>
|
||||
|
||||
#include <game/generated/server_data.h>
|
||||
#include <game/collision.h>
|
||||
#include <game/gamecore.h>
|
||||
#include <game/version.h>
|
||||
|
@ -136,20 +137,24 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
|
|||
{
|
||||
// deal damage
|
||||
CCharacter *apEnts[MAX_CLIENTS];
|
||||
float Radius = 135.0f;
|
||||
float Radius = g_pData->m_Explosion.m_Radius;
|
||||
float InnerRadius = 48.0f;
|
||||
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);
|
||||
for(int i = 0; i < Num; i++)
|
||||
{
|
||||
vec2 Diff = apEnts[i]->m_Pos - Pos;
|
||||
vec2 ForceDir(0,1);
|
||||
vec2 Force(0, MaxForce);
|
||||
float l = length(Diff);
|
||||
if(l)
|
||||
ForceDir = normalize(Diff);
|
||||
l = 1-clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
||||
float Dmg = 6 * l;
|
||||
if((int)Dmg)
|
||||
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
||||
Force = normalize(Diff) * MaxForce;
|
||||
float Factor = 1 - clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
||||
Force *= Factor;
|
||||
if(NoDamage)
|
||||
apEnts[i]->TakeDamage(Force, 0, Owner, Weapon);
|
||||
else
|
||||
apEnts[i]->TakeDamage(Force, (int)(Factor * MaxDamage), Owner, Weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ MACRO_TUNING_PARAM(LaserReach, laser_reach, 800.0f)
|
|||
MACRO_TUNING_PARAM(LaserBounceDelay, laser_bounce_delay, 150)
|
||||
MACRO_TUNING_PARAM(LaserBounceNum, laser_bounce_num, 1)
|
||||
MACRO_TUNING_PARAM(LaserBounceCost, laser_bounce_cost, 0)
|
||||
MACRO_TUNING_PARAM(LaserDamage, laser_damage, 5)
|
||||
|
||||
MACRO_TUNING_PARAM(PlayerCollision, player_collision, 1)
|
||||
MACRO_TUNING_PARAM(PlayerHooking, player_hooking, 1)
|
||||
|
|
Loading…
Reference in a new issue