$ctx returns the context where the object was created. this.$ctx() returns the scope through which you can access the global variables, the same ones that you'd normally access without any $ctx call. Hence, it makes no sense to use it on this, but only on references to other objects that you obtained, if you want to access their globals.
Note all this temporary and will likely go away, as it's no good usage pattern to have scripts accessing stuff arbitrarily.
///Test if ray from model hits an object
//@param pos model-space position
//@param dir model-space ray direction
//@param maxdist max ray distance to check (keep short if possible)
//@param exclude_self true if ray should not hit origin body
//@param joint [optional] bone id to be relative to (with pos, rot arguments)
//@return {$ret: object hit, norm: hit surface normal vector, hitpoint: world position}
function object_test( pos, dir, maxdist, exclude_self, joint)
add_weapon is a dummy, does nothing yet.