ID:2227113
 
(See the best response by Nadrew.)
Code:
mob/
var/in_rmb_menu = null
..()

obj/screen/rmb_menu
name = "fancy RMB menu"
screen_loc = "1,1"
layer = 999
mouse_opacity = 2

atom/proc/advanced_rmb(var/atom/A,var/params)
if (usr.in_rmb_menu)
close_menu()
usr.in_rmb_menu = null
return 0
var/turf/CT = get_turf(A)
var/list/OL = list()
for (var/atom/CA in CT)
if (usr in oviewers(A))
OL += CA
draw_menu(OL,"object_list",params)
return 1

atom/proc/draw_menu(var/OL,var/mode,var/params)
var/list/PRM = params2list(params)
var/sector = 0
var/R = 0
var/counter = 0
var/list/VL = list()
var/obj/screen/rmb_menu/RMBmenu = new /obj/screen/rmb_menu
usr.in_rmb_menu = RMBmenu
RMBmenu.screen_loc = PRM.screen-loc
usr << image(icon='fancy_hud/rmb.dmi',icon_state="close",RMBmenu, pixel_x = -8, pixel_y = -8)
switch(mode)
if ("object_list")
sector = 360/(OL.len)
R = 8 + (Ol.len)*2
counter = 0
for (var/atom/A in OL)
usr << image(icon='fancy_hud/rmb.dmi',icon_state="element",RMBmenu, pixel_x = R*cos(counter*(2*M_PI/(OL.len)))-8, pixel_y = R*sin(counter*(2*M_PI/(OL.len)))-8)
usr << image(icon=A.icon.scale(16,16),icon_state=A.icon_state,RMBmenu, pixel_x = R*cos(counter*(2*M_PI/(OL.len)))-8, pixel_y = R*sin(counter*(2*M_PI/(OL.len)))-8)
counter++
if ("verb_list")
sector = 360/(OL.len)
R = 8 + (Ol.len)*2
counter = 0
for (var/V in OL.verbs)
VL += V


Problem description:

I want to rewrite context menu into graphical on, but encountered a little problem. Which verbs are visible on RMB: src's verb list, object's, both of them? How can i manage to get list of all shown verbs?
for(var/V in OL.verbs)
if(V:hidden) continue
// Stuff
In response to Nadrew
Nadrew wrote:
> for(var/V in OL.verbs)
> if(V:hidden) continue
> // Stuff
>


But this menu hold not only objects verb, but what you can do with it. As example my mob can pick up objects, but it's mob's verb. Therefore it's shown in rmb menu. So your solution will return not full list of accesible verbs.
As far as I know, there's no way to detect whether a verb within mob.verbs takes an object as an argument or not.
In response to Nadrew
All i need to know, is how list of verbs in context menu forming in byond, which verbs it shows exactly, and which not. If i will not find answer i will decompile byond to find out, which violates it's license.
Best response
It'll show any accessible verbs associated with what you right-clicked, meaning any verbs you hold that could take that object as an argument, and any verb the object contains that has its 'set src' requirements met by the mob.

There's no way to access all of the information needed to duplicate this functionality exactly using DM. You'd have to devise your own means of handling accessibility of the commands.
So i need to parse usr verbs, filter from them only, that can take object as argument. And do same thing with object, to find out use verb usr as src or not, right?
Basically, but I'm unsure of an automated means of determining if a verb takes an object as an argument or not.
I'm still waiting for solution for this, can't figure out how list is forming
As I stated, you're never going to have access to all of the information you need to get the desired results.