Xonotic Forums
.event_damage and .touch in projectile code - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10)
+--- Forum: Xonotic - Editing and Concept Art (https://forums.xonotic.org/forumdisplay.php?fid=11)
+--- Thread: .event_damage and .touch in projectile code (/showthread.php?tid=6316)



.event_damage and .touch in projectile code - dingus - 07-20-2016

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)?


RE: .event_damage and .touch in projectile code - aa - 07-20-2016

Projectiles can take damage for the purpose of being able to shot down on mid air


RE: .event_damage and .touch in projectile code - dingus - 07-21-2016

(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