ID:140054
 
Code:
mob/proc/addverbs()
src << "You got verbs!"
src.icon = 'special.dmi'
verbs += typesof(/mob/v_verbs/verb)

obj
kc_vend_2
icon = 'kc_vend_2.dmi'
icon_state = "on"

verb/MakeVerb()
set src in oview(2)

if(!usr.client) return

usr.addverbs()


Problem description:

If i call addverbs() through the game using another proc or some other mob verb etc it runs and adds all of /mob/v_verbs/verb just fine. As expected.

However... if i use it through the obj/verb (as above), it runs it all but i do not get the verbs. Nor an error.

Now this is part of a longer proc obviously (cut out the non relivent stuff) but the verb adding is the only thing that fails to work in the code. Which only happens when i run it through that objects verb. Am i missing something obvious?

I have no idea how that would not work. Could I see the entire MakeVerb verb?
In response to Warlord Fred
Ok, I decided to strip the working verb down (I know it works as a proc/verb elsewhere). I made it just the Verb and it works! So more experimenting....

The verb changes the client.eye of the usr to another mob.

I have found that if the mobs are in view of the usr, then the verbs are added. If they are not, then the verbs are not added... ALSO if the mob im watching comes near me after ive ran this proc and the verbs have failed to add, the verbs appear in my mob once they come in view and stay there even after they move away from me.... wth O.o

This is the full proc;
mob/proc
WatchRiding()

if(isdueling || spectating || isbusy) return

isbusy = 1

var/list/duels[]=new()
var/list/players = list()

for(var/mob/M in world) if(M.isdueling) if(!players.Find(M)) if(M.Opponents.len)

if(M.Field) if(M.Field.name == "Speed World" || M.Field.name == "Speed World 2")

var/A = "[M.name] (LP [M.LP])"

for(var/mob/O in M.SeeDuel) if(O!=M) if(O.isdueling) A += " vs [O.name] (LP [O.LP])"

players += M.SeeDuel

duels+=A
duels[A] = M

if(!duels.len)
usr << "<b>There are currently no Riding Duels in progress.</b>"
isbusy = 0
return

var/duelchoice = input("Choose a Riding Duel to watch?","Riding Duels") as null|anything in duels
if(!duelchoice) {isbusy=0; return}

if(!isriding) MoveLkd = 1

var/mob/View = duels[duelchoice]

for(var/mob/L in View.SeeDuel) if(!SeeDuel.Find(L)) SeeDuel += L

SeeDuel += src

spectating = 1

usr.verbs += typesof(/mob/v_verbs/verb)
winset(src, "chat.buttons", "left=c_bv")
winset(src, "chat.input", "command=viewsay")
winset(src, "chat.input", "background-color=#4BAE9D")

overlays += /obj/overlays/emote/view/riding
client.eye = View.client.eye

//if(View.Field) if(findtextEx(View.Field.name,"Speed World")) make_image(src,'speed_world.dmi',"",1,1,src.zoom,src.zoom,0,/obj/FieldSpell,0)

winset(src,"_dock.duel","image=dock_b_duel_d.png")
winset(src,"_dock.dwheel","image=dock_b_dwheel_d.png")
winset(src,"_dock.view","text=\"Stop Viewing\"")

isbusy = 0

return


I cant seem to find any explination as to why it being a verb on an Object makes the verb adding fail.
Did you try
src.verbs += typesof(/mob/v_verbs/verb)

Not saying it will or won't work, but I cannot see why it doesn't work in the first place, so I am just throwing things out there.
In response to EternalDuelistSoul
Updates to objects outside the view of a client are not sent to that client. This is a simple measure to reduce the amount of network traffic used by a game.

A quick workaround, here, would be to add everybody's mob to their client's screen, which wouldn't have any visual effect provided they have no screen_loc, but would force the server to always update a client with changes to their mob.