As I found out, Gun Melee mod only works with standard weapons, but not with weapons added by mods. After some search and some help from #yaml@freenode.net I made a Perl script that makes a similar .rul file for every weapon of the types it knows. Currently it goes like this:
STR_PISTOLS
meleePower = 20;
tuMelee = 15;
accuracyMelee = 100;
STR_BOWS
meleePower = 20;
tuMelee = 15;
accuracyMelee = 100;
STR_SMGS
meleePower = 20;
tuMelee = 15;
accuracyMelee = 100;
STR_SHOTGUNS
meleePower = 50;
tuMelee = 40;
accuracyMelee = 100;
STR_RIFLES
meleePower = 50;
tuMelee = 40;
accuracyMelee = 100;
STR_SNIPER_RIFLES
meleePower = 50;
tuMelee = 40;
accuracyMelee = 100;
STR_CANNONS
meleePower = 65;
tuMelee = 50;
accuracyMelee = 100;
STR_MACHINE_GUNS
meleePower = 65;
tuMelee = 50;
accuracyMelee = 100;
STR_LAUNCHERS
meleePower = 80;
tuMelee = 80;
accuracyMelee = 100;
So far I have processed only items_XCOMFILES.rul for "The X-COM Files". Should I add weapons from other mods? Should I create separate melee mods for other large projects?
One problem so far: hitting enemies doesn't stun them, but kills.
Update: the script treated clips as weapons; fixed that.
Update 2: version for X-COM Files 0.9.1.