Xonotic Forums

Full Version: .event_damage and .touch in projectile code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I was looking through the code for the different weapons and got confused by some of the properties of the projectiles. When either weapon spawns a projectile, it sets the following properties:

Code:
missile.takedamage = DAMAGE_YES;
missile.damageforcescale = WEP_CVAR(devastator, damageforcescale);
missile.health = WEP_CVAR(devastator, health);
missile.event_damage = W_Devastator_Damage;
missile.damagedbycontents = true;
...
missile.touch = W_Devastator_Touch;

What is the purpose for making projectiles take damage? Don't they only need a touch method? What is one method doing (W_Devastator_Damage) that the other isn't (W_Devastator_Touch)?
Projectiles can take damage for the purpose of being able to shot down on mid air
(07-20-2016, 10:58 PM)aa Wrote: [ -> ]Projectiles can take damage for the purpose of being able to shot down on mid air

Oh, ok. That makes sense. thanks for the help Smile