Just tossing an idea out there but maybe you could add a sort of "storage room" where the items in your inventory are put when you get TF'd into a form that makes you lose them.
Or (prefacing this with an I'm not knowledgeable on coding nor how this game is coded to run), you could still have the storage room but make it detect whether a key item (I.E the gun) has been picked up and whether it's in the player inventory. If it is then the gun doesn't spawn in the room, but if the gun has been picked up and isn't in the players inventory it spawns in.
Just an idea, maybe could add a TF in the area where you get turned into a rat or mouse or something (Like a play on Pack Rat), and are forced to tidy up the area as the minigame.