This function returns an array of room pointers for rooms that are found within the requested @radius of the @source. The @source may be the ID of a room or a pointer to a room, mobile, or item. Flags may be set to determine specific rules for room traversal. For instance, by default the room of origin is NOT included but this can be changed by setting the "includeOrigin" flag. Following is a list of currently supported flags:
includeOrigin - include the origin room in the results allowNoDirection - traverse exits flagged as noDirection allowSecret - traverse exits flagged as secret allowClosed - traverse closed doors allowDeathtrap - include deathtrap rooms
Example:
// // Teleport mob to a random room within a 5 room radius of a target. //
@flags = %array( includeOrigin, allowClosed ) @rooms = %roomGetRadiusRooms( @victim, 5, @flags )
if( @rooms ) { @destination = %arrayShuffle( @rooms )->1
%nact( "$n suddenly disappears.", \ 1, @n, null, null, skipActor );
%move( @n, @destination )
%nact( "$n suddenly arrives.", \ 1, @n, null, null, skipActor )
%do( @n, "look" ) } endif |