ID:1863892
 
BYOND Version:507
Operating System:Linux
Web Browser:Chrome 40.0.2214.111
Applies to:DM Language
Status: Deferred

This issue may be low priority or very difficult to fix, and has been put on the back burner for the time being.
Descriptive Problem Summary: Defining a verb with first argument 'in [PROC]' causes the verb to show in right click on all atoms with the type of the argument, regardless of their presence or otherwise in the returned list from PROC.
Typing the verb manually into the bar results in the correct list being shown, as does clicking it in the verb panel.

Numbered Steps to Reproduce Problem:
Define a verb whose first argument is restricted to a subset of atoms on the map
Right click an atom which is not included, and see that the verb is listed

Code Snippet (if applicable) to Reproduce Problem:
/atom/movable/New()
loc = locate(1,1,1)
..()

/mob/verb/all_mobs(mob/M in world)
src << "All mobs: [M]"
/mob/verb/only_some_mobs(mob/M in some_mobs())
src << "Some mobs: [M]"
/mob/verb/no_mobs(mob/M in list())
src << "No mobs: [M]"

/mob/verb/all_objs(obj/O in world)
src << "All objs: [O]"
/mob/verb/only_some_objs(obj/O in some_objs())
src << "Some objs: [O]"
/mob/verb/no_objs(obj/O in list())
src << "No objs: [O]"

/proc/some_mobs()
. = list()
for(var/mob/M in world)
if(M.name in some_list)
. += M

/proc/some_objs()
. = list()
for(var/obj/O in world)
if(O.name in some_list)
. += O

/atom/icon = 'icon.dmi'
/mob/icon_state = "mob"
/obj/icon_state = "obj"
/turf/icon_state = "turf"
/world/maxx = 1

/var/list/some_list = list("mob1", "mob2", "obj1", "obj2")

/world/New()
..()
new /mob{name="mob1"}()
new /mob{name="mob2"}()
new /mob{name="mob3"}()
new /mob{name="mob4"}()
new /obj{name="obj1"}()
new /obj{name="obj2"}()
new /obj{name="obj3"}()
new /obj{name="obj4"}()

(the above code expects a file 'icon.dmi' containing "mob", "obj", and "turf" states, such as this one)

Expected Results: Verbs with first arguments defined 'in PROC' would only show for atoms in the returned value of that proc.
For the code above, only mobs or objects whose names are present in 'some_list' (for only_some_*) or none (for no_*).

Actual Results: Verbs show on all atoms of the type defined in the variable - if a verb is defined as '/mob/verb/break(atom/A in list())', it will show in the right click menu for all atoms in the world, despite not being invokable on any of them.

Does the problem occur:
Every time? Or how often? Every time
In other games? Irrelevant
In other user accounts? Unknown
On other computers? Unknown

When does the problem NOT occur? Unknown

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown

Workarounds: None known

What version of 507 are you using?
There isn't any way to restrict whether they appear based on being in a server-generated list. The right-click menu doesn't work that way. When you restrict arguments to a server-generated list, it requires a lookup when the command is expanded or completed; this would not be practical in a right-click menu.

While this is sort of a bug in a very technical sense, I just don't think it's practical for this to work the way you intend.
Nadrew changed status to 'Deferred'
Would it be feasible to restrict the types to the exact type of the argument? Currently a verb defined as '/mob/verb/thing(mob/one/A in world)' will also show on instances of /mob/two.
In response to GinjaNinja32
GinjaNinja32 wrote:
Would it be feasible to restrict the types to the exact type of the argument? Currently a verb defined as '/mob/verb/thing(mob/one/A in world)' will also show on instances of /mob/two.

No. The way the command parser and verbs in general work, limiting to a specific type path is not supported. All verbs truly understand are "as mob" and other such simple types.