Getting ahead of @britzl, have you tried a Lua script to share the code between your objects?
I don't know your code but an idea would be something like (pseudocode):
on your scripts:
-- somewhere in the upper part of the script
local fire_trap = require('fire_trap')
if message.id == contact_point
if message.group == FIRE_TRAP