Slight issue here that ll my attempts to overcome have failed. Maybe someone else has an idea.

The problem is that currently there is nothing preventing one from attaching say, a grenade launcher, into the underbarrel location of the pistol crossbow. I have tried a few different if checks to no avail. Any ideas on the proper if check of gun id? I tried gun->id and guntype->id and neither trigger the if...