10-07-2012, 06:14 AM
Poke-poke. I'm still planning on coding this feature and quite excited about it, but waiting on more input so far. The latest plans for my approach are as follows:
1 - Make a new qc file and move all attack functions and projectile code there, from all weapon files (simply relocate the code without modifying it). eg: If the shotgun's primary attack is located in w_shotgun.qc in a function called Attack1() which is called when you press fire1, move that to projectiles.qc as Shotgun_Attack1, and have the code in w_shotgun.qc call that function when primary fire is pressed.
2 - Once that's done for all weapons, I'll merge all attacks that can be combined into single functions with neutral names that take parameters. eg: If the crylink primary and hagar secondary use the same projectile pattern to spawn projectiles, combine the code that spawns both. While the laser primary and electro primary should be able to use the same function with different effects. The end point is any projectile logic being customizable and reusable.
3 - Turn how each weapon spawns and uses projectiles into cvars, which define what function they address and how. This adds additional cvars to all weapons in balance.cfg specifying hitscan or splash damage, the projectile pattern, the projectile model and sounds to use, etc.
I'd like to hear more about what others think of this approach and if I should use a different method here. But please refrain from comments such as "It won't happen because it's too much work and it will be hard for us to maintain". If no one else volunteers, I'll be doing all the work. As for it being hard to maintain, quite the contrary... there will be less code in one file instead of each weapon's file containing those logics (some repetitive), while it should not require any special maintenance once it's ready. The feature won't affect those who don't care about it, just help a huge amount with modding and custom configurations.
1 - Make a new qc file and move all attack functions and projectile code there, from all weapon files (simply relocate the code without modifying it). eg: If the shotgun's primary attack is located in w_shotgun.qc in a function called Attack1() which is called when you press fire1, move that to projectiles.qc as Shotgun_Attack1, and have the code in w_shotgun.qc call that function when primary fire is pressed.
2 - Once that's done for all weapons, I'll merge all attacks that can be combined into single functions with neutral names that take parameters. eg: If the crylink primary and hagar secondary use the same projectile pattern to spawn projectiles, combine the code that spawns both. While the laser primary and electro primary should be able to use the same function with different effects. The end point is any projectile logic being customizable and reusable.
3 - Turn how each weapon spawns and uses projectiles into cvars, which define what function they address and how. This adds additional cvars to all weapons in balance.cfg specifying hitscan or splash damage, the projectile pattern, the projectile model and sounds to use, etc.
I'd like to hear more about what others think of this approach and if I should use a different method here. But please refrain from comments such as "It won't happen because it's too much work and it will be hard for us to maintain". If no one else volunteers, I'll be doing all the work. As for it being hard to maintain, quite the contrary... there will be less code in one file instead of each weapon's file containing those logics (some repetitive), while it should not require any special maintenance once it's ready. The feature won't affect those who don't care about it, just help a huge amount with modding and custom configurations.
