look at the old version of the Portal Gun (v8, not v9/v10) or either Gravity Gun for an example of a raycasting weapon
%ray = containerRayCast(%start,%end,%mask,%oneExemptObject);
if(%ray !$= "")
{
//Hit something!
%col = firstWord(%ray);
%pos = posFromRaycast(%ray);
%normal = normalFromRaycast(%ray);
}
%start and %end are the start and end points. Use %player.getMuzzlePoint(%slot) for the start and then add vectorScale(%player.getMuzzleVector(%slot),[range]) to get the end point.
For the mask, use the $TypeMasks::whateverObjectType variables. (look in console)
For more than one mask, separate them with | (bitwise OR) symbols. The Hammer might use something like this:
%mask = $TypeMasks::FxBrickObjectAlwaysType | //Targets the weapon can hit: All Bricks
$TypeMasks::PlayerObjectType | //AI/Players
$TypeMasks::StaticObjectType | //Static Shapes
$TypeMasks::TerrainObjectType | //Terrain
$TypeMasks::VehicleObjectType; //Vehicles
... and then check %col.getClassName() for what to do with the object.
The Exempt object might be the current player (firing player) so you can't hit yourself or something similar.